././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1682955392.8671632 libzim-3.1.0/0000755000175100001730000000000014423756201012406 5ustar00runnerdocker././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1682955378.0 libzim-3.1.0/LICENSE0000644000175100001730000010451514423756162013427 0ustar00runnerdocker GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1682955378.0 libzim-3.1.0/MANIFEST.in0000644000175100001730000000054514423756162014156 0ustar00runnerdockerinclude LICENSE include README.md include tests/*.py include pyproject.toml include setup.cfg include requirements-dev.txt include tasks.py include libzim/*.cpp include libzim/*.h include libzim/*.py include libzim/*.pxd include libzim/*.pyx global-exclude __pycache__/* exclude *.egg-info/* exclude libzim/*.dylib exclude libzim/*.so exclude libzim/*.so.* ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1682955392.8671632 libzim-3.1.0/PKG-INFO0000644000175100001730000002065514423756201013513 0ustar00runnerdockerMetadata-Version: 2.1 Name: libzim Version: 3.1.0 Summary: A python-facing API for creating and interacting with ZIM files Home-page: https://github.com/openzim/python-libzim Author: Monadical Inc. Author-email: jdc@monadical.com Maintainer: openZIM Maintainer-email: contact+openzim@kiwix.org License: GPL-3.0-or-later Project-URL: Donate, https://www.kiwix.org/en/support-us/ Classifier: Development Status :: 5 - Production/Stable Classifier: Topic :: Utilities Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: System :: Archiving Classifier: Topic :: System :: Archiving :: Compression Classifier: Topic :: System :: Archiving :: Mirroring Classifier: Topic :: System :: Archiving :: Backup Classifier: Intended Audience :: Developers Classifier: Programming Language :: Cython Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Typing :: Stubs Only Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) Classifier: Operating System :: MacOS Classifier: Operating System :: POSIX Requires-Python: <3.12,>=3.7 Description-Content-Type: text/markdown License-File: LICENSE # python-libzim `libzim` module allows you to read and write [ZIM files](https://openzim.org) in Python. It provides a shallow python interface on top of the [C++ `libzim` library](https://github.com/openzim/libzim). It is primarily used in [openZIM](https://github.com/openzim/) scrapers like [`sotoki`](https://github.com/openzim/sotoki) or [`youtube2zim`](https://github.com/openzim/youtube). [![Build Status](https://github.com/openzim/python-libzim/workflows/test/badge.svg?query=branch%3Amain)](https://github.com/openzim/python-libzim/actions?query=branch%3Amain) [![CodeFactor](https://www.codefactor.io/repository/github/openzim/python-libzim/badge)](https://www.codefactor.io/repository/github/openzim/python-libzim) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![PyPI version shields.io](https://img.shields.io/pypi/v/libzim.svg)](https://pypi.org/project/libzim/) [![codecov](https://codecov.io/gh/openzim/python-libzim/branch/main/graph/badge.svg)](https://codecov.io/gh/openzim/python-libzim) ## Installation ```sh pip install libzim ``` Our [PyPI wheels](https://pypi.org/project/libzim/) bundle a [recent release](https://download.openzim.org/release/libzim/) of the C++ libzim and are available for the following platforms: - macOS for `x86_64` and `arm64` - GNU/Linux for `x86_64`, `armhf` and `aarch64` - Linux+musl for `x86_64` and `aarch64` Wheels are available for both CPython and PyPy. Users on other platforms can install the source distribution (see [Building](#Building) below). ## Contributions ```sh git clone git@github.com:openzim/python-libzim.git && cd python-libzim # python -m venv env && source env/bin/activate pip install -U setuptools invoke invoke download-libzim install-dev build-ext test # invoke --list for available development helpers ``` See [CONTRIBUTING.md](./CONTRIBUTING.md) for additional details then [Open a ticket](https://github.com/openzim/python-libzim/issues/new) or submit a Pull Request on Github 🤗! ## Usage ### Read a ZIM file ```python from libzim.reader import Archive from libzim.search import Query, Searcher from libzim.suggestion import SuggestionSearcher zim = Archive("test.zim") print(f"Main entry is at {zim.main_entry.get_item().path}") entry = zim.get_entry_by_path("home/fr") print(f"Entry {entry.title} at {entry.path} is {entry.get_item().size}b.") print(bytes(entry.get_item().content).decode("UTF-8")) # searching using full-text index search_string = "Welcome" query = Query().set_query(search_string) searcher = Searcher(zim) search = searcher.search(query) search_count = search.getEstimatedMatches() print(f"there are {search_count} matches for {search_string}") print(list(search.getResults(0, search_count))) # accessing suggestions search_string = "kiwix" suggestion_searcher = SuggestionSearcher(zim) suggestion = suggestion_searcher.suggest(search_string) suggestion_count = suggestion.getEstimatedMatches() print(f"there are {suggestion_count} matches for {search_string}") print(list(suggestion.getResults(0, suggestion_count))) ``` ### Write a ZIM file ```py from libzim.writer import Creator, Item, StringProvider, FileProvider, Hint class MyItem(Item): def __init__(self, title, path, content = "", fpath = None): super().__init__() self.path = path self.title = title self.content = content self.fpath = fpath def get_path(self): return self.path def get_title(self): return self.title def get_mimetype(self): return "text/html" def get_contentprovider(self): if self.fpath is not None: return FileProvider(self.fpath) return StringProvider(self.content) def get_hints(self): return {Hint.FRONT_ARTICLE: True} content = """Web Page Title

Welcome to this ZIM

Kiwix

""" item = MyItem("Hello Kiwix", "home", content) item2 = MyItem("Bonjour Kiwix", "home/fr", None, "home-fr.html") with Creator("test.zim").config_indexing(True, "eng") as creator: creator.set_mainpath("home") creator.add_item(item) creator.add_item(item2) for name, value in { "creator": "python-libzim", "description": "Created in python", "name": "my-zim", "publisher": "You", "title": "Test ZIM", }.items(): creator.add_metadata(name.title(), value) ``` ## Building `libzim` package building offers different behaviors via environment variables | Variable | Example | Use case | | -------------------------------- | ---------------------------------------- | -------- | | `LIBZIM_DL_VERSION` | `8.1.1` or `2023-04-14` | Specify the C++ libzim binary version to download and bundle. Either a release version string or a date, in which case it downloads a nightly | | `USE_SYSTEM_LIBZIM` | `1` | Uses `LDFLAG` and `CFLAGS` to find the libzim to link against. Resulting wheel won't bundle C++ libzim. | | `DONT_DOWNLOAD_LIBZIM` | `1` | Disable downloading of C++ libzim. Place headers in `include/` and libzim dylib/so in `libzim/` if no using system libzim. It will be bundled in wheel. | | `PROFILE` | `1` | Enable profile tracing in Cython extension. Required for Cython code coverage reporting. | | `SIGN_APPLE` | `1` | Set to sign and notarize the extension for macOS. Requires following informations | | `APPLE_SIGNING_IDENTITY` | `Developer ID Application: OrgName (ID)` | Required for signing on macOS | | `APPLE_SIGNING_KEYCHAIN_PATH` | `/tmp/build.keychain` | Path to the Keychain containing the certificate to sign for macOS with | | `APPLE_SIGNING_KEYCHAIN_PROFILE` | `build` | Name of the profile in the specified Keychain | ### Examples ##### Default: downloading and bundling most appropriate libzim release binary ```sh python3 -m build ``` #### Using system libzim (brew, debian or manually installed) - not bundled ```sh # using system-installed C++ libzim brew install libzim # macOS apt-get install libzim-devel # debian dnf install libzim-dev # fedora USE_SYSTEM_LIBZIM=1 python3 -m build --wheel # using a specific C++ libzim USE_SYSTEM_LIBZIM=1 \ CFLAGS="-I/usr/local/include" \ LDFLAGS="-L/usr/local/lib" DYLD_LIBRARY_PATH="/usr/local/lib" \ LD_LIBRARY_PATH="/usr/local/lib" \ python3 -m build --wheel ``` #### Other platforms On platforms for which there is no [official binary](https://download.openzim.org/release/libzim/) available, you'd have to [compile C++ libzim from source](https://github.com/openzim/libzim) first then either use `DONT_DOWNLOAD_LIBZIM` or `USE_SYSTEM_LIBZIM`. ## License [GPLv3](https://www.gnu.org/licenses/gpl-3.0) or later, see [LICENSE](LICENSE) for more details. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1682955378.0 libzim-3.1.0/README.md0000644000175100001730000001575714423756162013712 0ustar00runnerdocker# python-libzim `libzim` module allows you to read and write [ZIM files](https://openzim.org) in Python. It provides a shallow python interface on top of the [C++ `libzim` library](https://github.com/openzim/libzim). It is primarily used in [openZIM](https://github.com/openzim/) scrapers like [`sotoki`](https://github.com/openzim/sotoki) or [`youtube2zim`](https://github.com/openzim/youtube). [![Build Status](https://github.com/openzim/python-libzim/workflows/test/badge.svg?query=branch%3Amain)](https://github.com/openzim/python-libzim/actions?query=branch%3Amain) [![CodeFactor](https://www.codefactor.io/repository/github/openzim/python-libzim/badge)](https://www.codefactor.io/repository/github/openzim/python-libzim) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![PyPI version shields.io](https://img.shields.io/pypi/v/libzim.svg)](https://pypi.org/project/libzim/) [![codecov](https://codecov.io/gh/openzim/python-libzim/branch/main/graph/badge.svg)](https://codecov.io/gh/openzim/python-libzim) ## Installation ```sh pip install libzim ``` Our [PyPI wheels](https://pypi.org/project/libzim/) bundle a [recent release](https://download.openzim.org/release/libzim/) of the C++ libzim and are available for the following platforms: - macOS for `x86_64` and `arm64` - GNU/Linux for `x86_64`, `armhf` and `aarch64` - Linux+musl for `x86_64` and `aarch64` Wheels are available for both CPython and PyPy. Users on other platforms can install the source distribution (see [Building](#Building) below). ## Contributions ```sh git clone git@github.com:openzim/python-libzim.git && cd python-libzim # python -m venv env && source env/bin/activate pip install -U setuptools invoke invoke download-libzim install-dev build-ext test # invoke --list for available development helpers ``` See [CONTRIBUTING.md](./CONTRIBUTING.md) for additional details then [Open a ticket](https://github.com/openzim/python-libzim/issues/new) or submit a Pull Request on Github 🤗! ## Usage ### Read a ZIM file ```python from libzim.reader import Archive from libzim.search import Query, Searcher from libzim.suggestion import SuggestionSearcher zim = Archive("test.zim") print(f"Main entry is at {zim.main_entry.get_item().path}") entry = zim.get_entry_by_path("home/fr") print(f"Entry {entry.title} at {entry.path} is {entry.get_item().size}b.") print(bytes(entry.get_item().content).decode("UTF-8")) # searching using full-text index search_string = "Welcome" query = Query().set_query(search_string) searcher = Searcher(zim) search = searcher.search(query) search_count = search.getEstimatedMatches() print(f"there are {search_count} matches for {search_string}") print(list(search.getResults(0, search_count))) # accessing suggestions search_string = "kiwix" suggestion_searcher = SuggestionSearcher(zim) suggestion = suggestion_searcher.suggest(search_string) suggestion_count = suggestion.getEstimatedMatches() print(f"there are {suggestion_count} matches for {search_string}") print(list(suggestion.getResults(0, suggestion_count))) ``` ### Write a ZIM file ```py from libzim.writer import Creator, Item, StringProvider, FileProvider, Hint class MyItem(Item): def __init__(self, title, path, content = "", fpath = None): super().__init__() self.path = path self.title = title self.content = content self.fpath = fpath def get_path(self): return self.path def get_title(self): return self.title def get_mimetype(self): return "text/html" def get_contentprovider(self): if self.fpath is not None: return FileProvider(self.fpath) return StringProvider(self.content) def get_hints(self): return {Hint.FRONT_ARTICLE: True} content = """Web Page Title

Welcome to this ZIM

Kiwix

""" item = MyItem("Hello Kiwix", "home", content) item2 = MyItem("Bonjour Kiwix", "home/fr", None, "home-fr.html") with Creator("test.zim").config_indexing(True, "eng") as creator: creator.set_mainpath("home") creator.add_item(item) creator.add_item(item2) for name, value in { "creator": "python-libzim", "description": "Created in python", "name": "my-zim", "publisher": "You", "title": "Test ZIM", }.items(): creator.add_metadata(name.title(), value) ``` ## Building `libzim` package building offers different behaviors via environment variables | Variable | Example | Use case | | -------------------------------- | ---------------------------------------- | -------- | | `LIBZIM_DL_VERSION` | `8.1.1` or `2023-04-14` | Specify the C++ libzim binary version to download and bundle. Either a release version string or a date, in which case it downloads a nightly | | `USE_SYSTEM_LIBZIM` | `1` | Uses `LDFLAG` and `CFLAGS` to find the libzim to link against. Resulting wheel won't bundle C++ libzim. | | `DONT_DOWNLOAD_LIBZIM` | `1` | Disable downloading of C++ libzim. Place headers in `include/` and libzim dylib/so in `libzim/` if no using system libzim. It will be bundled in wheel. | | `PROFILE` | `1` | Enable profile tracing in Cython extension. Required for Cython code coverage reporting. | | `SIGN_APPLE` | `1` | Set to sign and notarize the extension for macOS. Requires following informations | | `APPLE_SIGNING_IDENTITY` | `Developer ID Application: OrgName (ID)` | Required for signing on macOS | | `APPLE_SIGNING_KEYCHAIN_PATH` | `/tmp/build.keychain` | Path to the Keychain containing the certificate to sign for macOS with | | `APPLE_SIGNING_KEYCHAIN_PROFILE` | `build` | Name of the profile in the specified Keychain | ### Examples ##### Default: downloading and bundling most appropriate libzim release binary ```sh python3 -m build ``` #### Using system libzim (brew, debian or manually installed) - not bundled ```sh # using system-installed C++ libzim brew install libzim # macOS apt-get install libzim-devel # debian dnf install libzim-dev # fedora USE_SYSTEM_LIBZIM=1 python3 -m build --wheel # using a specific C++ libzim USE_SYSTEM_LIBZIM=1 \ CFLAGS="-I/usr/local/include" \ LDFLAGS="-L/usr/local/lib" DYLD_LIBRARY_PATH="/usr/local/lib" \ LD_LIBRARY_PATH="/usr/local/lib" \ python3 -m build --wheel ``` #### Other platforms On platforms for which there is no [official binary](https://download.openzim.org/release/libzim/) available, you'd have to [compile C++ libzim from source](https://github.com/openzim/libzim) first then either use `DONT_DOWNLOAD_LIBZIM` or `USE_SYSTEM_LIBZIM`. ## License [GPLv3](https://www.gnu.org/licenses/gpl-3.0) or later, see [LICENSE](LICENSE) for more details. ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1682955392.8671632 libzim-3.1.0/libzim/0000755000175100001730000000000014423756201013674 5ustar00runnerdocker././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1682955378.0 libzim-3.1.0/libzim/libwrapper.cpp0000644000175100001730000001460414423756162016562 0ustar00runnerdocker/* * This file is part of python-libzim * (see https://github.com/libzim/python-libzim) * * Copyright (c) 2020 Juan Diego Caballero * Copyright (c) 2020 Matthieu Gautier * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include "libwrapper.h" #include "libzim_api.h" #include #include #include #include ObjWrapper::ObjWrapper(PyObject* obj) : m_obj(obj) { if (import_libzim()) { std::cerr << "Error executing import_libzim!\n"; throw std::runtime_error("Error executing import_libzim"); } Py_XINCREF(m_obj); } ObjWrapper::ObjWrapper(ObjWrapper&& other) : m_obj(other.m_obj) { other.m_obj = nullptr; } ObjWrapper& ObjWrapper::operator=(ObjWrapper&& other) { m_obj = other.m_obj; other.m_obj = nullptr; return *this; } ObjWrapper::~ObjWrapper() { // We must decrement the ref of the python object. if (m_obj != nullptr) { PyGILState_STATE gstate; gstate = PyGILState_Ensure(); Py_XDECREF(this->m_obj); PyGILState_Release(gstate); } } // Just call the right (regarding the output) method. // No check or error handling. template Output _callMethodOnObj(PyObject *obj, const std::string& methodName, std::string& error); template<> bool _callMethodOnObj(PyObject *obj, const std::string& methodName, std::string& error) { return bool_cy_call_fct(obj, methodName, &error); } template<> std::string _callMethodOnObj(PyObject *obj, const std::string& methodName, std::string& error) { return string_cy_call_fct(obj, methodName, &error); } template<> uint64_t _callMethodOnObj(PyObject *obj, const std::string& methodName, std::string& error) { return uint64_cy_call_fct(obj, methodName, &error); } template<> uint32_t _callMethodOnObj(PyObject *obj, const std::string& methodName, std::string& error) { return uint32_cy_call_fct(obj, methodName, &error); } template<> zim::Blob _callMethodOnObj(PyObject *obj, const std::string& methodName, std::string& error) { return blob_cy_call_fct(obj, methodName, &error); } template<> std::unique_ptr _callMethodOnObj(PyObject *obj, const std::string& methodName, std::string& error) { return std::unique_ptr(contentprovider_cy_call_fct(obj, methodName, &error)); } template<> std::shared_ptr _callMethodOnObj(PyObject *obj, const std::string& methodName, std::string& error) { return std::shared_ptr(indexdata_cy_call_fct(obj, methodName, &error)); } template<> zim::writer::Hints _callMethodOnObj(PyObject *obj, const std::string& methodName, std::string& error) { return hints_cy_call_fct(obj, methodName, &error); } template<> zim::writer::IndexData::GeoPosition _callMethodOnObj(PyObject *obj, const std::string& methodName, std::string& error) { return geoposition_cy_call_fct(obj, methodName, &error); } // This cpp function call a python method on a python object. // It checks that we are in a valid state and handle any potential error coming from python. template Output callMethodOnObj(PyObject* obj, const std::string& methodName) { if (!obj) { throw std::runtime_error("Python object not set"); } std::string error; Output out = _callMethodOnObj(obj, methodName, error); if (!error.empty()) { throw std::runtime_error(error); } return out; } /* ################################ # Content Provider Wrapper # ################################ */ zim::size_type ContentProviderWrapper::getSize() const { return callMethodOnObj(m_obj, "get_size"); } zim::Blob ContentProviderWrapper::feed() { return callMethodOnObj(m_obj, "feed"); } /* ################################ # Index Data Wrapper # ################################ */ bool IndexDataWrapper::hasIndexData() const { return callMethodOnObj(m_obj, "has_indexdata"); } std::string IndexDataWrapper::getTitle() const { return callMethodOnObj(m_obj, "get_title"); } std::string IndexDataWrapper::getContent() const { return callMethodOnObj(m_obj, "get_content"); } std::string IndexDataWrapper::getKeywords() const { return callMethodOnObj(m_obj, "get_keywords"); } uint32_t IndexDataWrapper::getWordCount() const { return callMethodOnObj(m_obj, "get_wordcount"); } zim::writer::IndexData::GeoPosition IndexDataWrapper::getGeoPosition() const { return callMethodOnObj(m_obj, "get_geoposition"); } /* ######################### # WriterItem # ######################### */ std::string WriterItemWrapper::getPath() const { return callMethodOnObj(m_obj, "get_path"); } std::string WriterItemWrapper::getTitle() const { return callMethodOnObj(m_obj, "get_title"); } std::string WriterItemWrapper::getMimeType() const { return callMethodOnObj(m_obj, "get_mimetype"); } std::unique_ptr WriterItemWrapper::getContentProvider() const { return callMethodOnObj>(m_obj, "get_contentprovider"); } std::shared_ptr WriterItemWrapper::getIndexData() const { if (!obj_has_attribute(m_obj, "get_indexdata")) { return zim::writer::Item::getIndexData(); } return callMethodOnObj>(m_obj, "get_indexdata"); } zim::writer::Hints WriterItemWrapper::getHints() const { return callMethodOnObj(m_obj, "get_hints"); } zim::Compression comp_from_int(int compValue) { switch(compValue) { case 0: return zim::Compression::None; case 1: return zim::Compression::Zstd; default: // Should we raise an error ? return zim::Compression::None; } } ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1682955378.0 libzim-3.1.0/libzim/libwrapper.h0000644000175100001730000002546214423756162016233 0ustar00runnerdocker// -*- c++ -*- /* * This file is part of python-libzim * (see https://github.com/libzim/python-libzim) * * Copyright (c) 2021 Matthieu Gautier . * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef LIBZIM_LIBWRAPPER_H #define LIBZIM_LIBWRAPPER_H #include #include #include #include #include #include #include #include struct _object; typedef _object PyObject; // There are two kinds of wrapping : // - Wrapping C++ object to pass it in the Python world. // - Wrapping Python objects to pass it to the C++ world (mainly used by the creator). // // C++ wrapper side. // The main issue here is that libzim classes cannot be "default constructed". // libzim object are build by the libzim itself and are always "valid". // But cython generate code using two instructions : // The cython code `cdef Item item = archive.getItem(...)` is translated to : // ``` // Item item; // item = archive.getItem(...); // ``` // Which is not possible because the Item has not default constructor. // The solution is to manipulate all libzim object through pointers // (pointer can be default constructed to nullptr). // As the libzim functions/methods return directly the instance, we have to wrap all // of them (in pure C++) to make them return a pointer. // (Hopefully, copy constructor is available on libzim classes) // // To help us, we define a Wrapper class which wrap a libzim instance by storing // a internel pointer to a heap allocated instance. // This wrapper provide all constructors/helpers to build it and use the wrapped instance. // (Especially, a default constructor) // // On top of that, we are writing specific wrapper to overwrite some method to return a // Wrapper instead of Foo. // As Wrapper do not inherit from Foo, we must define all the methods we want to wrap in python. // Thoses methods just have to forward the call from the wrapper to the wrapped instance. // As Wrapper can be implicitly constructed from Foo, we can also simply forward the call and the // conversion will be made for us. // The macro FORWARD help us a lot here. /** * A base wrapper for our structures */ template class Wrapper { public: Wrapper() {} ~Wrapper() = default; Wrapper(const Base& base) : mp_base(new Base(base)) {} Wrapper(Base&& base) : mp_base(new Base(std::move(base))) {} Wrapper(Wrapper&& other) = default; Wrapper& operator=(Wrapper&& other) = default; protected: std::unique_ptr mp_base; }; #define FORWARD(OUT, NAME) template OUT NAME(ARGS&&... args) const { return mp_base->NAME(std::forward(args)...); } namespace wrapper { // Wrapping blob is not necessary as we can default construct a zim::Blob. // But it is nice to have for consistancy. class Blob : public Wrapper { public: Blob() = default; Blob(const zim::Blob& o) : Wrapper(o) {} Blob(const char* data, zim::size_type size) : Wrapper(zim::Blob(data, size)) {}; operator zim::Blob() { return *mp_base; } FORWARD(const char*, data) FORWARD(const char*, end) FORWARD(zim::size_type, size) }; class Item : public Wrapper { public: Item() = default; Item(const zim::Item& o) : Wrapper(o) {} FORWARD(std::string, getTitle) FORWARD(std::string, getPath) FORWARD(std::string, getMimetype) FORWARD(wrapper::Blob, getData) FORWARD(zim::size_type, getSize) FORWARD(zim::entry_index_type, getIndex) }; class Entry : public Wrapper { public: Entry() = default; Entry(const zim::Entry& o) : Wrapper(o) {} FORWARD(std::string, getTitle) FORWARD(std::string, getPath) FORWARD(bool, isRedirect) FORWARD(wrapper::Item, getItem) FORWARD(wrapper::Item, getRedirect) FORWARD(wrapper::Entry, getRedirectEntry) FORWARD(zim::entry_index_type, getIndex) }; class Archive : public Wrapper { public: Archive() = default; Archive(const std::string& filename) : Wrapper(zim::Archive(filename)) {}; Archive(const zim::Archive& o) : Wrapper(o) {}; zim::Archive& operator*() const { return *mp_base; } FORWARD(wrapper::Entry, getEntryByPath) FORWARD(wrapper::Entry, getEntryByTitle) FORWARD(wrapper::Entry, getMainEntry) FORWARD(wrapper::Item, getIllustrationItem) FORWARD(std::set, getIllustrationSizes) std::string getUuid() const { auto u = mp_base->getUuid(); std::string uuids(u.data, u.size()); return uuids; } FORWARD(zim::size_type, getFilesize) FORWARD(std::string, getMetadata) FORWARD(wrapper::Item, getMetadataItem) FORWARD(std::vector, getMetadataKeys) FORWARD(zim::size_type, getEntryCount) FORWARD(zim::size_type, getAllEntryCount) FORWARD(zim::size_type, getArticleCount) FORWARD(zim::size_type, getMediaCount) FORWARD(std::string, getChecksum) FORWARD(std::string, getFilename) FORWARD(bool, hasMainEntry) FORWARD(bool, hasIllustration) FORWARD(bool, hasEntryByPath) FORWARD(bool, hasEntryByTitle) FORWARD(bool, isMultiPart) FORWARD(bool, hasNewNamespaceScheme) FORWARD(bool, hasFulltextIndex) FORWARD(bool, hasTitleIndex) FORWARD(bool, hasChecksum) FORWARD(bool, check) }; class SearchResultSet : public Wrapper { public: SearchResultSet() = default; SearchResultSet(const zim::SearchResultSet& o) : Wrapper(o) {}; FORWARD(zim::SearchIterator, begin) FORWARD(zim::SearchIterator, end) FORWARD(int, size) }; class Search : public Wrapper { public: Search() = default; Search(zim::Search&& s) : Wrapper(std::move(s)) {}; FORWARD(int, getEstimatedMatches) FORWARD(wrapper::SearchResultSet, getResults) }; class Searcher : public Wrapper { public: Searcher() = default; Searcher(const wrapper::Archive& a) : Wrapper(zim::Searcher(*a)) {}; Searcher(const zim::Searcher& o) : Wrapper(o) {}; FORWARD(void, setVerbose) FORWARD(wrapper::Search, search) }; class SuggestionItem : public Wrapper { public: SuggestionItem() = default; SuggestionItem(const zim::SuggestionItem& o) : Wrapper(o) {}; FORWARD(std::string, getTitle) FORWARD(std::string, getPath) FORWARD(std::string, getSnippet) FORWARD(bool, hasSnippet) }; class SuggestionIterator : public Wrapper { public: SuggestionIterator() = default; SuggestionIterator(const zim::SuggestionIterator& o) : Wrapper(o) {}; zim::SuggestionIterator& operator*() const { return *mp_base; } FORWARD(bool, operator==) bool operator!=(const wrapper::SuggestionIterator& it) const { return *mp_base != *it; } FORWARD(wrapper::SuggestionIterator, operator++) SuggestionItem getSuggestionItem() const { return mp_base->operator*(); } // FORWARD(wrapper::SuggestionItem, operator*) FORWARD(wrapper::Entry, getEntry) }; class SuggestionResultSet : public Wrapper { public: SuggestionResultSet() = default; SuggestionResultSet(const zim::SuggestionResultSet& o) : Wrapper(o) {}; FORWARD(wrapper::SuggestionIterator, begin) FORWARD(wrapper::SuggestionIterator, end) FORWARD(int, size) }; class SuggestionSearch : public Wrapper { public: SuggestionSearch() = default; SuggestionSearch(zim::SuggestionSearch&& s) : Wrapper(std::move(s)) {}; FORWARD(int, getEstimatedMatches) FORWARD(wrapper::SuggestionResultSet, getResults) }; class SuggestionSearcher : public Wrapper { public: SuggestionSearcher() = default; SuggestionSearcher(const wrapper::Archive& a) : Wrapper(zim::SuggestionSearcher(*a)) {}; SuggestionSearcher(const zim::SuggestionSearcher& o) : Wrapper(o) {}; FORWARD(void, setVerbose) FORWARD(wrapper::SuggestionSearch, suggest) }; } // namespace wrapper #undef FORWARD // Python wrapper // // The main issue is to forward the c++ method call (made by `zim::Creator`) to the // python method. // // To do so, we define a helper wrapper (ObjWrapper) which wrap a PyObject and allow us to call // different kind of methods (signatures). // Then we write specific wrapper to forward the call using helper methods of ObjWrapper. class ObjWrapper { public: ObjWrapper(PyObject* obj); ObjWrapper(const ObjWrapper& other) = delete; ObjWrapper(ObjWrapper&& other); ~ObjWrapper(); ObjWrapper& operator=(ObjWrapper&& other); protected: PyObject* m_obj; }; class WriterItemWrapper : public zim::writer::Item, private ObjWrapper { public: WriterItemWrapper(PyObject *obj) : ObjWrapper(obj) {}; ~WriterItemWrapper() = default; std::string getPath() const override; std::string getTitle() const override; std::string getMimeType() const override; std::unique_ptr getContentProvider() const override; std::shared_ptr getIndexData() const override; zim::writer::Hints getHints() const override; }; class ContentProviderWrapper : public zim::writer::ContentProvider, private ObjWrapper { public: ContentProviderWrapper(PyObject *obj) : ObjWrapper(obj) {}; ~ContentProviderWrapper() = default; zim::size_type getSize() const override; zim::Blob feed() override; }; class IndexDataWrapper: public zim::writer::IndexData, private ObjWrapper { public: IndexDataWrapper(PyObject *obj) : ObjWrapper(obj) {}; ~IndexDataWrapper() = default; bool hasIndexData() const override; std::string getTitle() const override; std::string getContent() const override; std::string getKeywords() const override; uint32_t getWordCount() const override; IndexData::GeoPosition getGeoPosition() const override; }; // Small helpers // The current stable cython version (0.29.24) doesn't support scoped enum (next version >30 will be). // The cython generated __Pyx_PyInt_As_enum__zim_3a__3a_Compression(PyOobject*) // try to do some strange bit shifting of `zim::Compression` which doesn't compile. // Let's provide our own function for this zim::Compression comp_from_int(int compValue); #endif // LIBZIM_LIBWRAPPER_H ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1682955392.0 libzim-3.1.0/libzim/libzim.cpp0000644000175100001730000530575614423756200015712 0ustar00runnerdocker/* Generated by Cython 0.29.34 */ /* BEGIN: Cython Metadata { "distutils": { "depends": [], "extra_compile_args": [ "-std=c++11", "-Wall", "-Wextra" ], "include_dirs": [ "include" ], "language": "c++", "libraries": [ "zim" ], "library_dirs": [ "libzim" ], "name": "libzim", "runtime_library_dirs": [ "$ORIGIN/libzim/" ], "sources": [ "libzim/libzim.pyx", "libzim/libwrapper.cpp" ] }, "module_name": "libzim" } END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* 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 < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else #define CYTHON_ABI "0_29_34" #define CYTHON_HEX_VERSION 0x001D22F0 #define CYTHON_FUTURE_DIVISION 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 #define __PYX_COMMA , #ifndef HAVE_LONG_LONG #if 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 #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #if PY_VERSION_HEX < 0x03050000 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif #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 #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif #elif defined(PYSTON_VERSION) #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #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 #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif #elif defined(PY_NOGIL) #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 #define CYTHON_COMPILING_IN_NOGIL 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #ifndef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 1 #endif #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 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 1 #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #if PY_VERSION_HEX < 0x02070000 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) #define CYTHON_USE_PYTYPE_LOOKUP 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 (PY_VERSION_HEX < 0x030C00A5) #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 || PY_VERSION_HEX >= 0x030B00A2 #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 #if PY_VERSION_HEX >= 0x030B00A4 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #elif !defined(CYTHON_FAST_THREAD_STATE) #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000) #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) #endif #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) #endif #ifndef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5)) #endif #if PY_VERSION_HEX >= 0x030B00A4 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #elif !defined(CYTHON_USE_EXC_INFO_STACK) #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) #endif #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 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 #if PY_MAJOR_VERSION < 3 #include "longintrepr.h" #endif #undef SHIFT #undef BASE #undef MASK #ifdef SIZEOF_VOID_P enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; #endif #endif #ifndef __has_attribute #define __has_attribute(x) 0 #endif #ifndef __has_cpp_attribute #define __has_cpp_attribute(x) 0 #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 #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_MAYBE_UNUSED_VAR # if defined(__cplusplus) template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } # else # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) # endif #endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED # else # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #ifdef _MSC_VER #ifndef _MSC_STDINT_H_ #if _MSC_VER < 1300 typedef unsigned char uint8_t; typedef unsigned int uint32_t; #else typedef unsigned __int8 uint8_t; typedef unsigned __int32 uint32_t; #endif #endif #else #include #endif #ifndef CYTHON_FALLTHROUGH #if defined(__cplusplus) && __cplusplus >= 201103L #if __has_cpp_attribute(fallthrough) #define CYTHON_FALLTHROUGH [[fallthrough]] #elif __has_cpp_attribute(clang::fallthrough) #define CYTHON_FALLTHROUGH [[clang::fallthrough]] #elif __has_cpp_attribute(gnu::fallthrough) #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] #endif #endif #ifndef CYTHON_FALLTHROUGH #if __has_attribute(fallthrough) #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) #else #define CYTHON_FALLTHROUGH #endif #endif #if defined(__clang__ ) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif #ifndef __cplusplus #error "Cython files generated with the C++ option must be compiled with a C++ compiler." #endif #ifndef CYTHON_INLINE #if defined(__clang__) #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) #else #define CYTHON_INLINE inline #endif #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; } T *operator&() { return ptr; } operator T&() { return *ptr; } template bool operator ==(U other) { return *ptr == other; } template bool operator !=(U other) { return *ptr != other; } private: T *ptr; }; #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_DefaultClassType PyType_Type #if PY_VERSION_HEX >= 0x030B00A1 static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; const char *fn_cstr=NULL; const char *name_cstr=NULL; PyCodeObject* co=NULL; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); if (!(kwds=PyDict_New())) goto end; if (!(argcount=PyLong_FromLong(a))) goto end; if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; if (!(posonlyargcount=PyLong_FromLong(0))) goto end; if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; if (!(nlocals=PyLong_FromLong(l))) goto end; if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; if (!(stacksize=PyLong_FromLong(s))) goto end; if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; if (!(flags=PyLong_FromLong(f))) goto end; if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; Py_XDECREF((PyObject*)co); co = (PyCodeObject*)call_result; call_result = NULL; if (0) { cleanup_code_too: Py_XDECREF((PyObject*)co); co = NULL; } end: Py_XDECREF(kwds); Py_XDECREF(argcount); Py_XDECREF(posonlyargcount); Py_XDECREF(kwonlyargcount); Py_XDECREF(nlocals); Py_XDECREF(stacksize); Py_XDECREF(replace); Py_XDECREF(call_result); Py_XDECREF(empty); if (type) { PyErr_Restore(type, value, traceback); } return co; } #else #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) #endif #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_STACKLESS #define METH_STACKLESS 0 #endif #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) #ifndef METH_FASTCALL #define METH_FASTCALL 0x80 #endif typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames); #else #define __Pyx_PyCFunctionFast _PyCFunctionFast #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #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 | METH_KEYWORDS | METH_STACKLESS))))) #else #define __Pyx_PyFastCFunction_Check(func) 0 #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_CPYTHON && PY_VERSION_HEX < 0x030400A1 #define PyMem_RawMalloc(n) PyMem_Malloc(n) #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) #define PyMem_RawFree(p) PyMem_Free(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 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x03060000 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() #elif PY_VERSION_HEX >= 0x03000000 #define __Pyx_PyThreadState_Current PyThreadState_GET() #else #define __Pyx_PyThreadState_Current _PyThreadState_Current #endif #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) #include "pythread.h" #define Py_tss_NEEDS_INIT 0 typedef int Py_tss_t; static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { *key = PyThread_create_key(); return 0; } static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); *key = Py_tss_NEEDS_INIT; return key; } static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { PyObject_Free(key); } static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { return *key != Py_tss_NEEDS_INIT; } static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { PyThread_delete_key(*key); *key = Py_tss_NEEDS_INIT; } static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { return PyThread_set_key_value(*key, value); } static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } #endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else #define __Pyx_PyDict_NewPresized(n) PyDict_New() #endif #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) #else #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_READY(op) (0) #else #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) #endif #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) #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) #else #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) #endif #endif #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 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? 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 #ifndef PyObject_Unicode #define PyObject_Unicode PyObject_Str #endif #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 #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) #else #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) #endif #if CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) #else #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) #endif #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 __Pyx_PyIndex_AsHash_t #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(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 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) #endif #else #define __Pyx_PyType_AsAsync(obj) NULL #endif #ifndef __Pyx_PyAsyncMethodsStruct typedef struct { unaryfunc am_await; unaryfunc am_aiter; unaryfunc am_anext; } __Pyx_PyAsyncMethodsStruct; #endif #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) #if !defined(_USE_MATH_DEFINES) #define _USE_MATH_DEFINES #endif #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_MARK_ERR_POS(f_index, lineno) \ { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #define __PYX_HAVE__libzim #define __PYX_HAVE_API__libzim /* Early includes */ #include #include #include #include "ios" #include "new" #include "stdexcept" #include "typeinfo" #include #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600) // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully #include namespace cython_std { template typename std::remove_reference::type&& move(T& t) noexcept { return std::move(t); } template typename std::remove_reference::type&& move(T&& t) noexcept { return std::move(t); } } #endif #include #include #include #include #include #include "zim/zim.h" #include "zim/writer/item.h" #include "zim/writer/contentProvider.h" #include "zim/writer/creator.h" #include "zim/search.h" #include "zim/search_iterator.h" #include "libwrapper.h" #include "zim/version.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) #define CYTHON_WITHOUT_ASSERTIONS #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_UTF8 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) #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))) ) static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { return (size_t) i < (size_t) limit; } #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) #define __Pyx_sst_abs(value) ((Py_ssize_t)_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 const char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE const 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_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const 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) 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); } #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) static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); #define __Pyx_PySequence_Tuple(obj)\ (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #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) + 1); 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 CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } static PyObject *__pyx_m = NULL; static PyObject *__pyx_d; static PyObject *__pyx_b; static PyObject *__pyx_cython_runtime = NULL; 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; static const char *__pyx_f[] = { "libzim/libzim.pyx", "stringsource", "type.pxd", }; /* ForceInitThreads.proto */ #ifndef __PYX_FORCE_INIT_THREADS #define __PYX_FORCE_INIT_THREADS 0 #endif /* NoFastGil.proto */ #define __Pyx_PyGILState_Ensure PyGILState_Ensure #define __Pyx_PyGILState_Release PyGILState_Release #define __Pyx_FastGIL_Remember() #define __Pyx_FastGIL_Forget() #define __Pyx_FastGilFuncInit() /*--- Type declarations ---*/ struct __pyx_obj_6libzim_WritingBlob; struct __pyx_obj_6libzim__Creator; struct __pyx_obj_6libzim_ReadingBlob; struct __pyx_obj_6libzim_Entry; struct __pyx_obj_6libzim_Item; struct __pyx_obj_6libzim_Archive; struct __pyx_obj_6libzim_Query; struct __pyx_obj_6libzim_SearchResultSet; struct __pyx_obj_6libzim_Search; struct __pyx_obj_6libzim_Searcher; struct __pyx_obj_6libzim_SuggestionResultSet; struct __pyx_obj_6libzim_SuggestionSearch; struct __pyx_obj_6libzim_SuggestionSearcher; struct __pyx_obj_6libzim___pyx_scope_struct__gen_blob; struct __pyx_obj_6libzim___pyx_scope_struct_1_gen_blob; struct __pyx_obj_6libzim___pyx_scope_struct_2___iter__; struct __pyx_obj_6libzim___pyx_scope_struct_3___iter__; /* "libzim.pyx":207 * writer_module_name = f"{__name__}.writer" * * cdef class WritingBlob: # <<<<<<<<<<<<<< * __module__ = writer_module_name * cdef zim.Blob c_blob */ struct __pyx_obj_6libzim_WritingBlob { PyObject_HEAD wrapper::Blob c_blob; PyObject *ref_content; }; /* "libzim.pyx":240 * * * cdef class _Creator: # <<<<<<<<<<<<<< * """ZIM Creator * */ struct __pyx_obj_6libzim__Creator { PyObject_HEAD zim::writer::Creator c_creator; PyObject *_filename; PyObject *_started; }; /* "libzim.pyx":607 * cdef Py_ssize_t itemsize = 1 * * cdef class ReadingBlob: # <<<<<<<<<<<<<< * __module__ = reader_module_name * cdef zim.Blob c_blob */ struct __pyx_obj_6libzim_ReadingBlob { PyObject_HEAD struct __pyx_vtabstruct_6libzim_ReadingBlob *__pyx_vtab; wrapper::Blob c_blob; Py_ssize_t size; int view_count; }; /* "libzim.pyx":657 * * * cdef class Entry: # <<<<<<<<<<<<<< * """Entry in a ZIM archive * */ struct __pyx_obj_6libzim_Entry { PyObject_HEAD struct __pyx_vtabstruct_6libzim_Entry *__pyx_vtab; wrapper::Entry c_entry; }; /* "libzim.pyx":714 * return f"{self.__class__.__name__}(url={self.path}, title={self.title})" * * cdef class Item: # <<<<<<<<<<<<<< * """Item in a ZIM archive * */ struct __pyx_obj_6libzim_Item { PyObject_HEAD struct __pyx_vtabstruct_6libzim_Item *__pyx_vtab; wrapper::Item c_item; struct __pyx_obj_6libzim_ReadingBlob *_blob; bool _haveBlob; }; /* "libzim.pyx":775 * * * cdef class Archive: # <<<<<<<<<<<<<< * """ZIM Archive Reader * */ struct __pyx_obj_6libzim_Archive { PyObject_HEAD wrapper::Archive c_archive; PyObject *_filename; }; /* "libzim.pyx":1037 * search_module_name = f"{__name__}.search" * * cdef class Query: # <<<<<<<<<<<<<< * """ZIM agnostic Query-builder to use with a Searcher""" * __module__ = search_module_name */ struct __pyx_obj_6libzim_Query { PyObject_HEAD zim::Query c_query; }; /* "libzim.pyx":1047 * * * cdef class SearchResultSet: # <<<<<<<<<<<<<< * """Iterator over a Search result: entry paths""" * __module__ = search_module_name */ struct __pyx_obj_6libzim_SearchResultSet { PyObject_HEAD struct __pyx_vtabstruct_6libzim_SearchResultSet *__pyx_vtab; wrapper::SearchResultSet c_resultset; }; /* "libzim.pyx":1066 * preincrement(current) * * cdef class Search: # <<<<<<<<<<<<<< * """Search request over a ZIM Archive""" * __module__ = search_module_name */ struct __pyx_obj_6libzim_Search { PyObject_HEAD struct __pyx_vtabstruct_6libzim_Search *__pyx_vtab; wrapper::Search c_search; }; /* "libzim.pyx":1097 * * * cdef class Searcher: # <<<<<<<<<<<<<< * """ZIM Archive Searcher * */ struct __pyx_obj_6libzim_Searcher { PyObject_HEAD wrapper::Searcher c_searcher; }; /* "libzim.pyx":1148 * suggestion_module_name = f"{__name__}.suggestion" * * cdef class SuggestionResultSet: # <<<<<<<<<<<<<< * """Iterator over a SuggestionSearch result: entry paths""" * __module__ = suggestion_module_name */ struct __pyx_obj_6libzim_SuggestionResultSet { PyObject_HEAD struct __pyx_vtabstruct_6libzim_SuggestionResultSet *__pyx_vtab; wrapper::SuggestionResultSet c_resultset; }; /* "libzim.pyx":1167 * preincrement(current) * * cdef class SuggestionSearch: # <<<<<<<<<<<<<< * __module__ = suggestion_module_name * cdef zim.SuggestionSearch c_search */ struct __pyx_obj_6libzim_SuggestionSearch { PyObject_HEAD struct __pyx_vtabstruct_6libzim_SuggestionSearch *__pyx_vtab; wrapper::SuggestionSearch c_search; }; /* "libzim.pyx":1197 * * * cdef class SuggestionSearcher: # <<<<<<<<<<<<<< * """ZIM Archive SuggestionSearcher * */ struct __pyx_obj_6libzim_SuggestionSearcher { PyObject_HEAD wrapper::SuggestionSearcher c_searcher; }; /* "libzim.pyx":456 * return len(self.content) * * def gen_blob(self) -> Generator[WritingBlob, None, None]: # <<<<<<<<<<<<<< * yield WritingBlob(self.content) * */ struct __pyx_obj_6libzim___pyx_scope_struct__gen_blob { PyObject_HEAD PyObject *__pyx_v_self; }; /* "libzim.pyx":471 * return self.size * * def gen_blob(self) -> Generator[WritingBlob, None, None]: # <<<<<<<<<<<<<< * bsize = 1048576 # 1MiB chunk * with open(self.filepath, "rb") as fh: */ struct __pyx_obj_6libzim___pyx_scope_struct_1_gen_blob { PyObject_HEAD long __pyx_v_bsize; PyObject *__pyx_v_fh; PyObject *__pyx_v_res; PyObject *__pyx_v_self; PyObject *__pyx_t_0; PyObject *__pyx_t_1; PyObject *__pyx_t_2; PyObject *__pyx_t_3; }; /* "libzim.pyx":1058 * return resultset * * def __iter__(self) -> Iterator[str]: # <<<<<<<<<<<<<< * """Entry paths found in Archive for Search""" * cdef zim.SearchIterator current = self.c_resultset.begin() */ struct __pyx_obj_6libzim___pyx_scope_struct_2___iter__ { PyObject_HEAD zim::SearchIterator __pyx_v_current; zim::SearchIterator __pyx_v_end; struct __pyx_obj_6libzim_SearchResultSet *__pyx_v_self; }; /* "libzim.pyx":1159 * return resultset * * def __iter__(self) -> Iterator[str]: # <<<<<<<<<<<<<< * """Entry paths found in Archive for SuggestionSearch""" * cdef zim.SuggestionIterator current = self.c_resultset.begin() */ struct __pyx_obj_6libzim___pyx_scope_struct_3___iter__ { PyObject_HEAD wrapper::SuggestionIterator __pyx_v_current; wrapper::SuggestionIterator __pyx_v_end; struct __pyx_obj_6libzim_SuggestionResultSet *__pyx_v_self; }; /* "libzim.pyx":607 * cdef Py_ssize_t itemsize = 1 * * cdef class ReadingBlob: # <<<<<<<<<<<<<< * __module__ = reader_module_name * cdef zim.Blob c_blob */ struct __pyx_vtabstruct_6libzim_ReadingBlob { PyObject *(*from_blob)(wrapper::Blob); }; static struct __pyx_vtabstruct_6libzim_ReadingBlob *__pyx_vtabptr_6libzim_ReadingBlob; /* "libzim.pyx":657 * * * cdef class Entry: # <<<<<<<<<<<<<< * """Entry in a ZIM archive * */ struct __pyx_vtabstruct_6libzim_Entry { PyObject *(*from_entry)(wrapper::Entry); }; static struct __pyx_vtabstruct_6libzim_Entry *__pyx_vtabptr_6libzim_Entry; /* "libzim.pyx":714 * return f"{self.__class__.__name__}(url={self.path}, title={self.title})" * * cdef class Item: # <<<<<<<<<<<<<< * """Item in a ZIM archive * */ struct __pyx_vtabstruct_6libzim_Item { PyObject *(*from_item)(wrapper::Item); }; static struct __pyx_vtabstruct_6libzim_Item *__pyx_vtabptr_6libzim_Item; /* "libzim.pyx":1047 * * * cdef class SearchResultSet: # <<<<<<<<<<<<<< * """Iterator over a Search result: entry paths""" * __module__ = search_module_name */ struct __pyx_vtabstruct_6libzim_SearchResultSet { PyObject *(*from_resultset)(wrapper::SearchResultSet); }; static struct __pyx_vtabstruct_6libzim_SearchResultSet *__pyx_vtabptr_6libzim_SearchResultSet; /* "libzim.pyx":1066 * preincrement(current) * * cdef class Search: # <<<<<<<<<<<<<< * """Search request over a ZIM Archive""" * __module__ = search_module_name */ struct __pyx_vtabstruct_6libzim_Search { PyObject *(*from_search)(wrapper::Search); }; static struct __pyx_vtabstruct_6libzim_Search *__pyx_vtabptr_6libzim_Search; /* "libzim.pyx":1148 * suggestion_module_name = f"{__name__}.suggestion" * * cdef class SuggestionResultSet: # <<<<<<<<<<<<<< * """Iterator over a SuggestionSearch result: entry paths""" * __module__ = suggestion_module_name */ struct __pyx_vtabstruct_6libzim_SuggestionResultSet { PyObject *(*from_resultset)(wrapper::SuggestionResultSet); }; static struct __pyx_vtabstruct_6libzim_SuggestionResultSet *__pyx_vtabptr_6libzim_SuggestionResultSet; /* "libzim.pyx":1167 * preincrement(current) * * cdef class SuggestionSearch: # <<<<<<<<<<<<<< * __module__ = suggestion_module_name * cdef zim.SuggestionSearch c_search */ struct __pyx_vtabstruct_6libzim_SuggestionSearch { PyObject *(*from_search)(wrapper::SuggestionSearch); }; static struct __pyx_vtabstruct_6libzim_SuggestionSearch *__pyx_vtabptr_6libzim_SuggestionSearch; /* --- 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); #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *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); /* 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); /* PyDictVersioning.proto */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ (version_var) = __PYX_GET_DICT_VERSION(dict);\ (cache_var) = (value); #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ (VAR) = __pyx_dict_cached_value;\ } else {\ (VAR) = __pyx_dict_cached_value = (LOOKUP);\ __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ }\ } static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); #else #define __PYX_GET_DICT_VERSION(dict) (0) #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); #endif /* GetModuleGlobalName.proto */ #if CYTHON_USE_DICT_VERSIONS #define __Pyx_GetModuleGlobalName(var, name) do {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ } while(0) #define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ PY_UINT64_T __pyx_dict_version;\ PyObject *__pyx_dict_cached_value;\ (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ } while(0) static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); #else #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif /* 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, Py_ssize_t nargs, PyObject *kwargs); #else #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif #define __Pyx_BUILD_ASSERT_EXPR(cond)\ (sizeof(char [1 - 2*!(cond)]) - 1) #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif #if CYTHON_FAST_PYCALL static size_t __pyx_pyframe_localsplus_offset = 0; #include "frameobject.h" #if PY_VERSION_HEX >= 0x030b00a6 #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif #define __Pxy_PyFrame_Initialize_Offsets()\ ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) #endif // CYTHON_FAST_PYCALL #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 /* 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 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); /* 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); __Pyx_SET_SIZE(list, len + 1); return 0; } return PyList_Append(list, x); } #else #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) #endif /* 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); #else #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) #endif /* GetAttr.proto */ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); /* IncludeCppStringH.proto */ #include /* decode_c_string_utf16.proto */ static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { int byteorder = 0; return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); } static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { int byteorder = -1; return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); } static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { int byteorder = 1; return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); } /* 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); } /* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #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 /* PyObjectCallOneArg.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); /* HasAttr.proto */ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); /* PyThreadStateGet.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign #define __Pyx_PyErr_Occurred() PyErr_Occurred() #endif /* PyErrFetchRestore.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) #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); #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) #else #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) #endif #else #define __Pyx_PyErr_Clear() PyErr_Clear() #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchInState(tstate, 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); /* PyObjectCall2Args.proto */ static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); /* GetTopmostException.proto */ #if CYTHON_USE_EXC_INFO_STACK static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); #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 /* 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 /* 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 /* 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 /* ExtTypeTest.proto */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /* IterFinish.proto */ static CYTHON_INLINE int __Pyx_IterFinish(void); /* PyObjectGetMethod.proto */ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); /* PyObjectCallMethod0.proto */ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); /* RaiseNeedMoreValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); /* RaiseTooManyValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); /* UnpackItemEndCheck.proto */ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /* RaiseNoneIterError.proto */ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); /* UnpackTupleError.proto */ static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /* UnpackTuple2.proto */ #define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\ (likely(is_tuple || PyTuple_Check(tuple)) ?\ (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\ __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\ (__Pyx_UnpackTupleError(tuple, 2), -1)) :\ __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple)) static CYTHON_INLINE int __Pyx_unpack_tuple2_exact( PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple); static int __Pyx_unpack_tuple2_generic( PyObject* tuple, PyObject** value1, PyObject** value2, 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); /* 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)); } /* PyObjectFormatSimple.proto */ #if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyObject_FormatSimple(s, f) (\ likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ PyObject_Format(s, f)) #elif PY_MAJOR_VERSION < 3 #define __Pyx_PyObject_FormatSimple(s, f) (\ likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\ PyObject_Format(s, f)) #elif CYTHON_USE_TYPE_SLOTS #define __Pyx_PyObject_FormatSimple(s, f) (\ likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_str(s) :\ likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_str(s) :\ PyObject_Format(s, f)) #else #define __Pyx_PyObject_FormatSimple(s, f) (\ likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ PyObject_Format(s, f)) #endif /* ArgTypeTest.proto */ #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ __Pyx__ArgTypeTest(obj, type, name, exact)) static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); /* IterNext.proto */ #define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL) static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *); /* PyObjectLookupSpecial.proto */ #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) { PyObject *res; PyTypeObject *tp = Py_TYPE(obj); #if PY_MAJOR_VERSION < 3 if (unlikely(PyInstance_Check(obj))) return __Pyx_PyObject_GetAttrStr(obj, attr_name); #endif res = _PyType_Lookup(tp, attr_name); if (likely(res)) { descrgetfunc f = Py_TYPE(res)->tp_descr_get; if (!f) { Py_INCREF(res); } else { res = f(res, obj, (PyObject *)tp); } } else { PyErr_SetObject(PyExc_AttributeError, attr_name); } return res; } #else #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) #endif /* IncludeStringH.proto */ #include /* JoinPyUnicode.proto */ static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, Py_UCS4 max_char); /* 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); /* 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); __Pyx_SET_SIZE(list, len + 1); return 0; } return PyList_Append(list, x); } #else #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) #endif /* PyUnicode_Unicode.proto */ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj); /* DictGetItem.proto */ #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); #define __Pyx_PyObject_Dict_GetItem(obj, name)\ (likely(PyDict_CheckExact(obj)) ?\ __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) #else #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) #endif /* dict_getitem_default.proto */ static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value); /* UnpackUnboundCMethod.proto */ typedef struct { PyObject *type; PyObject **method_name; PyCFunction func; PyObject *method; int flag; } __Pyx_CachedCFunction; /* CallUnboundCMethod1.proto */ static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); #else #define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg) #endif /* CallUnboundCMethod2.proto */ static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1 static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2); #else #define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) #endif /* PyObject_GenericGetAttrNoDict.proto */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); #else #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr #endif /* PyObject_GenericGetAttr.proto */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name); #else #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr #endif /* PyObjectGetAttrStrNoError.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); /* SetupReduce.proto */ static int __Pyx_setup_reduce(PyObject* type_obj); /* SetVTable.proto */ static int __Pyx_SetVtable(PyObject *dict, void *vtable); /* TypeImport.proto */ #ifndef __PYX_HAVE_RT_ImportType_proto #define __PYX_HAVE_RT_ImportType_proto #if __STDC_VERSION__ >= 201112L #include #endif #if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L #define __PYX_GET_STRUCT_ALIGNMENT(s) alignof(s) #else #define __PYX_GET_STRUCT_ALIGNMENT(s) sizeof(void*) #endif enum __Pyx_ImportType_CheckSize { __Pyx_ImportType_CheckSize_Error = 0, __Pyx_ImportType_CheckSize_Warn = 1, __Pyx_ImportType_CheckSize_Ignore = 2 }; static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize check_size); #endif /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /* CalculateMetaclass.proto */ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); /* SetNameInClass.proto */ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 #define __Pyx_SetNameInClass(ns, name, value)\ (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value)) #elif CYTHON_COMPILING_IN_CPYTHON #define __Pyx_SetNameInClass(ns, name, value)\ (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value)) #else #define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value) #endif /* 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); /* FetchCommonType.proto */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); /* CythonFunctionShared.proto */ #define __Pyx_CyFunction_USED 1 #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; size_t defaults_size; // used by FusedFunction for copying defaults 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_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType)) static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, 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); /* CythonFunction.proto */ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject *globals, PyObject* code); /* ObjectGetItem.proto */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key); #else #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) #endif /* CyFunctionClassCell.proto */ static int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, PyObject *classobj); /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) #else static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #endif /* 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); /* None.proto */ #include /* GCCDiagnostics.proto */ #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) #define __Pyx_HAS_GCC_DIAGNOSTIC #endif /* CppExceptionConversion.proto */ #ifndef __Pyx_CppExn2PyErr #include #include #include #include static void __Pyx_CppExn2PyErr() { try { if (PyErr_Occurred()) ; // let the latest Python exn pass through and ignore the current one else throw; } catch (const std::bad_alloc& exn) { PyErr_SetString(PyExc_MemoryError, exn.what()); } catch (const std::bad_cast& exn) { PyErr_SetString(PyExc_TypeError, exn.what()); } catch (const std::bad_typeid& exn) { PyErr_SetString(PyExc_TypeError, exn.what()); } catch (const std::domain_error& exn) { PyErr_SetString(PyExc_ValueError, exn.what()); } catch (const std::invalid_argument& exn) { PyErr_SetString(PyExc_ValueError, exn.what()); } catch (const std::ios_base::failure& exn) { PyErr_SetString(PyExc_IOError, exn.what()); } catch (const std::out_of_range& exn) { PyErr_SetString(PyExc_IndexError, exn.what()); } catch (const std::overflow_error& exn) { PyErr_SetString(PyExc_OverflowError, exn.what()); } catch (const std::range_error& exn) { PyErr_SetString(PyExc_ArithmeticError, exn.what()); } catch (const std::underflow_error& exn) { PyErr_SetString(PyExc_ArithmeticError, exn.what()); } catch (const std::exception& exn) { PyErr_SetString(PyExc_RuntimeError, exn.what()); } catch (...) { PyErr_SetString(PyExc_RuntimeError, "Unknown exception"); } } #endif /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_zim_3a__3a_writer_3a__3a_HintKeys(zim::writer::HintKeys 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 uint64_t __Pyx_PyInt_As_uint64_t(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE zim::writer::HintKeys __Pyx_PyInt_As_zim_3a__3a_writer_3a__3a_HintKeys(PyObject *); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value); /* CIntFromPy.proto */ static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); /* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) #endif #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) /* PyObjectCallMethod1.proto */ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); /* CoroutineBase.proto */ typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *); #if CYTHON_USE_EXC_INFO_STACK #define __Pyx_ExcInfoStruct _PyErr_StackItem #else typedef struct { PyObject *exc_type; PyObject *exc_value; PyObject *exc_traceback; } __Pyx_ExcInfoStruct; #endif typedef struct { PyObject_HEAD __pyx_coroutine_body_t body; PyObject *closure; __Pyx_ExcInfoStruct gi_exc_state; PyObject *gi_weakreflist; PyObject *classobj; PyObject *yieldfrom; PyObject *gi_name; PyObject *gi_qualname; PyObject *gi_modulename; PyObject *gi_code; PyObject *gi_frame; int resume_label; char is_running; } __pyx_CoroutineObject; static __pyx_CoroutineObject *__Pyx__Coroutine_New( PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, PyObject *name, PyObject *qualname, PyObject *module_name); static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, PyObject *name, PyObject *qualname, PyObject *module_name); static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self); static int __Pyx_Coroutine_clear(PyObject *self); 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); #if CYTHON_USE_EXC_INFO_STACK #define __Pyx_Coroutine_SwapException(self) #define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state) #else #define __Pyx_Coroutine_SwapException(self) {\ __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\ __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\ } #define __Pyx_Coroutine_ResetAndClearException(self) {\ __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\ (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\ } #endif #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue) #else #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue) #endif static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue); static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state); /* 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, code, closure, name, qualname, module_name)\ __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, 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); /* FunctionExport.proto */ static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); static PyObject *__pyx_f_6libzim_11ReadingBlob_from_blob(wrapper::Blob __pyx_v_blob); /* proto*/ static PyObject *__pyx_f_6libzim_5Entry_from_entry(wrapper::Entry __pyx_v_ent); /* proto*/ static PyObject *__pyx_f_6libzim_4Item_from_item(wrapper::Item __pyx_v__item); /* proto*/ static PyObject *__pyx_f_6libzim_15SearchResultSet_from_resultset(wrapper::SearchResultSet __pyx_v__resultset); /* proto*/ static PyObject *__pyx_f_6libzim_6Search_from_search(wrapper::Search __pyx_v__search); /* proto*/ static PyObject *__pyx_f_6libzim_19SuggestionResultSet_from_resultset(wrapper::SuggestionResultSet __pyx_v__resultset); /* proto*/ static PyObject *__pyx_f_6libzim_16SuggestionSearch_from_search(wrapper::SuggestionSearch __pyx_v__search); /* proto*/ /* 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.stdint' */ /* Module declarations from 'libcpp' */ /* Module declarations from 'libcpp.utility' */ /* Module declarations from 'libcpp.map' */ /* Module declarations from 'libcpp.memory' */ /* Module declarations from 'libcpp.pair' */ /* Module declarations from 'libcpp.set' */ /* Module declarations from 'libcpp.string' */ /* Module declarations from 'libcpp.vector' */ /* Module declarations from 'zim' */ /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'libzim' */ static PyTypeObject *__pyx_ptype_6libzim_WritingBlob = 0; static PyTypeObject *__pyx_ptype_6libzim__Creator = 0; static PyTypeObject *__pyx_ptype_6libzim_ReadingBlob = 0; static PyTypeObject *__pyx_ptype_6libzim_Entry = 0; static PyTypeObject *__pyx_ptype_6libzim_Item = 0; static PyTypeObject *__pyx_ptype_6libzim_Archive = 0; static PyTypeObject *__pyx_ptype_6libzim_Query = 0; static PyTypeObject *__pyx_ptype_6libzim_SearchResultSet = 0; static PyTypeObject *__pyx_ptype_6libzim_Search = 0; static PyTypeObject *__pyx_ptype_6libzim_Searcher = 0; static PyTypeObject *__pyx_ptype_6libzim_SuggestionResultSet = 0; static PyTypeObject *__pyx_ptype_6libzim_SuggestionSearch = 0; static PyTypeObject *__pyx_ptype_6libzim_SuggestionSearcher = 0; static PyTypeObject *__pyx_ptype_6libzim___pyx_scope_struct__gen_blob = 0; static PyTypeObject *__pyx_ptype_6libzim___pyx_scope_struct_1_gen_blob = 0; static PyTypeObject *__pyx_ptype_6libzim___pyx_scope_struct_2___iter__ = 0; static PyTypeObject *__pyx_ptype_6libzim___pyx_scope_struct_3___iter__ = 0; static Py_ssize_t __pyx_v_6libzim_itemsize; static PyObject *__pyx_f_6libzim_call_method(PyObject *, std::string); /*proto*/ __PYX_EXTERN_C bool obj_has_attribute(PyObject *, std::string); /*proto*/ __PYX_EXTERN_C std::string string_cy_call_fct(PyObject *, std::string, std::string *); /*proto*/ __PYX_EXTERN_C wrapper::Blob blob_cy_call_fct(PyObject *, std::string, std::string *); /*proto*/ __PYX_EXTERN_C zim::writer::ContentProvider *contentprovider_cy_call_fct(PyObject *, std::string, std::string *); /*proto*/ __PYX_EXTERN_C zim::writer::IndexData *indexdata_cy_call_fct(PyObject *, std::string, std::string *); /*proto*/ __PYX_EXTERN_C bool bool_cy_call_fct(PyObject *, std::string, std::string *); /*proto*/ __PYX_EXTERN_C uint64_t uint64_cy_call_fct(PyObject *, std::string, std::string *); /*proto*/ __PYX_EXTERN_C uint32_t uint32_cy_call_fct(PyObject *, std::string, std::string *); /*proto*/ __PYX_EXTERN_C zim::writer::IndexData::GeoPosition geoposition_cy_call_fct(PyObject *, std::string, std::string *); /*proto*/ __PYX_EXTERN_C std::map convertToCppHints(PyObject *); /*proto*/ __PYX_EXTERN_C std::map hints_cy_call_fct(PyObject *, std::string, std::string *); /*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*/ static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*proto*/ static PyObject *__pyx_convert_set_to_py_unsigned_int(std::set const &); /*proto*/ static PyObject *__pyx_convert_pair_to_py_std_3a__3a_string____std_3a__3a_string(std::pair const &); /*proto*/ #define __Pyx_MODULE_NAME "libzim" extern int __pyx_module_is_main_libzim; int __pyx_module_is_main_libzim = 0; /* Implementation of 'libzim' */ static PyObject *__pyx_builtin_staticmethod; static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_IOError; static PyObject *__pyx_builtin_NotImplementedError; static PyObject *__pyx_builtin_StopIteration; static PyObject *__pyx_builtin_super; static PyObject *__pyx_builtin_open; static PyObject *__pyx_builtin_BufferError; static PyObject *__pyx_builtin_KeyError; static PyObject *__pyx_builtin_print; static const char __pyx_k_[] = ""; static const char __pyx_k_fh[] = "fh"; static const char __pyx_k_os[] = "os"; static const char __pyx_k_rb[] = "rb"; static const char __pyx_k_Set[] = "Set"; static const char __pyx_k__24[] = ")"; static const char __pyx_k__50[] = "+ "; static const char __pyx_k__51[] = " "; static const char __pyx_k_abc[] = "abc"; static const char __pyx_k_all[] = "__all__"; static const char __pyx_k_doc[] = "doc"; static const char __pyx_k_get[] = "get"; static const char __pyx_k_hex[] = "hex"; static const char __pyx_k_int[] = "int"; static const char __pyx_k_mro[] = "mro"; static const char __pyx_k_obj[] = "obj"; static const char __pyx_k_out[] = "out"; static const char __pyx_k_res[] = "res"; static const char __pyx_k_sys[] = "sys"; static const char __pyx_k_url[] = "(url="; static const char __pyx_k_Blob[] = "Blob"; static const char __pyx_k_Date[] = "Date"; static const char __pyx_k_Dict[] = "Dict"; static const char __pyx_k_Enum[] = "Enum"; static const char __pyx_k_Hint[] = "Hint"; static const char __pyx_k_Item[] = "Item"; static const char __pyx_k_List[] = "List"; static const char __pyx_k_None[] = "None"; static const char __pyx_k_Path[] = "Path"; static const char __pyx_k_UUID[] = "UUID"; static const char __pyx_k_W_OK[] = "W_OK"; static const char __pyx_k_args[] = "args"; static const char __pyx_k_blob[] = "_blob"; static const char __pyx_k_bool[] = "bool"; static const char __pyx_k_date[] = "date"; static const char __pyx_k_enum[] = "enum"; static const char __pyx_k_exit[] = "__exit__"; static const char __pyx_k_feed[] = "feed"; static const char __pyx_k_file[] = "file"; static const char __pyx_k_init[] = "__init__"; static const char __pyx_k_iter[] = "__iter__"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_mode[] = "mode"; static const char __pyx_k_name[] = "name"; 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_repr[] = "__repr__"; 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_spec[] = "spec"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_uuid[] = "uuid"; static const char __pyx_k_zstd[] = "zstd"; static const char __pyx_k_Entry[] = "Entry"; static const char __pyx_k_Query[] = "Query"; static const char __pyx_k_Tuple[] = "Tuple"; static const char __pyx_k_UTF_8[] = "UTF-8"; static const char __pyx_k_Union[] = "Union"; static const char __pyx_k_Y_m_d[] = "%Y-%m-%d"; static const char __pyx_k_all_2[] = "_all"; static const char __pyx_k_bsize[] = "bsize"; static const char __pyx_k_class[] = "__class__"; static const char __pyx_k_close[] = "close"; static const char __pyx_k_count[] = "count"; static const char __pyx_k_doc_2[] = "__doc__"; static const char __pyx_k_enter[] = "__enter__"; static const char __pyx_k_hints[] = "hints"; static const char __pyx_k_items[] = "items"; static const char __pyx_k_lower[] = "lower"; static const char __pyx_k_print[] = "print"; static const char __pyx_k_pyint[] = "pyint"; static const char __pyx_k_start[] = "start"; static const char __pyx_k_super[] = "super"; static const char __pyx_k_throw[] = "throw"; static const char __pyx_k_title[] = "title"; static const char __pyx_k_types[] = "types"; static const char __pyx_k_value[] = "value"; static const char __pyx_k_Loader[] = "Loader"; static const char __pyx_k_Search[] = "Search"; static const char __pyx_k_access[] = "access"; static const char __pyx_k_decode[] = "decode"; static const char __pyx_k_encode[] = "encode"; static const char __pyx_k_exc_tb[] = "exc_tb"; static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_insert[] = "insert"; static const char __pyx_k_libzim[] = "libzim"; static const char __pyx_k_module[] = "module"; static const char __pyx_k_name_2[] = "__name__"; static const char __pyx_k_parent[] = "parent"; static const char __pyx_k_path_2[] = "(path="; static const char __pyx_k_path_3[] = "__path__"; static const char __pyx_k_prefix[] = "prefix"; static const char __pyx_k_pybool[] = "pybool"; static const char __pyx_k_reader[] = "reader"; static const char __pyx_k_reduce[] = "__reduce__"; static const char __pyx_k_return[] = "return"; static const char __pyx_k_search[] = "search"; static const char __pyx_k_stdout[] = "stdout"; static const char __pyx_k_target[] = "target"; static const char __pyx_k_typing[] = "typing"; static const char __pyx_k_writer[] = "writer"; static const char __pyx_k_Archive[] = "Archive"; static const char __pyx_k_Creator[] = "_Creator"; static const char __pyx_k_IOError[] = "IOError"; static const char __pyx_k_archive[] = "archive"; static const char __pyx_k_content[] = "content"; static const char __pyx_k_exc_val[] = "exc_val"; static const char __pyx_k_getsize[] = "getsize"; static const char __pyx_k_library[] = "library"; static const char __pyx_k_members[] = "members"; static const char __pyx_k_modules[] = "modules"; static const char __pyx_k_pathlib[] = "pathlib"; static const char __pyx_k_prepare[] = "__prepare__"; static const char __pyx_k_resolve[] = "resolve"; static const char __pyx_k_title_2[] = ", title="; static const char __pyx_k_unicode[] = "unicode"; static const char __pyx_k_version[] = "version"; static const char __pyx_k_COMPRESS[] = "COMPRESS"; static const char __pyx_k_Iterator[] = "Iterator"; static const char __pyx_k_KeyError[] = "KeyError"; static const char __pyx_k_Optional[] = "Optional"; static const char __pyx_k_Searcher[] = "Searcher"; static const char __pyx_k_datetime[] = "datetime"; static const char __pyx_k_exc_type[] = "exc_type"; static const char __pyx_k_filename[] = "filename"; static const char __pyx_k_filepath[] = "filepath"; static const char __pyx_k_fullname[] = "fullname"; static const char __pyx_k_gen_blob[] = "gen_blob"; static const char __pyx_k_get_path[] = "get_path"; static const char __pyx_k_get_size[] = "get_size"; static const char __pyx_k_getstate[] = "__getstate__"; static const char __pyx_k_indexing[] = "indexing"; static const char __pyx_k_language[] = "language"; static const char __pyx_k_libzim_2[] = "libzim."; static const char __pyx_k_mimetype[] = "mimetype"; static const char __pyx_k_module_2[] = "__module__"; static const char __pyx_k_qualname[] = "__qualname__"; static const char __pyx_k_reader_2[] = ".reader"; static const char __pyx_k_search_2[] = ".search"; static const char __pyx_k_setstate[] = "__setstate__"; static const char __pyx_k_strftime[] = "strftime"; static const char __pyx_k_versions[] = "versions"; static const char __pyx_k_writer_2[] = ".writer"; static const char __pyx_k_Creator_2[] = "Creator"; static const char __pyx_k_Generator[] = "Generator"; static const char __pyx_k_IndexData[] = "IndexData"; static const char __pyx_k_TypeError[] = "TypeError"; static const char __pyx_k_find_spec[] = "find_spec"; static const char __pyx_k_generator[] = "generator"; static const char __pyx_k_get_hints[] = "get_hints"; static const char __pyx_k_get_title[] = "get_title"; static const char __pyx_k_importlib[] = "importlib"; static const char __pyx_k_machinery[] = "machinery"; static const char __pyx_k_meta_path[] = "meta_path"; static const char __pyx_k_metaclass[] = "__metaclass__"; static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; static const char __pyx_k_traceback[] = "traceback"; static const char __pyx_k_version_2[] = ".version"; static const char __pyx_k_ModuleSpec[] = "ModuleSpec"; static const char __pyx_k_ModuleType[] = "ModuleType"; static const char __pyx_k_expanduser[] = "expanduser"; static const char __pyx_k_filename_2[] = "(filename="; static const char __pyx_k_format_exc[] = "format_exc"; static const char __pyx_k_memoryview[] = "memoryview"; static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; static const char __pyx_k_startswith[] = "startswith"; static const char __pyx_k_suggestion[] = "suggestion"; static const char __pyx_k_targetPath[] = "targetPath"; static const char __pyx_k_BufferError[] = "BufferError"; static const char __pyx_k_Compression[] = "Compression"; static const char __pyx_k_OrderedDict[] = "OrderedDict"; static const char __pyx_k_ReadingBlob[] = "ReadingBlob"; static const char __pyx_k_WritingBlob[] = "WritingBlob"; static const char __pyx_k_collections[] = "collections"; static const char __pyx_k_compression[] = "compression"; static const char __pyx_k_exec_module[] = "exec_module"; static const char __pyx_k_get_content[] = "get_content"; static const char __pyx_k_Blob_is_none[] = "Blob is none"; static const char __pyx_k_FileProvider[] = "FileProvider"; static const char __pyx_k_ModuleFinder[] = "ModuleFinder"; static const char __pyx_k_ModuleLoader[] = "ModuleLoader"; static const char __pyx_k_RuntimeError[] = "RuntimeError"; static const char __pyx_k_add_metadata[] = "add_metadata"; static const char __pyx_k_get_keywords[] = "get_keywords"; static const char __pyx_k_get_mimetype[] = "get_mimetype"; static const char __pyx_k_get_versions[] = "get_versions"; static const char __pyx_k_staticmethod[] = "staticmethod"; static const char __pyx_k_suggestion_2[] = ".suggestion"; static const char __pyx_k_FRONT_ARTICLE[] = "FRONT_ARTICLE"; static const char __pyx_k_StopIteration[] = "StopIteration"; static const char __pyx_k_create_module[] = "create_module"; static const char __pyx_k_effective_ids[] = "effective_ids"; static const char __pyx_k_get_wordcount[] = "get_wordcount"; static const char __pyx_k_has_indexdata[] = "has_indexdata"; static const char __pyx_k_importlib_abc[] = "importlib.abc"; static const char __pyx_k_libzim_reader[] = "libzim.reader"; static const char __pyx_k_libzim_search[] = "libzim.search"; static const char __pyx_k_libzim_writer[] = "libzim.writer"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; static const char __pyx_k_Blob_has_views[] = "Blob has views"; static const char __pyx_k_Creator___repr[] = "Creator.__repr__"; static const char __pyx_k_MetaPathFinder[] = "MetaPathFinder"; static const char __pyx_k_StringProvider[] = "StringProvider"; static const char __pyx_k_libzim_version[] = "libzim.version"; static const char __pyx_k_print_versions[] = "print_versions"; static const char __pyx_k_BaseWritingItem[] = "BaseWritingItem"; static const char __pyx_k_ContentProvider[] = "ContentProvider"; static const char __pyx_k_Creator_started[] = "Creator started"; static const char __pyx_k_SearchResultSet[] = "SearchResultSet"; static const char __pyx_k_get_geoposition[] = "get_geoposition"; static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; static const char __pyx_k_Creator_filename[] = "Creator(filename="; static const char __pyx_k_SuggestionSearch[] = "SuggestionSearch"; static const char __pyx_k_libzim_libzim_pyx[] = "libzim/libzim.pyx"; static const char __pyx_k_libzim_suggestion[] = "libzim.suggestion"; static const char __pyx_k_reader_module_doc[] = "reader_module_doc"; static const char __pyx_k_search_module_doc[] = "search_module_doc"; static const char __pyx_k_writer_module_doc[] = "writer_module_doc"; static const char __pyx_k_SuggestionSearcher[] = "SuggestionSearcher"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_config_compression[] = "config_compression"; static const char __pyx_k_get_libzim_version[] = "get_libzim_version"; static const char __pyx_k_reader_module_name[] = "reader_module_name"; static const char __pyx_k_search_module_name[] = "search_module_name"; static const char __pyx_k_version_module_doc[] = "version_module_doc"; static const char __pyx_k_writer_module_name[] = "writer_module_name"; static const char __pyx_k_Creator_not_started[] = "Creator not started"; static const char __pyx_k_FileProvider___init[] = "FileProvider.__init__"; static const char __pyx_k_IndexData_get_title[] = "IndexData.get_title"; static const char __pyx_k_NotImplementedError[] = "NotImplementedError"; static const char __pyx_k_SuggestionResultSet[] = "SuggestionResultSet"; static const char __pyx_k_get_contentprovider[] = "get_contentprovider"; static const char __pyx_k_version_module_name[] = "version_module_name"; static const char __pyx_k_ContentProvider_feed[] = "ContentProvider.feed"; static const char __pyx_k_Creator_add_metadata[] = "Creator.add_metadata"; static const char __pyx_k_FileProvider_gen_blob[] = "FileProvider.gen_blob"; static const char __pyx_k_FileProvider_get_size[] = "FileProvider.get_size"; static const char __pyx_k_IndexData_get_content[] = "IndexData.get_content"; static const char __pyx_k_StringProvider___init[] = "StringProvider.__init__"; static const char __pyx_k_reader_public_objects[] = "reader_public_objects"; static const char __pyx_k_search_public_objects[] = "search_public_objects"; static const char __pyx_k_suggestion_module_doc[] = "suggestion_module_doc"; static const char __pyx_k_writer_public_objects[] = "writer_public_objects"; static const char __pyx_k_BaseWritingItem___init[] = "BaseWritingItem.__init__"; static const char __pyx_k_BaseWritingItem___repr[] = "BaseWritingItem.__repr__"; static const char __pyx_k_ContentProvider___init[] = "ContentProvider.__init__"; static const char __pyx_k_IndexData_get_keywords[] = "IndexData.get_keywords"; static const char __pyx_k_ModuleFinder_find_spec[] = "ModuleFinder.find_spec"; static const char __pyx_k_SearchResultSet___iter[] = "SearchResultSet.__iter__"; static const char __pyx_k_suggestion_module_name[] = "suggestion_module_name"; static const char __pyx_k_supports_effective_ids[] = "supports_effective_ids"; static const char __pyx_k_version_public_objects[] = "version_public_objects"; static const char __pyx_k_ContentProvider_is_None[] = "ContentProvider is None"; static const char __pyx_k_IndexData_get_wordcount[] = "IndexData.get_wordcount"; static const char __pyx_k_IndexData_has_indexdata[] = "IndexData.has_indexdata"; static const char __pyx_k_StringProvider_gen_blob[] = "StringProvider.gen_blob"; static const char __pyx_k_StringProvider_get_size[] = "StringProvider.get_size"; static const char __pyx_k_BaseWritingItem_get_path[] = "BaseWritingItem.get_path"; static const char __pyx_k_ContentProvider_gen_blob[] = "ContentProvider.gen_blob"; static const char __pyx_k_ContentProvider_get_size[] = "ContentProvider.get_size"; static const char __pyx_k_ModuleLoader_exec_module[] = "ModuleLoader.exec_module"; static const char __pyx_k_text_plain_charset_UTF_8[] = "text/plain;charset=UTF-8"; static const char __pyx_k_BaseWritingItem_get_hints[] = "BaseWritingItem.get_hints"; static const char __pyx_k_BaseWritingItem_get_title[] = "BaseWritingItem.get_title"; static const char __pyx_k_IndexData_get_geoposition[] = "IndexData.get_geoposition"; static const char __pyx_k_suggestion_public_objects[] = "suggestion_public_objects"; static const char __pyx_k_Creator_config_compression[] = "Creator.config_compression"; static const char __pyx_k_ModuleLoader_create_module[] = "ModuleLoader.create_module"; static const char __pyx_k_SuggestionResultSet___iter[] = "SuggestionResultSet.__iter__"; static const char __pyx_k_Unable_to_write_ZIM_file_at[] = "Unable to write ZIM file at "; static const char __pyx_k_BaseWritingItem_get_mimetype[] = "BaseWritingItem.get_mimetype"; static const char __pyx_k_get_path_must_be_implemented[] = "get_path must be implemented."; static const char __pyx_k_get_size_must_be_implemented[] = "get_size must be implemented."; static const char __pyx_k_get_hints_must_be_implemented[] = "get_hints must be implemented."; static const char __pyx_k_get_title_must_be_implemented[] = "get_title must be implemented."; static const char __pyx_k_IndexData_stub_to_override_Retu[] = " IndexData stub to override\n\n Return a subclass of it in Item.get_indexdata()"; static const char __pyx_k_get_content_must_be_implemented[] = "get_content must be implemented."; static const char __pyx_k_libzim_reader_module_Archive_to[] = "libzim reader module\n\n- Archive to open and read ZIM files (gives access to all `Entry`)\n- Entry knows about redirections, exposes path and title and gives access to `Item`\n- Item holds the content and metadata\n\nUsage:\n\nwith Archive(fpath) as zim:\n entry = zim.get_entry_by_path(zim.main_entry.path)\n print(f\"Article {entry.title} at {entry.path} is \"\n f\"{entry.get_item().content.nbytes}b\")"; static const char __pyx_k_libzim_writer_module_Creator_to[] = "libzim writer module\n- Creator to create ZIM files\n- Item to store ZIM articles metadata\n- ContentProvider to store an Item's content\n- Blob to store actual content\n- StringProvider to store an Item's content from a string\n- FileProvider to store an Item's content from a file path\n- Compression to select the algorithm to compress ZIM archive with\n\nUsage:\nwith Creator(pathlib.Path(\"myfile.zim\")) as creator:\n creator.config_verbose(False)\n creator.add_metadata(\"Name\", b\"my name\")\n # example\n creator.add_item(MyItemSubclass(path, title, mimetype, content)\n creator.set_mainpath(path)"; static const char __pyx_k_self_c_blob_cannot_be_converted[] = "self.c_blob cannot be converted to a Python object for pickling"; static const char __pyx_k_self_c_item_cannot_be_converted[] = "self.c_item cannot be converted to a Python object for pickling"; static const char __pyx_k_BaseWritingItem_get_contentprovi[] = "BaseWritingItem.get_contentprovider"; static const char __pyx_k_Cannot_create_writable_memoryvie[] = "Cannot create writable memoryview on readonly data"; static const char __pyx_k_Compression_algorithms_available[] = "Compression algorithms available to create ZIM files"; static const char __pyx_k_ContentProvider_for_a_file_using[] = "ContentProvider for a file using its local path"; static const char __pyx_k_ContentProvider_for_a_single_enc[] = "ContentProvider for a single encoded-or-not UTF-8 string"; static const char __pyx_k_Item_stub_to_override_Pass_a_sub[] = "Item stub to override\n\n Pass a subclass of it to Creator.add_item()"; static const char __pyx_k_gen_blob_ro_feed_must_be_impleme[] = "gen_blob (ro feed) must be implemented"; static const char __pyx_k_get_contentprovider_must_be_impl[] = "get_contentprovider must be implemented."; static const char __pyx_k_get_keywords_must_be_implemented[] = "get_keywords must be implemented."; static const char __pyx_k_get_mimetype_must_be_implemented[] = "get_mimetype must be implemented."; static const char __pyx_k_get_wordcount_must_be_implemente[] = "get_wordcount must be implemented."; static const char __pyx_k_libzim_search_module_Query_to_pr[] = "libzim search module\n\n- Query to prepare a query from a string\n- Searcher to perform a search over a libzim.reader.Archive\n\nUsage:\n\narchive = libzim.reader.Archive(fpath)\nsearcher = Searcher(archive)\nquery = Query().setQuery(\"foo\")\nsearch = searcher.search(query)\nfor path in search.getResult(10, 10) # get result from 10 to 20 (10 results)\n print(path, archive.get_entry_by_path(path).title)"; static const char __pyx_k_libzim_suggestion_module_Suggest[] = "libzim suggestion module\n\n- SuggestionSearcher to perform a suggestion search over a libzim.reader.Archive\n\nUsage:\n\narchive = Archive(fpath)\nsuggestion_searcher = SuggestionSearcher(archive)\nsuggestions = suggestion_searcher.suggest(\"foo\")\nfor path in suggestion.getResult(10, 10) # get result from 10 to 20 (10 results)\n print(path, archive.get_entry_by_path(path).title)"; static const char __pyx_k_libzim_version_module_Get_versio[] = "libzim version module\n- Get version of libzim and its dependencies\n- Print version of libzim and its dependencies\n- Get libzim version\n\nUsage:\n from libzim.version import get_libzim_version, get_versions, print_versions\n major, minor, patch = get_libzim_version().split(\".\", 2)\n\n for dependency, version in get_versions().items():\n print(f\"- {dependency}={version}\")\n\n print_versions()"; static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; static const char __pyx_k_openZIM_s_file_format_library_bi[] = "openZIM's file format library binding\n\n- libzim.writer to create ZIM file with Creator\n- libzim.reader to open ZIM file as Archive\n- libzim.search to search on an Archive\n- libzim.suggestion to retrieve suggestions on an Archive\n\nhttps://openzim.org"; static const char __pyx_k_self_c_entry_cannot_be_converted[] = "self.c_entry cannot be converted to a Python object for pickling"; static const char __pyx_k_self_c_query_cannot_be_converted[] = "self.c_query cannot be converted to a Python object for pickling"; static const char __pyx_k_self_c_resultset_cannot_be_conve[] = "self.c_resultset cannot be converted to a Python object for pickling"; static const char __pyx_k_self_c_search_cannot_be_converte[] = "self.c_search cannot be converted to a Python object for pickling"; static PyObject *__pyx_kp_b_; static PyObject *__pyx_kp_u_; static PyObject *__pyx_n_s_Archive; static PyObject *__pyx_n_s_BaseWritingItem; static PyObject *__pyx_n_s_BaseWritingItem___init; static PyObject *__pyx_n_s_BaseWritingItem___repr; static PyObject *__pyx_n_s_BaseWritingItem_get_contentprovi; static PyObject *__pyx_n_s_BaseWritingItem_get_hints; static PyObject *__pyx_n_s_BaseWritingItem_get_mimetype; static PyObject *__pyx_n_s_BaseWritingItem_get_path; static PyObject *__pyx_n_s_BaseWritingItem_get_title; static PyObject *__pyx_n_u_Blob; static PyObject *__pyx_kp_u_Blob_has_views; static PyObject *__pyx_kp_u_Blob_is_none; static PyObject *__pyx_n_s_BufferError; static PyObject *__pyx_n_s_COMPRESS; static PyObject *__pyx_kp_u_Cannot_create_writable_memoryvie; static PyObject *__pyx_n_s_Compression; static PyObject *__pyx_kp_s_Compression_algorithms_available; static PyObject *__pyx_n_s_ContentProvider; static PyObject *__pyx_n_s_ContentProvider___init; static PyObject *__pyx_n_s_ContentProvider_feed; static PyObject *__pyx_kp_s_ContentProvider_for_a_file_using; static PyObject *__pyx_kp_s_ContentProvider_for_a_single_enc; static PyObject *__pyx_n_s_ContentProvider_gen_blob; static PyObject *__pyx_n_s_ContentProvider_get_size; static PyObject *__pyx_kp_u_ContentProvider_is_None; static PyObject *__pyx_n_s_Creator; static PyObject *__pyx_n_s_Creator_2; static PyObject *__pyx_n_s_Creator___repr; static PyObject *__pyx_n_s_Creator_add_metadata; static PyObject *__pyx_n_s_Creator_config_compression; static PyObject *__pyx_kp_u_Creator_filename; static PyObject *__pyx_kp_u_Creator_not_started; static PyObject *__pyx_kp_u_Creator_started; static PyObject *__pyx_n_u_Date; static PyObject *__pyx_n_s_Dict; static PyObject *__pyx_n_s_Entry; static PyObject *__pyx_n_s_Enum; static PyObject *__pyx_n_s_FRONT_ARTICLE; static PyObject *__pyx_n_s_FileProvider; static PyObject *__pyx_n_s_FileProvider___init; static PyObject *__pyx_n_s_FileProvider_gen_blob; static PyObject *__pyx_n_s_FileProvider_get_size; static PyObject *__pyx_n_s_Generator; static PyObject *__pyx_n_s_Hint; static PyObject *__pyx_n_s_IOError; static PyObject *__pyx_n_s_IndexData; static PyObject *__pyx_n_s_IndexData_get_content; static PyObject *__pyx_n_s_IndexData_get_geoposition; static PyObject *__pyx_n_s_IndexData_get_keywords; static PyObject *__pyx_n_s_IndexData_get_title; static PyObject *__pyx_n_s_IndexData_get_wordcount; static PyObject *__pyx_n_s_IndexData_has_indexdata; static PyObject *__pyx_kp_s_IndexData_stub_to_override_Retu; static PyObject *__pyx_n_s_Item; static PyObject *__pyx_n_u_Item; static PyObject *__pyx_kp_s_Item_stub_to_override_Pass_a_sub; static PyObject *__pyx_n_s_Iterator; static PyObject *__pyx_n_s_KeyError; static PyObject *__pyx_n_s_List; static PyObject *__pyx_n_s_Loader; static PyObject *__pyx_n_s_MetaPathFinder; static PyObject *__pyx_n_s_ModuleFinder; static PyObject *__pyx_n_s_ModuleFinder_find_spec; static PyObject *__pyx_n_s_ModuleLoader; static PyObject *__pyx_n_s_ModuleLoader_create_module; static PyObject *__pyx_n_s_ModuleLoader_exec_module; static PyObject *__pyx_n_s_ModuleSpec; static PyObject *__pyx_n_s_ModuleType; static PyObject *__pyx_kp_u_None; static PyObject *__pyx_n_s_NotImplementedError; static PyObject *__pyx_n_s_Optional; static PyObject *__pyx_n_s_OrderedDict; static PyObject *__pyx_n_s_Path; static PyObject *__pyx_n_s_Query; static PyObject *__pyx_n_s_ReadingBlob; static PyObject *__pyx_n_s_RuntimeError; static PyObject *__pyx_n_s_Search; static PyObject *__pyx_n_s_SearchResultSet; static PyObject *__pyx_n_s_SearchResultSet___iter; static PyObject *__pyx_n_s_Searcher; static PyObject *__pyx_n_s_Set; static PyObject *__pyx_n_s_StopIteration; static PyObject *__pyx_n_s_StringProvider; static PyObject *__pyx_n_s_StringProvider___init; static PyObject *__pyx_n_s_StringProvider_gen_blob; static PyObject *__pyx_n_s_StringProvider_get_size; static PyObject *__pyx_n_s_SuggestionResultSet; static PyObject *__pyx_n_s_SuggestionResultSet___iter; static PyObject *__pyx_n_s_SuggestionSearch; static PyObject *__pyx_n_s_SuggestionSearcher; static PyObject *__pyx_n_s_Tuple; static PyObject *__pyx_n_s_TypeError; static PyObject *__pyx_kp_u_UTF_8; static PyObject *__pyx_n_s_UUID; static PyObject *__pyx_kp_u_Unable_to_write_ZIM_file_at; static PyObject *__pyx_n_s_Union; static PyObject *__pyx_n_s_W_OK; static PyObject *__pyx_n_s_WritingBlob; static PyObject *__pyx_n_u_WritingBlob; static PyObject *__pyx_kp_u_Y_m_d; static PyObject *__pyx_kp_u__24; static PyObject *__pyx_kp_u__50; static PyObject *__pyx_kp_u__51; static PyObject *__pyx_n_s_abc; static PyObject *__pyx_n_s_access; static PyObject *__pyx_n_s_add_metadata; static PyObject *__pyx_n_s_all; static PyObject *__pyx_n_s_all_2; static PyObject *__pyx_n_s_archive; static PyObject *__pyx_n_s_args; static PyObject *__pyx_n_s_blob; static PyObject *__pyx_n_u_bool; static PyObject *__pyx_n_s_bsize; static PyObject *__pyx_n_s_class; static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_close; static PyObject *__pyx_n_s_collections; static PyObject *__pyx_n_s_compression; static PyObject *__pyx_n_s_config_compression; static PyObject *__pyx_n_s_content; static PyObject *__pyx_n_s_count; static PyObject *__pyx_n_s_create_module; static PyObject *__pyx_n_s_date; static PyObject *__pyx_n_s_datetime; static PyObject *__pyx_n_s_decode; static PyObject *__pyx_n_s_doc; static PyObject *__pyx_n_s_doc_2; static PyObject *__pyx_n_s_effective_ids; static PyObject *__pyx_n_s_encode; static PyObject *__pyx_n_s_enter; static PyObject *__pyx_n_s_enum; static PyObject *__pyx_n_s_exc_tb; static PyObject *__pyx_n_s_exc_type; static PyObject *__pyx_n_s_exc_val; static PyObject *__pyx_n_s_exec_module; static PyObject *__pyx_n_s_exit; static PyObject *__pyx_n_s_expanduser; static PyObject *__pyx_n_s_feed; static PyObject *__pyx_n_s_fh; static PyObject *__pyx_n_s_file; static PyObject *__pyx_n_s_filename; static PyObject *__pyx_kp_u_filename_2; static PyObject *__pyx_n_s_filepath; static PyObject *__pyx_n_s_find_spec; static PyObject *__pyx_n_s_format_exc; static PyObject *__pyx_n_s_fullname; static PyObject *__pyx_n_s_gen_blob; static PyObject *__pyx_kp_u_gen_blob_ro_feed_must_be_impleme; static PyObject *__pyx_n_s_generator; static PyObject *__pyx_n_s_get; static PyObject *__pyx_n_s_get_content; static PyObject *__pyx_kp_u_get_content_must_be_implemented; static PyObject *__pyx_n_s_get_contentprovider; static PyObject *__pyx_kp_u_get_contentprovider_must_be_impl; static PyObject *__pyx_n_s_get_geoposition; static PyObject *__pyx_n_s_get_hints; static PyObject *__pyx_kp_u_get_hints_must_be_implemented; static PyObject *__pyx_n_s_get_keywords; static PyObject *__pyx_kp_u_get_keywords_must_be_implemented; static PyObject *__pyx_n_s_get_libzim_version; static PyObject *__pyx_n_s_get_mimetype; static PyObject *__pyx_kp_u_get_mimetype_must_be_implemented; static PyObject *__pyx_n_s_get_path; static PyObject *__pyx_kp_u_get_path_must_be_implemented; static PyObject *__pyx_n_s_get_size; static PyObject *__pyx_kp_u_get_size_must_be_implemented; static PyObject *__pyx_n_s_get_title; static PyObject *__pyx_kp_u_get_title_must_be_implemented; static PyObject *__pyx_n_s_get_versions; static PyObject *__pyx_n_s_get_wordcount; static PyObject *__pyx_kp_u_get_wordcount_must_be_implemente; static PyObject *__pyx_n_s_getsize; static PyObject *__pyx_n_s_getstate; static PyObject *__pyx_n_s_has_indexdata; static PyObject *__pyx_n_s_hex; static PyObject *__pyx_n_s_hints; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_importlib; static PyObject *__pyx_n_s_importlib_abc; static PyObject *__pyx_n_s_indexing; static PyObject *__pyx_n_s_init; static PyObject *__pyx_n_s_insert; static PyObject *__pyx_n_u_int; static PyObject *__pyx_n_s_items; static PyObject *__pyx_n_s_iter; static PyObject *__pyx_n_s_language; static PyObject *__pyx_n_s_library; static PyObject *__pyx_n_s_libzim; static PyObject *__pyx_n_u_libzim; static PyObject *__pyx_kp_u_libzim_2; static PyObject *__pyx_kp_s_libzim_libzim_pyx; static PyObject *__pyx_kp_u_libzim_reader; static PyObject *__pyx_kp_u_libzim_reader_module_Archive_to; static PyObject *__pyx_kp_u_libzim_search; static PyObject *__pyx_kp_u_libzim_search_module_Query_to_pr; static PyObject *__pyx_kp_u_libzim_suggestion; static PyObject *__pyx_kp_u_libzim_suggestion_module_Suggest; static PyObject *__pyx_kp_u_libzim_version; static PyObject *__pyx_kp_u_libzim_version_module_Get_versio; static PyObject *__pyx_kp_u_libzim_writer; static PyObject *__pyx_kp_u_libzim_writer_module_Creator_to; static PyObject *__pyx_n_s_lower; static PyObject *__pyx_n_s_machinery; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_members; static PyObject *__pyx_n_s_memoryview; static PyObject *__pyx_n_s_meta_path; static PyObject *__pyx_n_s_metaclass; static PyObject *__pyx_n_s_mimetype; static PyObject *__pyx_n_s_mode; static PyObject *__pyx_n_s_module; static PyObject *__pyx_n_s_module_2; static PyObject *__pyx_n_s_modules; static PyObject *__pyx_n_s_mro; static PyObject *__pyx_n_s_name; static PyObject *__pyx_n_s_name_2; static PyObject *__pyx_kp_s_no_default___reduce___due_to_non; static PyObject *__pyx_n_s_none; static PyObject *__pyx_n_s_obj; static PyObject *__pyx_n_s_open; static PyObject *__pyx_n_s_os; static PyObject *__pyx_n_s_out; static PyObject *__pyx_n_s_parent; static PyObject *__pyx_n_s_path; static PyObject *__pyx_kp_u_path_2; static PyObject *__pyx_n_s_path_3; static PyObject *__pyx_n_s_pathlib; static PyObject *__pyx_n_s_prefix; static PyObject *__pyx_n_s_prepare; static PyObject *__pyx_n_s_print; static PyObject *__pyx_n_s_print_versions; static PyObject *__pyx_n_s_pybool; static PyObject *__pyx_n_s_pyint; static PyObject *__pyx_n_s_pyx_vtable; static PyObject *__pyx_n_s_qualname; static PyObject *__pyx_n_u_rb; static PyObject *__pyx_n_s_read; static PyObject *__pyx_n_s_reader; static PyObject *__pyx_n_u_reader; static PyObject *__pyx_kp_u_reader_2; static PyObject *__pyx_n_s_reader_module_doc; static PyObject *__pyx_n_s_reader_module_name; static PyObject *__pyx_n_s_reader_public_objects; static PyObject *__pyx_n_s_reduce; static PyObject *__pyx_n_s_reduce_cython; static PyObject *__pyx_n_s_reduce_ex; static PyObject *__pyx_n_s_repr; static PyObject *__pyx_n_s_res; static PyObject *__pyx_n_s_resolve; static PyObject *__pyx_n_s_return; static PyObject *__pyx_n_s_search; static PyObject *__pyx_n_u_search; static PyObject *__pyx_kp_u_search_2; static PyObject *__pyx_n_s_search_module_doc; static PyObject *__pyx_n_s_search_module_name; static PyObject *__pyx_n_s_search_public_objects; static PyObject *__pyx_n_s_self; static PyObject *__pyx_kp_s_self_c_blob_cannot_be_converted; static PyObject *__pyx_kp_s_self_c_entry_cannot_be_converted; static PyObject *__pyx_kp_s_self_c_item_cannot_be_converted; static PyObject *__pyx_kp_s_self_c_query_cannot_be_converted; static PyObject *__pyx_kp_s_self_c_resultset_cannot_be_conve; static PyObject *__pyx_kp_s_self_c_search_cannot_be_converte; static PyObject *__pyx_n_s_send; static PyObject *__pyx_n_s_setstate; static PyObject *__pyx_n_s_setstate_cython; static PyObject *__pyx_n_s_size; static PyObject *__pyx_n_s_spec; static PyObject *__pyx_n_s_start; static PyObject *__pyx_n_s_startswith; static PyObject *__pyx_n_s_staticmethod; static PyObject *__pyx_n_s_stdout; static PyObject *__pyx_n_s_strftime; static PyObject *__pyx_n_s_suggestion; static PyObject *__pyx_n_u_suggestion; static PyObject *__pyx_kp_u_suggestion_2; static PyObject *__pyx_n_s_suggestion_module_doc; static PyObject *__pyx_n_s_suggestion_module_name; static PyObject *__pyx_n_s_suggestion_public_objects; static PyObject *__pyx_n_s_super; static PyObject *__pyx_n_s_supports_effective_ids; static PyObject *__pyx_n_s_sys; static PyObject *__pyx_n_s_target; static PyObject *__pyx_n_s_targetPath; static PyObject *__pyx_n_s_test; static PyObject *__pyx_kp_u_text_plain_charset_UTF_8; static PyObject *__pyx_n_s_throw; static PyObject *__pyx_n_s_title; static PyObject *__pyx_kp_u_title_2; static PyObject *__pyx_n_s_traceback; static PyObject *__pyx_n_s_types; static PyObject *__pyx_n_s_typing; static PyObject *__pyx_n_u_unicode; static PyObject *__pyx_kp_u_url; static PyObject *__pyx_n_s_uuid; static PyObject *__pyx_n_s_value; static PyObject *__pyx_n_s_version; static PyObject *__pyx_n_u_version; static PyObject *__pyx_kp_u_version_2; static PyObject *__pyx_n_s_version_module_doc; static PyObject *__pyx_n_s_version_module_name; static PyObject *__pyx_n_s_version_public_objects; static PyObject *__pyx_n_s_versions; static PyObject *__pyx_n_s_writer; static PyObject *__pyx_n_u_writer; static PyObject *__pyx_kp_u_writer_2; static PyObject *__pyx_n_s_writer_module_doc; static PyObject *__pyx_n_s_writer_module_name; static PyObject *__pyx_n_s_writer_public_objects; static PyObject *__pyx_n_s_zstd; static PyObject *__pyx_pf_6libzim_create_module(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name, PyObject *__pyx_v_doc, PyObject *__pyx_v_members); /* proto */ static int __pyx_pf_6libzim_11WritingBlob___cinit__(struct __pyx_obj_6libzim_WritingBlob *__pyx_v_self, PyObject *__pyx_v_content); /* proto */ static PyObject *__pyx_pf_6libzim_11WritingBlob_2size(struct __pyx_obj_6libzim_WritingBlob *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_11WritingBlob_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_WritingBlob *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_11WritingBlob_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_WritingBlob *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static int __pyx_pf_6libzim_8_Creator___cinit__(struct __pyx_obj_6libzim__Creator *__pyx_v_self, PyObject *__pyx_v_filename, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */ static int __pyx_pf_6libzim_8_Creator_2__init__(CYTHON_UNUSED struct __pyx_obj_6libzim__Creator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_filename); /* proto */ static PyObject *__pyx_pf_6libzim_8_Creator_4config_verbose(struct __pyx_obj_6libzim__Creator *__pyx_v_self, bool __pyx_v_verbose); /* proto */ static PyObject *__pyx_pf_6libzim_8_Creator_6config_compression(struct __pyx_obj_6libzim__Creator *__pyx_v_self, PyObject *__pyx_v_compression); /* proto */ static PyObject *__pyx_pf_6libzim_8_Creator_8config_clustersize(struct __pyx_obj_6libzim__Creator *__pyx_v_self, int __pyx_v_size); /* proto */ static PyObject *__pyx_pf_6libzim_8_Creator_10config_indexing(struct __pyx_obj_6libzim__Creator *__pyx_v_self, bool __pyx_v_indexing, PyObject *__pyx_v_language); /* proto */ static PyObject *__pyx_pf_6libzim_8_Creator_12config_nbworkers(struct __pyx_obj_6libzim__Creator *__pyx_v_self, int __pyx_v_nbWorkers); /* proto */ static PyObject *__pyx_pf_6libzim_8_Creator_14set_mainpath(struct __pyx_obj_6libzim__Creator *__pyx_v_self, PyObject *__pyx_v_mainPath); /* proto */ static PyObject *__pyx_pf_6libzim_8_Creator_16add_illustration(struct __pyx_obj_6libzim__Creator *__pyx_v_self, int __pyx_v_size, PyObject *__pyx_v_content); /* proto */ static PyObject *__pyx_pf_6libzim_8_Creator_18add_item(struct __pyx_obj_6libzim__Creator *__pyx_v_self, PyObject *__pyx_v_writer_item); /* proto */ static PyObject *__pyx_pf_6libzim_8_Creator_20add_metadata(struct __pyx_obj_6libzim__Creator *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_content, PyObject *__pyx_v_mimetype); /* proto */ static PyObject *__pyx_pf_6libzim_8_Creator_22add_redirection(struct __pyx_obj_6libzim__Creator *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_title, PyObject *__pyx_v_targetPath, PyObject *__pyx_v_hints); /* proto */ static PyObject *__pyx_pf_6libzim_8_Creator_24__enter__(struct __pyx_obj_6libzim__Creator *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_8_Creator_26__exit__(struct __pyx_obj_6libzim__Creator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_val, CYTHON_UNUSED PyObject *__pyx_v_exc_tb); /* proto */ static PyObject *__pyx_pf_6libzim_8_Creator_8filename___get__(struct __pyx_obj_6libzim__Creator *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_8_Creator_28__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim__Creator *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_8_Creator_30__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim__Creator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_6libzim_15ContentProvider___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_15ContentProvider_2get_size(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ static struct __pyx_obj_6libzim_WritingBlob *__pyx_pf_6libzim_15ContentProvider_4feed(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_15ContentProvider_6gen_blob(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_14StringProvider___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_content); /* proto */ static PyObject *__pyx_pf_6libzim_14StringProvider_2get_size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_14StringProvider_4gen_blob(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_12FileProvider___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filepath); /* proto */ static PyObject *__pyx_pf_6libzim_12FileProvider_2get_size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_12FileProvider_4gen_blob(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_9IndexData_has_indexdata(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_9IndexData_2get_title(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_9IndexData_4get_content(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_9IndexData_6get_keywords(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_9IndexData_8get_wordcount(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_9IndexData_10get_geoposition(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_15BaseWritingItem___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_15BaseWritingItem_2get_path(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_15BaseWritingItem_4get_title(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_15BaseWritingItem_6get_mimetype(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_15BaseWritingItem_8get_contentprovider(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_15BaseWritingItem_10get_hints(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_15BaseWritingItem_12__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Creator_config_compression(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_compression); /* proto */ static PyObject *__pyx_pf_6libzim_7Creator_2add_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_content, PyObject *__pyx_v_mimetype); /* proto */ static PyObject *__pyx_pf_6libzim_7Creator_4__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static void __pyx_pf_6libzim_11ReadingBlob___dealloc__(struct __pyx_obj_6libzim_ReadingBlob *__pyx_v_self); /* proto */ static int __pyx_pf_6libzim_11ReadingBlob_2__getbuffer__(struct __pyx_obj_6libzim_ReadingBlob *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags); /* proto */ static void __pyx_pf_6libzim_11ReadingBlob_4__releasebuffer__(struct __pyx_obj_6libzim_ReadingBlob *__pyx_v_self, CYTHON_UNUSED Py_buffer *__pyx_v_buffer); /* proto */ static PyObject *__pyx_pf_6libzim_11ReadingBlob_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_ReadingBlob *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_11ReadingBlob_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_ReadingBlob *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_6libzim_5Entry_5title___get__(struct __pyx_obj_6libzim_Entry *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_5Entry_4path___get__(struct __pyx_obj_6libzim_Entry *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_5Entry_6_index___get__(struct __pyx_obj_6libzim_Entry *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_5Entry_11is_redirect___get__(struct __pyx_obj_6libzim_Entry *__pyx_v_self); /* proto */ static struct __pyx_obj_6libzim_Entry *__pyx_pf_6libzim_5Entry_get_redirect_entry(struct __pyx_obj_6libzim_Entry *__pyx_v_self); /* proto */ static struct __pyx_obj_6libzim_Item *__pyx_pf_6libzim_5Entry_2get_item(struct __pyx_obj_6libzim_Entry *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_5Entry_4__repr__(struct __pyx_obj_6libzim_Entry *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_5Entry_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Entry *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_5Entry_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Entry *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_6libzim_4Item_5title___get__(struct __pyx_obj_6libzim_Item *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_4Item_4path___get__(struct __pyx_obj_6libzim_Item *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_4Item_7content___get__(struct __pyx_obj_6libzim_Item *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_4Item_8mimetype___get__(struct __pyx_obj_6libzim_Item *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_4Item_6_index___get__(struct __pyx_obj_6libzim_Item *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_4Item_4size___get__(struct __pyx_obj_6libzim_Item *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_4Item___repr__(struct __pyx_obj_6libzim_Item *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_4Item_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Item *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_4Item_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Item *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static int __pyx_pf_6libzim_7Archive___cinit__(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_2__eq__(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_8filename___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_8filesize___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_4has_entry_by_path(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_path); /* proto */ static struct __pyx_obj_6libzim_Entry *__pyx_pf_6libzim_7Archive_6get_entry_by_path(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_path); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_8has_entry_by_title(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_title); /* proto */ static struct __pyx_obj_6libzim_Entry *__pyx_pf_6libzim_7Archive_10get_entry_by_title(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_title); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_13metadata_keys___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static struct __pyx_obj_6libzim_Item *__pyx_pf_6libzim_7Archive_12get_metadata_item(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_14get_metadata(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_name); /* proto */ static struct __pyx_obj_6libzim_Entry *__pyx_pf_6libzim_7Archive_16_get_entry_by_id(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_entry_id); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_14has_main_entry___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_10main_entry___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_4uuid___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_24has_new_namespace_scheme___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_12is_multipart___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_18has_fulltext_index___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_15has_title_index___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_12has_checksum___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_8checksum___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_18check(struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_11entry_count___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_15all_entry_count___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_13article_count___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_11media_count___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_20get_illustration_sizes(struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_22has_illustration(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_size); /* proto */ static struct __pyx_obj_6libzim_Item *__pyx_pf_6libzim_7Archive_24get_illustration_item(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_size); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_26__repr__(struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_28__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Archive *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_7Archive_30__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Archive *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_6libzim_5Query_set_query(struct __pyx_obj_6libzim_Query *__pyx_v_self, PyObject *__pyx_v_query); /* proto */ static PyObject *__pyx_pf_6libzim_5Query_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Query *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_5Query_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Query *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_6libzim_15SearchResultSet___iter__(struct __pyx_obj_6libzim_SearchResultSet *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_15SearchResultSet_3__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_SearchResultSet *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_15SearchResultSet_5__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_SearchResultSet *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_6libzim_6Search_getEstimatedMatches(struct __pyx_obj_6libzim_Search *__pyx_v_self); /* proto */ static struct __pyx_obj_6libzim_SearchResultSet *__pyx_pf_6libzim_6Search_2getResults(struct __pyx_obj_6libzim_Search *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_count); /* proto */ static PyObject *__pyx_pf_6libzim_6Search_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Search *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_6Search_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Search *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static int __pyx_pf_6libzim_8Searcher___cinit__(struct __pyx_obj_6libzim_Searcher *__pyx_v_self, struct __pyx_obj_6libzim_Archive *__pyx_v_archive); /* proto */ static struct __pyx_obj_6libzim_Search *__pyx_pf_6libzim_8Searcher_2search(struct __pyx_obj_6libzim_Searcher *__pyx_v_self, struct __pyx_obj_6libzim_Query *__pyx_v_query); /* proto */ static PyObject *__pyx_pf_6libzim_8Searcher_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Searcher *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_8Searcher_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Searcher *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_6libzim_19SuggestionResultSet___iter__(struct __pyx_obj_6libzim_SuggestionResultSet *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_19SuggestionResultSet_3__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_SuggestionResultSet *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_19SuggestionResultSet_5__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_SuggestionResultSet *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_6libzim_16SuggestionSearch_getEstimatedMatches(struct __pyx_obj_6libzim_SuggestionSearch *__pyx_v_self); /* proto */ static struct __pyx_obj_6libzim_SuggestionResultSet *__pyx_pf_6libzim_16SuggestionSearch_2getResults(struct __pyx_obj_6libzim_SuggestionSearch *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_count); /* proto */ static PyObject *__pyx_pf_6libzim_16SuggestionSearch_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_SuggestionSearch *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_16SuggestionSearch_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_SuggestionSearch *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static int __pyx_pf_6libzim_18SuggestionSearcher___cinit__(struct __pyx_obj_6libzim_SuggestionSearcher *__pyx_v_self, struct __pyx_obj_6libzim_Archive *__pyx_v_archive); /* proto */ static struct __pyx_obj_6libzim_SuggestionSearch *__pyx_pf_6libzim_18SuggestionSearcher_2suggest(struct __pyx_obj_6libzim_SuggestionSearcher *__pyx_v_self, PyObject *__pyx_v_query); /* proto */ static PyObject *__pyx_pf_6libzim_18SuggestionSearcher_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_SuggestionSearcher *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_6libzim_18SuggestionSearcher_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_SuggestionSearcher *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_6libzim_2print_versions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_out); /* proto */ static PyObject *__pyx_pf_6libzim_4get_versions(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_6libzim_6get_libzim_version(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_6libzim_12ModuleLoader_create_module(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_spec); /* proto */ static PyObject *__pyx_pf_6libzim_12ModuleLoader_2exec_module(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_module); /* proto */ static PyObject *__pyx_pf_6libzim_12ModuleFinder_find_spec(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_fullname, CYTHON_UNUSED PyObject *__pyx_v_path, CYTHON_UNUSED PyObject *__pyx_v_target); /* proto */ static PyObject *__pyx_tp_new_6libzim_WritingBlob(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6libzim__Creator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6libzim_ReadingBlob(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6libzim_Entry(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6libzim_Item(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6libzim_Archive(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6libzim_Query(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6libzim_SearchResultSet(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6libzim_Search(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6libzim_Searcher(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6libzim_SuggestionResultSet(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6libzim_SuggestionSearch(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6libzim_SuggestionSearcher(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6libzim___pyx_scope_struct__gen_blob(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6libzim___pyx_scope_struct_1_gen_blob(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6libzim___pyx_scope_struct_2___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_6libzim___pyx_scope_struct_3___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0}; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_k__49; 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__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__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_tuple__40; static PyObject *__pyx_tuple__41; static PyObject *__pyx_tuple__42; 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__52; static PyObject *__pyx_tuple__54; static PyObject *__pyx_tuple__56; static PyObject *__pyx_tuple__58; static PyObject *__pyx_tuple__60; static PyObject *__pyx_tuple__62; static PyObject *__pyx_tuple__64; static PyObject *__pyx_tuple__66; static PyObject *__pyx_tuple__67; static PyObject *__pyx_tuple__69; static PyObject *__pyx_tuple__71; static PyObject *__pyx_tuple__72; static PyObject *__pyx_tuple__74; static PyObject *__pyx_tuple__76; static PyObject *__pyx_tuple__78; static PyObject *__pyx_tuple__80; static PyObject *__pyx_tuple__82; static PyObject *__pyx_tuple__84; static PyObject *__pyx_tuple__86; static PyObject *__pyx_tuple__88; static PyObject *__pyx_tuple__90; static PyObject *__pyx_tuple__92; static PyObject *__pyx_tuple__94; static PyObject *__pyx_tuple__96; static PyObject *__pyx_tuple__98; static PyObject *__pyx_tuple__100; static PyObject *__pyx_tuple__102; static PyObject *__pyx_tuple__103; static PyObject *__pyx_tuple__105; static PyObject *__pyx_tuple__107; static PyObject *__pyx_tuple__110; static PyObject *__pyx_tuple__112; static PyObject *__pyx_tuple__114; static PyObject *__pyx_tuple__116; static PyObject *__pyx_codeobj__13; static PyObject *__pyx_codeobj__14; static PyObject *__pyx_codeobj__53; static PyObject *__pyx_codeobj__55; static PyObject *__pyx_codeobj__57; static PyObject *__pyx_codeobj__59; static PyObject *__pyx_codeobj__61; static PyObject *__pyx_codeobj__63; static PyObject *__pyx_codeobj__65; static PyObject *__pyx_codeobj__68; static PyObject *__pyx_codeobj__70; static PyObject *__pyx_codeobj__73; static PyObject *__pyx_codeobj__75; static PyObject *__pyx_codeobj__77; static PyObject *__pyx_codeobj__79; static PyObject *__pyx_codeobj__81; static PyObject *__pyx_codeobj__83; static PyObject *__pyx_codeobj__85; static PyObject *__pyx_codeobj__87; static PyObject *__pyx_codeobj__89; static PyObject *__pyx_codeobj__91; static PyObject *__pyx_codeobj__93; static PyObject *__pyx_codeobj__95; static PyObject *__pyx_codeobj__97; static PyObject *__pyx_codeobj__99; static PyObject *__pyx_codeobj__101; static PyObject *__pyx_codeobj__104; static PyObject *__pyx_codeobj__106; static PyObject *__pyx_codeobj__108; static PyObject *__pyx_codeobj__109; static PyObject *__pyx_codeobj__111; static PyObject *__pyx_codeobj__113; static PyObject *__pyx_codeobj__115; /* Late includes */ /* "libzim.pyx":62 * pyint = type(1) * * def create_module(name, doc, members): # <<<<<<<<<<<<<< * """Create/define a module for name and docstring, populated by members""" * module = ModuleType(name, doc) */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_1create_module(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6libzim_create_module[] = "Create/define a module for name and docstring, populated by members"; static PyMethodDef __pyx_mdef_6libzim_1create_module = {"create_module", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6libzim_1create_module, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6libzim_create_module}; static PyObject *__pyx_pw_6libzim_1create_module(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_name = 0; PyObject *__pyx_v_doc = 0; PyObject *__pyx_v_members = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("create_module (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_doc,&__pyx_n_s_members,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); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_doc)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("create_module", 1, 3, 3, 1); __PYX_ERR(0, 62, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_members)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("create_module", 1, 3, 3, 2); __PYX_ERR(0, 62, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "create_module") < 0)) __PYX_ERR(0, 62, __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_name = values[0]; __pyx_v_doc = values[1]; __pyx_v_members = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("create_module", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 62, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim.create_module", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6libzim_create_module(__pyx_self, __pyx_v_name, __pyx_v_doc, __pyx_v_members); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_create_module(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name, PyObject *__pyx_v_doc, PyObject *__pyx_v_members) { PyObject *__pyx_v_module = NULL; PyObject *__pyx_v__all = NULL; PyObject *__pyx_v_obj = 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; PyObject *__pyx_t_5 = NULL; 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_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("create_module", 0); __Pyx_INCREF(__pyx_v_name); /* "libzim.pyx":64 * def create_module(name, doc, members): * """Create/define a module for name and docstring, populated by members""" * module = ModuleType(name, doc) # <<<<<<<<<<<<<< * _all = [] * for obj in members: */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ModuleType); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_4 = 0; 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); __pyx_t_4 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_name, __pyx_v_doc}; __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, 64, __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_v_name, __pyx_v_doc}; __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, 64, __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, 64, __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_name); __Pyx_GIVEREF(__pyx_v_name); PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_name); __Pyx_INCREF(__pyx_v_doc); __Pyx_GIVEREF(__pyx_v_doc); PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_doc); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __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_v_module = __pyx_t_1; __pyx_t_1 = 0; /* "libzim.pyx":65 * """Create/define a module for name and docstring, populated by members""" * module = ModuleType(name, doc) * _all = [] # <<<<<<<<<<<<<< * for obj in members: * if isinstance(obj, tuple): */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v__all = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":66 * module = ModuleType(name, doc) * _all = [] * for obj in members: # <<<<<<<<<<<<<< * if isinstance(obj, tuple): * name = obj[0] */ if (likely(PyList_CheckExact(__pyx_v_members)) || PyTuple_CheckExact(__pyx_v_members)) { __pyx_t_1 = __pyx_v_members; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0; __pyx_t_7 = NULL; } else { __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_members); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 66, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_7)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_6 >= 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_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 66, __pyx_L1_error) #else __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } else { if (__pyx_t_6 >= 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_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 66, __pyx_L1_error) #else __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } } else { __pyx_t_2 = __pyx_t_7(__pyx_t_1); if (unlikely(!__pyx_t_2)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 66, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_2); } __Pyx_XDECREF_SET(__pyx_v_obj, __pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":67 * _all = [] * for obj in members: * if isinstance(obj, tuple): # <<<<<<<<<<<<<< * name = obj[0] * obj = obj[1] */ __pyx_t_8 = PyTuple_Check(__pyx_v_obj); __pyx_t_9 = (__pyx_t_8 != 0); if (__pyx_t_9) { /* "libzim.pyx":68 * for obj in members: * if isinstance(obj, tuple): * name = obj[0] # <<<<<<<<<<<<<< * obj = obj[1] * else: */ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_obj, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":69 * if isinstance(obj, tuple): * name = obj[0] * obj = obj[1] # <<<<<<<<<<<<<< * else: * name = obj.__name__ */ __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_obj, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":67 * _all = [] * for obj in members: * if isinstance(obj, tuple): # <<<<<<<<<<<<<< * name = obj[0] * obj = obj[1] */ goto __pyx_L5; } /* "libzim.pyx":71 * obj = obj[1] * else: * name = obj.__name__ # <<<<<<<<<<<<<< * setattr(module, name, obj) * _all.append(name) */ /*else*/ { __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_name_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_2); __pyx_t_2 = 0; } __pyx_L5:; /* "libzim.pyx":72 * else: * name = obj.__name__ * setattr(module, name, obj) # <<<<<<<<<<<<<< * _all.append(name) * module.__all__ = _all */ __pyx_t_10 = PyObject_SetAttr(__pyx_v_module, __pyx_v_name, __pyx_v_obj); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 72, __pyx_L1_error) /* "libzim.pyx":73 * name = obj.__name__ * setattr(module, name, obj) * _all.append(name) # <<<<<<<<<<<<<< * module.__all__ = _all * sys.modules[name] = module */ __pyx_t_10 = __Pyx_PyList_Append(__pyx_v__all, __pyx_v_name); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 73, __pyx_L1_error) /* "libzim.pyx":66 * module = ModuleType(name, doc) * _all = [] * for obj in members: # <<<<<<<<<<<<<< * if isinstance(obj, tuple): * name = obj[0] */ } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":74 * setattr(module, name, obj) * _all.append(name) * module.__all__ = _all # <<<<<<<<<<<<<< * sys.modules[name] = module * return module */ if (__Pyx_PyObject_SetAttrStr(__pyx_v_module, __pyx_n_s_all, __pyx_v__all) < 0) __PYX_ERR(0, 74, __pyx_L1_error) /* "libzim.pyx":75 * _all.append(name) * module.__all__ = _all * sys.modules[name] = module # <<<<<<<<<<<<<< * return module * */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_sys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_modules); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_v_name, __pyx_v_module) < 0)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":76 * module.__all__ = _all * sys.modules[name] = module * return module # <<<<<<<<<<<<<< * * ############################################################################### */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_module); __pyx_r = __pyx_v_module; goto __pyx_L0; /* "libzim.pyx":62 * pyint = type(1) * * def create_module(name, doc, members): # <<<<<<<<<<<<<< * """Create/define a module for name and docstring, populated by members""" * module = ModuleType(name, doc) */ /* 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("libzim.create_module", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_module); __Pyx_XDECREF(__pyx_v__all); __Pyx_XDECREF(__pyx_v_obj); __Pyx_XDECREF(__pyx_v_name); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":83 * * # This calls a python method and returns a python object. * cdef object call_method(object obj, string method): # <<<<<<<<<<<<<< * func = getattr(obj, method.decode('UTF-8')) * return func() */ static PyObject *__pyx_f_6libzim_call_method(PyObject *__pyx_v_obj, std::string __pyx_v_method) { PyObject *__pyx_v_func = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("call_method", 0); /* "libzim.pyx":84 * # This calls a python method and returns a python object. * cdef object call_method(object obj, string method): * func = getattr(obj, method.decode('UTF-8')) # <<<<<<<<<<<<<< * return func() * */ __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_method, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_GetAttr(__pyx_v_obj, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_func = __pyx_t_2; __pyx_t_2 = 0; /* "libzim.pyx":85 * cdef object call_method(object obj, string method): * func = getattr(obj, method.decode('UTF-8')) * return func() # <<<<<<<<<<<<<< * * # Define methods calling a python method and converting the resulting python */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_func); __pyx_t_1 = __pyx_v_func; __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); } } __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":83 * * # This calls a python method and returns a python object. * cdef object call_method(object obj, string method): # <<<<<<<<<<<<<< * func = getattr(obj, method.decode('UTF-8')) * return func() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("libzim.call_method", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_func); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":91 * # Will be used by cpp side to call python method. * cdef public api: * bool obj_has_attribute(object obj, string attribute) with gil: # <<<<<<<<<<<<<< * """Check if a object has a given attribute""" * return hasattr(obj, attribute.decode('UTF-8')) */ bool obj_has_attribute(PyObject *__pyx_v_obj, std::string __pyx_v_attribute) { bool __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("obj_has_attribute", 0); __Pyx_INCREF(__pyx_v_obj); /* "libzim.pyx":93 * bool obj_has_attribute(object obj, string attribute) with gil: * """Check if a object has a given attribute""" * return hasattr(obj, attribute.decode('UTF-8')) # <<<<<<<<<<<<<< * * string string_cy_call_fct(object obj, string method, string *error) with gil: */ __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_attribute, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_HasAttr(__pyx_v_obj, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; goto __pyx_L0; /* "libzim.pyx":91 * # Will be used by cpp side to call python method. * cdef public api: * bool obj_has_attribute(object obj, string attribute) with gil: # <<<<<<<<<<<<<< * """Check if a object has a given attribute""" * return hasattr(obj, attribute.decode('UTF-8')) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_WriteUnraisable("libzim.obj_has_attribute", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_obj); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif return __pyx_r; } /* "libzim.pyx":95 * return hasattr(obj, attribute.decode('UTF-8')) * * string string_cy_call_fct(object obj, string method, string *error) with gil: # <<<<<<<<<<<<<< * """Lookup and execute a pure virtual method on object returning a string""" * try: */ std::string string_cy_call_fct(PyObject *__pyx_v_obj, std::string __pyx_v_method, std::string *__pyx_v_error) { PyObject *__pyx_v_ret_str = NULL; CYTHON_UNUSED PyObject *__pyx_v_e = NULL; std::string __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; std::string __pyx_t_7; int __pyx_t_8; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; int __pyx_t_13; char const *__pyx_t_14; PyObject *__pyx_t_15 = NULL; PyObject *__pyx_t_16 = NULL; PyObject *__pyx_t_17 = NULL; PyObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; PyObject *__pyx_t_20 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("string_cy_call_fct", 0); __Pyx_INCREF(__pyx_v_obj); /* "libzim.pyx":97 * string string_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning a string""" * try: # <<<<<<<<<<<<<< * ret_str = call_method(obj, method) * return ret_str.encode('UTF-8') */ { __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:*/ { /* "libzim.pyx":98 * """Lookup and execute a pure virtual method on object returning a string""" * try: * ret_str = call_method(obj, method) # <<<<<<<<<<<<<< * return ret_str.encode('UTF-8') * except Exception as e: */ __pyx_t_4 = __pyx_f_6libzim_call_method(__pyx_v_obj, __pyx_v_method); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __pyx_v_ret_str = __pyx_t_4; __pyx_t_4 = 0; /* "libzim.pyx":99 * try: * ret_str = call_method(obj, method) * return ret_str.encode('UTF-8') # <<<<<<<<<<<<<< * except Exception as e: * error[0] = traceback.format_exc().encode('UTF-8') */ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_ret_str, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 99, __pyx_L3_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); } } __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u_UTF_8); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 99, __pyx_L3_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_7; goto __pyx_L7_try_return; /* "libzim.pyx":97 * string string_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning a string""" * try: # <<<<<<<<<<<<<< * ret_str = call_method(obj, method) * return ret_str.encode('UTF-8') */ } __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; /* "libzim.pyx":100 * ret_str = call_method(obj, method) * return ret_str.encode('UTF-8') * except Exception as e: # <<<<<<<<<<<<<< * error[0] = traceback.format_exc().encode('UTF-8') * return b"" */ __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_8) { __Pyx_AddTraceback("libzim.string_cy_call_fct", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 100, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_v_e = __pyx_t_5; /*try:*/ { /* "libzim.pyx":101 * return ret_str.encode('UTF-8') * except Exception as e: * error[0] = traceback.format_exc().encode('UTF-8') # <<<<<<<<<<<<<< * return b"" * */ __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 101, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 101, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) { __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12); if (likely(__pyx_t_11)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_12, function); } } __pyx_t_10 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_12); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 101, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_encode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 101, __pyx_L14_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_12))) { __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_12); if (likely(__pyx_t_10)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_12, function); } } __pyx_t_9 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_10, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_kp_u_UTF_8); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 101, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_t_9); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L14_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; (__pyx_v_error[0]) = __pyx_t_7; } /* "libzim.pyx":100 * ret_str = call_method(obj, method) * return ret_str.encode('UTF-8') * except Exception as e: # <<<<<<<<<<<<<< * error[0] = traceback.format_exc().encode('UTF-8') * return b"" */ /*finally:*/ { /*normal exit:*/{ __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; goto __pyx_L15; } __pyx_L14_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __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; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17) < 0)) __Pyx_ErrFetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __Pyx_XGOTREF(__pyx_t_20); __pyx_t_8 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename; { __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_18); __Pyx_XGIVEREF(__pyx_t_19); __Pyx_XGIVEREF(__pyx_t_20); __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_19, __pyx_t_20); } __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_ErrRestore(__pyx_t_15, __pyx_t_16, __pyx_t_17); __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14; goto __pyx_L5_except_error; } __pyx_L15:; } __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_L4_exception_handled; } goto __pyx_L5_except_error; __pyx_L5_except_error:; /* "libzim.pyx":97 * string string_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning a string""" * try: # <<<<<<<<<<<<<< * ret_str = call_method(obj, method) * return ret_str.encode('UTF-8') */ __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_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_L4_exception_handled:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); } /* "libzim.pyx":102 * except Exception as e: * error[0] = traceback.format_exc().encode('UTF-8') * return b"" # <<<<<<<<<<<<<< * * zim.Blob blob_cy_call_fct(object obj, string method, string *error) with gil: */ __pyx_t_7 = __pyx_convert_string_from_py_std__in_string(__pyx_kp_b_); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 102, __pyx_L1_error) __pyx_r = __pyx_t_7; goto __pyx_L0; /* "libzim.pyx":95 * return hasattr(obj, attribute.decode('UTF-8')) * * string string_cy_call_fct(object obj, string method, string *error) with gil: # <<<<<<<<<<<<<< * """Lookup and execute a pure virtual method on object returning a string""" * try: */ /* 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_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_WriteUnraisable("libzim.string_cy_call_fct", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __Pyx_pretend_to_initialize(&__pyx_r); __pyx_L0:; __Pyx_XDECREF(__pyx_v_ret_str); __Pyx_XDECREF(__pyx_v_e); __Pyx_XDECREF(__pyx_v_obj); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif return __pyx_r; } /* "libzim.pyx":104 * return b"" * * zim.Blob blob_cy_call_fct(object obj, string method, string *error) with gil: # <<<<<<<<<<<<<< * """Lookup and execute a pure virtual method on object returning a Blob""" * cdef WritingBlob blob */ wrapper::Blob blob_cy_call_fct(PyObject *__pyx_v_obj, std::string __pyx_v_method, std::string *__pyx_v_error) { struct __pyx_obj_6libzim_WritingBlob *__pyx_v_blob = 0; CYTHON_UNUSED PyObject *__pyx_v_e = NULL; wrapper::Blob __pyx_r; __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; 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; PyObject *__pyx_t_13 = NULL; std::string __pyx_t_14; int __pyx_t_15; char const *__pyx_t_16; PyObject *__pyx_t_17 = NULL; PyObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; PyObject *__pyx_t_20 = NULL; PyObject *__pyx_t_21 = NULL; PyObject *__pyx_t_22 = NULL; wrapper::Blob __pyx_t_23; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("blob_cy_call_fct", 0); __Pyx_INCREF(__pyx_v_obj); /* "libzim.pyx":108 * cdef WritingBlob blob * * try: # <<<<<<<<<<<<<< * blob = call_method(obj, method) * if blob is None: */ { __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:*/ { /* "libzim.pyx":109 * * try: * blob = call_method(obj, method) # <<<<<<<<<<<<<< * if blob is None: * raise RuntimeError("Blob is none") */ __pyx_t_4 = __pyx_f_6libzim_call_method(__pyx_v_obj, __pyx_v_method); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6libzim_WritingBlob))))) __PYX_ERR(0, 109, __pyx_L3_error) __pyx_v_blob = ((struct __pyx_obj_6libzim_WritingBlob *)__pyx_t_4); __pyx_t_4 = 0; /* "libzim.pyx":110 * try: * blob = call_method(obj, method) * if blob is None: # <<<<<<<<<<<<<< * raise RuntimeError("Blob is none") * return move(blob.c_blob) */ __pyx_t_5 = (((PyObject *)__pyx_v_blob) == Py_None); __pyx_t_6 = (__pyx_t_5 != 0); if (unlikely(__pyx_t_6)) { /* "libzim.pyx":111 * blob = call_method(obj, method) * if blob is None: * raise RuntimeError("Blob is none") # <<<<<<<<<<<<<< * return move(blob.c_blob) * except Exception as e: */ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L3_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, 111, __pyx_L3_error) /* "libzim.pyx":110 * try: * blob = call_method(obj, method) * if blob is None: # <<<<<<<<<<<<<< * raise RuntimeError("Blob is none") * return move(blob.c_blob) */ } /* "libzim.pyx":112 * if blob is None: * raise RuntimeError("Blob is none") * return move(blob.c_blob) # <<<<<<<<<<<<<< * except Exception as e: * error[0] = traceback.format_exc().encode('UTF-8') */ __pyx_r = cython_std::move(__pyx_v_blob->c_blob); goto __pyx_L7_try_return; /* "libzim.pyx":108 * cdef WritingBlob blob * * try: # <<<<<<<<<<<<<< * blob = call_method(obj, method) * if blob is None: */ } __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; /* "libzim.pyx":113 * raise RuntimeError("Blob is none") * return move(blob.c_blob) * except Exception as e: # <<<<<<<<<<<<<< * error[0] = traceback.format_exc().encode('UTF-8') * */ __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_7) { __Pyx_AddTraceback("libzim.blob_cy_call_fct", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(0, 113, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_8); __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_v_e = __pyx_t_8; /*try:*/ { /* "libzim.pyx":114 * return move(blob.c_blob) * except Exception as e: * error[0] = traceback.format_exc().encode('UTF-8') # <<<<<<<<<<<<<< * * return move(zim.Blob()) */ __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_traceback); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 114, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 114, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) { __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13); if (likely(__pyx_t_12)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_13, function); } } __pyx_t_11 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_13); __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 114, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_encode); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 114, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) { __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_13); if (likely(__pyx_t_11)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_13, function); } } __pyx_t_10 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_11, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_kp_u_UTF_8); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 114, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_14 = __pyx_convert_string_from_py_std__in_string(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L15_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; (__pyx_v_error[0]) = __pyx_t_14; } /* "libzim.pyx":113 * raise RuntimeError("Blob is none") * return move(blob.c_blob) * except Exception as e: # <<<<<<<<<<<<<< * error[0] = traceback.format_exc().encode('UTF-8') * */ /*finally:*/ { /*normal exit:*/{ __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; goto __pyx_L16; } __pyx_L15_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __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; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19) < 0)) __Pyx_ErrFetch(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __Pyx_XGOTREF(__pyx_t_20); __Pyx_XGOTREF(__pyx_t_21); __Pyx_XGOTREF(__pyx_t_22); __pyx_t_7 = __pyx_lineno; __pyx_t_15 = __pyx_clineno; __pyx_t_16 = __pyx_filename; { __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_20); __Pyx_XGIVEREF(__pyx_t_21); __Pyx_XGIVEREF(__pyx_t_22); __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22); } __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_XGIVEREF(__pyx_t_19); __Pyx_ErrRestore(__pyx_t_17, __pyx_t_18, __pyx_t_19); __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_15; __pyx_filename = __pyx_t_16; goto __pyx_L5_except_error; } __pyx_L16:; } __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L4_exception_handled; } goto __pyx_L5_except_error; __pyx_L5_except_error:; /* "libzim.pyx":108 * cdef WritingBlob blob * * try: # <<<<<<<<<<<<<< * blob = call_method(obj, method) * if blob is None: */ __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_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_L4_exception_handled:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); } /* "libzim.pyx":116 * error[0] = traceback.format_exc().encode('UTF-8') * * return move(zim.Blob()) # <<<<<<<<<<<<<< * * zim.ContentProvider* contentprovider_cy_call_fct(object obj, string method, string *error) with gil: */ try { __pyx_t_23 = wrapper::Blob(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 116, __pyx_L1_error) } __pyx_r = cython_std::move(__pyx_t_23); goto __pyx_L0; /* "libzim.pyx":104 * return b"" * * zim.Blob blob_cy_call_fct(object obj, string method, string *error) with gil: # <<<<<<<<<<<<<< * """Lookup and execute a pure virtual method on object returning a Blob""" * cdef WritingBlob blob */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __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_XDECREF(__pyx_t_13); __Pyx_WriteUnraisable("libzim.blob_cy_call_fct", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __Pyx_pretend_to_initialize(&__pyx_r); __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_blob); __Pyx_XDECREF(__pyx_v_e); __Pyx_XDECREF(__pyx_v_obj); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif return __pyx_r; } /* "libzim.pyx":118 * return move(zim.Blob()) * * zim.ContentProvider* contentprovider_cy_call_fct(object obj, string method, string *error) with gil: # <<<<<<<<<<<<<< * """Lookup and execute a pure virtual method on object returning a ContentProvider""" * try: */ zim::writer::ContentProvider *contentprovider_cy_call_fct(PyObject *__pyx_v_obj, std::string __pyx_v_method, std::string *__pyx_v_error) { PyObject *__pyx_v_contentProvider = NULL; CYTHON_UNUSED PyObject *__pyx_v_e = NULL; zim::writer::ContentProvider *__pyx_r; __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; ContentProviderWrapper *__pyx_t_7; 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; std::string __pyx_t_15; int __pyx_t_16; char const *__pyx_t_17; PyObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; PyObject *__pyx_t_20 = NULL; PyObject *__pyx_t_21 = NULL; PyObject *__pyx_t_22 = NULL; PyObject *__pyx_t_23 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("contentprovider_cy_call_fct", 0); __Pyx_INCREF(__pyx_v_obj); /* "libzim.pyx":120 * zim.ContentProvider* contentprovider_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning a ContentProvider""" * try: # <<<<<<<<<<<<<< * contentProvider = call_method(obj, method) * if not contentProvider: */ { __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:*/ { /* "libzim.pyx":121 * """Lookup and execute a pure virtual method on object returning a ContentProvider""" * try: * contentProvider = call_method(obj, method) # <<<<<<<<<<<<<< * if not contentProvider: * raise RuntimeError("ContentProvider is None") */ __pyx_t_4 = __pyx_f_6libzim_call_method(__pyx_v_obj, __pyx_v_method); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __pyx_v_contentProvider = __pyx_t_4; __pyx_t_4 = 0; /* "libzim.pyx":122 * try: * contentProvider = call_method(obj, method) * if not contentProvider: # <<<<<<<<<<<<<< * raise RuntimeError("ContentProvider is None") * return new zim.ContentProviderWrapper(contentProvider) */ __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_contentProvider); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 122, __pyx_L3_error) __pyx_t_6 = ((!__pyx_t_5) != 0); if (unlikely(__pyx_t_6)) { /* "libzim.pyx":123 * contentProvider = call_method(obj, method) * if not contentProvider: * raise RuntimeError("ContentProvider is None") # <<<<<<<<<<<<<< * return new zim.ContentProviderWrapper(contentProvider) * except Exception as e: */ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L3_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, 123, __pyx_L3_error) /* "libzim.pyx":122 * try: * contentProvider = call_method(obj, method) * if not contentProvider: # <<<<<<<<<<<<<< * raise RuntimeError("ContentProvider is None") * return new zim.ContentProviderWrapper(contentProvider) */ } /* "libzim.pyx":124 * if not contentProvider: * raise RuntimeError("ContentProvider is None") * return new zim.ContentProviderWrapper(contentProvider) # <<<<<<<<<<<<<< * except Exception as e: * error[0] = traceback.format_exc().encode('UTF-8') */ try { __pyx_t_7 = new ContentProviderWrapper(((PyObject *)__pyx_v_contentProvider)); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 124, __pyx_L3_error) } __pyx_r = __pyx_t_7; goto __pyx_L7_try_return; /* "libzim.pyx":120 * zim.ContentProvider* contentprovider_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning a ContentProvider""" * try: # <<<<<<<<<<<<<< * contentProvider = call_method(obj, method) * if not contentProvider: */ } __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; /* "libzim.pyx":125 * raise RuntimeError("ContentProvider is None") * return new zim.ContentProviderWrapper(contentProvider) * except Exception as e: # <<<<<<<<<<<<<< * error[0] = traceback.format_exc().encode('UTF-8') * */ __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_8) { __Pyx_AddTraceback("libzim.contentprovider_cy_call_fct", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(0, 125, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_9); __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_v_e = __pyx_t_9; /*try:*/ { /* "libzim.pyx":126 * return new zim.ContentProviderWrapper(contentProvider) * except Exception as e: * error[0] = traceback.format_exc().encode('UTF-8') # <<<<<<<<<<<<<< * * return NULL */ __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_traceback); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 126, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 126, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_14); __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); } } __pyx_t_12 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_14); __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 126, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_encode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 126, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) { __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_14); if (likely(__pyx_t_12)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_14, function); } } __pyx_t_11 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_12, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_kp_u_UTF_8); __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 126, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_15 = __pyx_convert_string_from_py_std__in_string(__pyx_t_11); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L15_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; (__pyx_v_error[0]) = __pyx_t_15; } /* "libzim.pyx":125 * raise RuntimeError("ContentProvider is None") * return new zim.ContentProviderWrapper(contentProvider) * except Exception as e: # <<<<<<<<<<<<<< * error[0] = traceback.format_exc().encode('UTF-8') * */ /*finally:*/ { /*normal exit:*/{ __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; goto __pyx_L16; } __pyx_L15_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __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; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __Pyx_XGOTREF(__pyx_t_20); __Pyx_XGOTREF(__pyx_t_21); __Pyx_XGOTREF(__pyx_t_22); __Pyx_XGOTREF(__pyx_t_23); __pyx_t_8 = __pyx_lineno; __pyx_t_16 = __pyx_clineno; __pyx_t_17 = __pyx_filename; { __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_21); __Pyx_XGIVEREF(__pyx_t_22); __Pyx_XGIVEREF(__pyx_t_23); __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23); } __Pyx_XGIVEREF(__pyx_t_18); __Pyx_XGIVEREF(__pyx_t_19); __Pyx_XGIVEREF(__pyx_t_20); __Pyx_ErrRestore(__pyx_t_18, __pyx_t_19, __pyx_t_20); __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_16; __pyx_filename = __pyx_t_17; goto __pyx_L5_except_error; } __pyx_L16:; } __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L4_exception_handled; } goto __pyx_L5_except_error; __pyx_L5_except_error:; /* "libzim.pyx":120 * zim.ContentProvider* contentprovider_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning a ContentProvider""" * try: # <<<<<<<<<<<<<< * contentProvider = call_method(obj, method) * if not contentProvider: */ __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_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_L4_exception_handled:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); } /* "libzim.pyx":128 * error[0] = traceback.format_exc().encode('UTF-8') * * return NULL # <<<<<<<<<<<<<< * * zim.IndexData* indexdata_cy_call_fct(object obj, string method, string *error) with gil: */ __pyx_r = NULL; goto __pyx_L0; /* "libzim.pyx":118 * return move(zim.Blob()) * * zim.ContentProvider* contentprovider_cy_call_fct(object obj, string method, string *error) with gil: # <<<<<<<<<<<<<< * """Lookup and execute a pure virtual method on object returning a ContentProvider""" * try: */ /* function exit code */ __pyx_L1_error:; __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_WriteUnraisable("libzim.contentprovider_cy_call_fct", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_contentProvider); __Pyx_XDECREF(__pyx_v_e); __Pyx_XDECREF(__pyx_v_obj); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif return __pyx_r; } /* "libzim.pyx":130 * return NULL * * zim.IndexData* indexdata_cy_call_fct(object obj, string method, string *error) with gil: # <<<<<<<<<<<<<< * """Lookup and execute a pure virtual method on object returning a IndexData""" * try: */ zim::writer::IndexData *indexdata_cy_call_fct(PyObject *__pyx_v_obj, std::string __pyx_v_method, std::string *__pyx_v_error) { PyObject *__pyx_v_indexData = NULL; CYTHON_UNUSED PyObject *__pyx_v_e = NULL; zim::writer::IndexData *__pyx_r; __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; IndexDataWrapper *__pyx_t_7; 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; std::string __pyx_t_15; int __pyx_t_16; char const *__pyx_t_17; PyObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; PyObject *__pyx_t_20 = NULL; PyObject *__pyx_t_21 = NULL; PyObject *__pyx_t_22 = NULL; PyObject *__pyx_t_23 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("indexdata_cy_call_fct", 0); __Pyx_INCREF(__pyx_v_obj); /* "libzim.pyx":132 * zim.IndexData* indexdata_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning a IndexData""" * try: # <<<<<<<<<<<<<< * indexData = call_method(obj, method) * if not indexData: */ { __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:*/ { /* "libzim.pyx":133 * """Lookup and execute a pure virtual method on object returning a IndexData""" * try: * indexData = call_method(obj, method) # <<<<<<<<<<<<<< * if not indexData: * # indexData is none */ __pyx_t_4 = __pyx_f_6libzim_call_method(__pyx_v_obj, __pyx_v_method); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __pyx_v_indexData = __pyx_t_4; __pyx_t_4 = 0; /* "libzim.pyx":134 * try: * indexData = call_method(obj, method) * if not indexData: # <<<<<<<<<<<<<< * # indexData is none * return NULL; */ __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_indexData); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 134, __pyx_L3_error) __pyx_t_6 = ((!__pyx_t_5) != 0); if (__pyx_t_6) { /* "libzim.pyx":136 * if not indexData: * # indexData is none * return NULL; # <<<<<<<<<<<<<< * return new zim.IndexDataWrapper(indexData) * except Exception as e: */ __pyx_r = NULL; goto __pyx_L7_try_return; /* "libzim.pyx":134 * try: * indexData = call_method(obj, method) * if not indexData: # <<<<<<<<<<<<<< * # indexData is none * return NULL; */ } /* "libzim.pyx":137 * # indexData is none * return NULL; * return new zim.IndexDataWrapper(indexData) # <<<<<<<<<<<<<< * except Exception as e: * error[0] = traceback.format_exc().encode('UTF-8') */ try { __pyx_t_7 = new IndexDataWrapper(((PyObject *)__pyx_v_indexData)); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 137, __pyx_L3_error) } __pyx_r = __pyx_t_7; goto __pyx_L7_try_return; /* "libzim.pyx":132 * zim.IndexData* indexdata_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning a IndexData""" * try: # <<<<<<<<<<<<<< * indexData = call_method(obj, method) * if not indexData: */ } __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; /* "libzim.pyx":138 * return NULL; * return new zim.IndexDataWrapper(indexData) * except Exception as e: # <<<<<<<<<<<<<< * error[0] = traceback.format_exc().encode('UTF-8') * */ __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_8) { __Pyx_AddTraceback("libzim.indexdata_cy_call_fct", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(0, 138, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_9); __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_v_e = __pyx_t_9; /*try:*/ { /* "libzim.pyx":139 * return new zim.IndexDataWrapper(indexData) * except Exception as e: * error[0] = traceback.format_exc().encode('UTF-8') # <<<<<<<<<<<<<< * * return NULL */ __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_traceback); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 139, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 139, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_14); __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); } } __pyx_t_12 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_14); __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 139, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_encode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 139, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) { __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_14); if (likely(__pyx_t_12)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_14, function); } } __pyx_t_11 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_12, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_kp_u_UTF_8); __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 139, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_15 = __pyx_convert_string_from_py_std__in_string(__pyx_t_11); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L15_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; (__pyx_v_error[0]) = __pyx_t_15; } /* "libzim.pyx":138 * return NULL; * return new zim.IndexDataWrapper(indexData) * except Exception as e: # <<<<<<<<<<<<<< * error[0] = traceback.format_exc().encode('UTF-8') * */ /*finally:*/ { /*normal exit:*/{ __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; goto __pyx_L16; } __pyx_L15_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __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; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __Pyx_XGOTREF(__pyx_t_20); __Pyx_XGOTREF(__pyx_t_21); __Pyx_XGOTREF(__pyx_t_22); __Pyx_XGOTREF(__pyx_t_23); __pyx_t_8 = __pyx_lineno; __pyx_t_16 = __pyx_clineno; __pyx_t_17 = __pyx_filename; { __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_21); __Pyx_XGIVEREF(__pyx_t_22); __Pyx_XGIVEREF(__pyx_t_23); __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23); } __Pyx_XGIVEREF(__pyx_t_18); __Pyx_XGIVEREF(__pyx_t_19); __Pyx_XGIVEREF(__pyx_t_20); __Pyx_ErrRestore(__pyx_t_18, __pyx_t_19, __pyx_t_20); __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_16; __pyx_filename = __pyx_t_17; goto __pyx_L5_except_error; } __pyx_L16:; } __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L4_exception_handled; } goto __pyx_L5_except_error; __pyx_L5_except_error:; /* "libzim.pyx":132 * zim.IndexData* indexdata_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning a IndexData""" * try: # <<<<<<<<<<<<<< * indexData = call_method(obj, method) * if not indexData: */ __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_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_L4_exception_handled:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); } /* "libzim.pyx":141 * error[0] = traceback.format_exc().encode('UTF-8') * * return NULL # <<<<<<<<<<<<<< * * bool bool_cy_call_fct(object obj, string method, string *error) with gil: */ __pyx_r = NULL; goto __pyx_L0; /* "libzim.pyx":130 * return NULL * * zim.IndexData* indexdata_cy_call_fct(object obj, string method, string *error) with gil: # <<<<<<<<<<<<<< * """Lookup and execute a pure virtual method on object returning a IndexData""" * try: */ /* function exit code */ __pyx_L1_error:; __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_WriteUnraisable("libzim.indexdata_cy_call_fct", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_indexData); __Pyx_XDECREF(__pyx_v_e); __Pyx_XDECREF(__pyx_v_obj); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif return __pyx_r; } /* "libzim.pyx":143 * return NULL * * bool bool_cy_call_fct(object obj, string method, string *error) with gil: # <<<<<<<<<<<<<< * """Lookup and execute a pure virtual method on object returning a bool""" * try: */ bool bool_cy_call_fct(PyObject *__pyx_v_obj, std::string __pyx_v_method, std::string *__pyx_v_error) { CYTHON_UNUSED PyObject *__pyx_v_e = NULL; bool __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; bool __pyx_t_5; 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; std::string __pyx_t_13; int __pyx_t_14; char const *__pyx_t_15; PyObject *__pyx_t_16 = NULL; PyObject *__pyx_t_17 = NULL; PyObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; PyObject *__pyx_t_20 = NULL; PyObject *__pyx_t_21 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("bool_cy_call_fct", 0); __Pyx_INCREF(__pyx_v_obj); /* "libzim.pyx":145 * bool bool_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning a bool""" * try: # <<<<<<<<<<<<<< * return call_method(obj, method) * except Exception as e: */ { __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:*/ { /* "libzim.pyx":146 * """Lookup and execute a pure virtual method on object returning a bool""" * try: * return call_method(obj, method) # <<<<<<<<<<<<<< * except Exception as e: * error[0] = traceback.format_exc().encode('UTF-8') */ __pyx_t_4 = __pyx_f_6libzim_call_method(__pyx_v_obj, __pyx_v_method); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 146, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 146, __pyx_L3_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_5; goto __pyx_L7_try_return; /* "libzim.pyx":145 * bool bool_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning a bool""" * try: # <<<<<<<<<<<<<< * return call_method(obj, method) * except Exception as e: */ } __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; /* "libzim.pyx":147 * try: * return call_method(obj, method) * except Exception as e: # <<<<<<<<<<<<<< * error[0] = traceback.format_exc().encode('UTF-8') * */ __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_6) { __Pyx_AddTraceback("libzim.bool_cy_call_fct", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(0, 147, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_v_e = __pyx_t_7; /*try:*/ { /* "libzim.pyx":148 * return call_method(obj, method) * except Exception as e: * error[0] = traceback.format_exc().encode('UTF-8') # <<<<<<<<<<<<<< * * return False */ __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 148, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 148, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) { __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12); if (likely(__pyx_t_11)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_12, function); } } __pyx_t_10 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_12); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 148, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_encode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 148, __pyx_L14_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_12))) { __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_12); if (likely(__pyx_t_10)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_12, function); } } __pyx_t_9 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_10, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_kp_u_UTF_8); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 148, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_t_9); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 148, __pyx_L14_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; (__pyx_v_error[0]) = __pyx_t_13; } /* "libzim.pyx":147 * try: * return call_method(obj, method) * except Exception as e: # <<<<<<<<<<<<<< * error[0] = traceback.format_exc().encode('UTF-8') * */ /*finally:*/ { /*normal exit:*/{ __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; goto __pyx_L15; } __pyx_L14_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __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; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18) < 0)) __Pyx_ErrFetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __Pyx_XGOTREF(__pyx_t_20); __Pyx_XGOTREF(__pyx_t_21); __pyx_t_6 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_15 = __pyx_filename; { __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_19); __Pyx_XGIVEREF(__pyx_t_20); __Pyx_XGIVEREF(__pyx_t_21); __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21); } __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_ErrRestore(__pyx_t_16, __pyx_t_17, __pyx_t_18); __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_15; goto __pyx_L5_except_error; } __pyx_L15:; } __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L4_exception_handled; } goto __pyx_L5_except_error; __pyx_L5_except_error:; /* "libzim.pyx":145 * bool bool_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning a bool""" * try: # <<<<<<<<<<<<<< * return call_method(obj, method) * except Exception as e: */ __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_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_L4_exception_handled:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); } /* "libzim.pyx":150 * error[0] = traceback.format_exc().encode('UTF-8') * * return False # <<<<<<<<<<<<<< * * uint64_t uint64_cy_call_fct(object obj, string method, string *error) with gil: */ __pyx_r = 0; goto __pyx_L0; /* "libzim.pyx":143 * return NULL * * bool bool_cy_call_fct(object obj, string method, string *error) with gil: # <<<<<<<<<<<<<< * """Lookup and execute a pure virtual method on object returning a bool""" * try: */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __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_WriteUnraisable("libzim.bool_cy_call_fct", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_e); __Pyx_XDECREF(__pyx_v_obj); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif return __pyx_r; } /* "libzim.pyx":152 * return False * * uint64_t uint64_cy_call_fct(object obj, string method, string *error) with gil: # <<<<<<<<<<<<<< * """Lookup and execute a pure virtual method on object returning an uint64_t""" * try: */ uint64_t uint64_cy_call_fct(PyObject *__pyx_v_obj, std::string __pyx_v_method, std::string *__pyx_v_error) { CYTHON_UNUSED PyObject *__pyx_v_e = NULL; uint64_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; uint64_t __pyx_t_5; 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; std::string __pyx_t_13; int __pyx_t_14; char const *__pyx_t_15; PyObject *__pyx_t_16 = NULL; PyObject *__pyx_t_17 = NULL; PyObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; PyObject *__pyx_t_20 = NULL; PyObject *__pyx_t_21 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("uint64_cy_call_fct", 0); __Pyx_INCREF(__pyx_v_obj); /* "libzim.pyx":154 * uint64_t uint64_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning an uint64_t""" * try: # <<<<<<<<<<<<<< * return call_method(obj, method) * except Exception as e: */ { __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:*/ { /* "libzim.pyx":155 * """Lookup and execute a pure virtual method on object returning an uint64_t""" * try: * return call_method(obj, method) # <<<<<<<<<<<<<< * except Exception as e: * error[0] = traceback.format_exc().encode('UTF-8') */ __pyx_t_4 = __pyx_f_6libzim_call_method(__pyx_v_obj, __pyx_v_method); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 155, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyInt_As_uint64_t(__pyx_t_4); if (unlikely((__pyx_t_5 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L3_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = ((uint64_t)__pyx_t_5); goto __pyx_L7_try_return; /* "libzim.pyx":154 * uint64_t uint64_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning an uint64_t""" * try: # <<<<<<<<<<<<<< * return call_method(obj, method) * except Exception as e: */ } __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; /* "libzim.pyx":156 * try: * return call_method(obj, method) * except Exception as e: # <<<<<<<<<<<<<< * error[0] = traceback.format_exc().encode('UTF-8') * */ __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_6) { __Pyx_AddTraceback("libzim.uint64_cy_call_fct", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(0, 156, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_v_e = __pyx_t_7; /*try:*/ { /* "libzim.pyx":157 * return call_method(obj, method) * except Exception as e: * error[0] = traceback.format_exc().encode('UTF-8') # <<<<<<<<<<<<<< * * return 0 */ __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 157, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 157, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) { __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12); if (likely(__pyx_t_11)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_12, function); } } __pyx_t_10 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_12); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 157, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_encode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 157, __pyx_L14_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_12))) { __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_12); if (likely(__pyx_t_10)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_12, function); } } __pyx_t_9 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_10, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_kp_u_UTF_8); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 157, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_t_9); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 157, __pyx_L14_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; (__pyx_v_error[0]) = __pyx_t_13; } /* "libzim.pyx":156 * try: * return call_method(obj, method) * except Exception as e: # <<<<<<<<<<<<<< * error[0] = traceback.format_exc().encode('UTF-8') * */ /*finally:*/ { /*normal exit:*/{ __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; goto __pyx_L15; } __pyx_L14_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __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; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18) < 0)) __Pyx_ErrFetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __Pyx_XGOTREF(__pyx_t_20); __Pyx_XGOTREF(__pyx_t_21); __pyx_t_6 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_15 = __pyx_filename; { __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_19); __Pyx_XGIVEREF(__pyx_t_20); __Pyx_XGIVEREF(__pyx_t_21); __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21); } __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_ErrRestore(__pyx_t_16, __pyx_t_17, __pyx_t_18); __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_15; goto __pyx_L5_except_error; } __pyx_L15:; } __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L4_exception_handled; } goto __pyx_L5_except_error; __pyx_L5_except_error:; /* "libzim.pyx":154 * uint64_t uint64_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning an uint64_t""" * try: # <<<<<<<<<<<<<< * return call_method(obj, method) * except Exception as e: */ __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_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_L4_exception_handled:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); } /* "libzim.pyx":159 * error[0] = traceback.format_exc().encode('UTF-8') * * return 0 # <<<<<<<<<<<<<< * * uint32_t uint32_cy_call_fct(object obj, string method, string *error) with gil: */ __pyx_r = 0; goto __pyx_L0; /* "libzim.pyx":152 * return False * * uint64_t uint64_cy_call_fct(object obj, string method, string *error) with gil: # <<<<<<<<<<<<<< * """Lookup and execute a pure virtual method on object returning an uint64_t""" * try: */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __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_WriteUnraisable("libzim.uint64_cy_call_fct", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_e); __Pyx_XDECREF(__pyx_v_obj); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif return __pyx_r; } /* "libzim.pyx":161 * return 0 * * uint32_t uint32_cy_call_fct(object obj, string method, string *error) with gil: # <<<<<<<<<<<<<< * """Lookup and execute a pure virtual method on object returning an uint_32""" * try: */ uint32_t uint32_cy_call_fct(PyObject *__pyx_v_obj, std::string __pyx_v_method, std::string *__pyx_v_error) { CYTHON_UNUSED PyObject *__pyx_v_e = NULL; uint32_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; uint32_t __pyx_t_5; 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; std::string __pyx_t_13; int __pyx_t_14; char const *__pyx_t_15; PyObject *__pyx_t_16 = NULL; PyObject *__pyx_t_17 = NULL; PyObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; PyObject *__pyx_t_20 = NULL; PyObject *__pyx_t_21 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("uint32_cy_call_fct", 0); __Pyx_INCREF(__pyx_v_obj); /* "libzim.pyx":163 * uint32_t uint32_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning an uint_32""" * try: # <<<<<<<<<<<<<< * return call_method(obj, method) * except Exception as e: */ { __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:*/ { /* "libzim.pyx":164 * """Lookup and execute a pure virtual method on object returning an uint_32""" * try: * return call_method(obj, method) # <<<<<<<<<<<<<< * except Exception as e: * error[0] = traceback.format_exc().encode('UTF-8') */ __pyx_t_4 = __pyx_f_6libzim_call_method(__pyx_v_obj, __pyx_v_method); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 164, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyInt_As_uint32_t(__pyx_t_4); if (unlikely((__pyx_t_5 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 164, __pyx_L3_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = ((uint32_t)__pyx_t_5); goto __pyx_L7_try_return; /* "libzim.pyx":163 * uint32_t uint32_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning an uint_32""" * try: # <<<<<<<<<<<<<< * return call_method(obj, method) * except Exception as e: */ } __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; /* "libzim.pyx":165 * try: * return call_method(obj, method) * except Exception as e: # <<<<<<<<<<<<<< * error[0] = traceback.format_exc().encode('UTF-8') * */ __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_6) { __Pyx_AddTraceback("libzim.uint32_cy_call_fct", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(0, 165, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_v_e = __pyx_t_7; /*try:*/ { /* "libzim.pyx":166 * return call_method(obj, method) * except Exception as e: * error[0] = traceback.format_exc().encode('UTF-8') # <<<<<<<<<<<<<< * * return 0 */ __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 166, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 166, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) { __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12); if (likely(__pyx_t_11)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_12, function); } } __pyx_t_10 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_12); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 166, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_encode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 166, __pyx_L14_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_12))) { __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_12); if (likely(__pyx_t_10)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_12, function); } } __pyx_t_9 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_10, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_kp_u_UTF_8); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 166, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_13 = __pyx_convert_string_from_py_std__in_string(__pyx_t_9); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L14_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; (__pyx_v_error[0]) = __pyx_t_13; } /* "libzim.pyx":165 * try: * return call_method(obj, method) * except Exception as e: # <<<<<<<<<<<<<< * error[0] = traceback.format_exc().encode('UTF-8') * */ /*finally:*/ { /*normal exit:*/{ __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; goto __pyx_L15; } __pyx_L14_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __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; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18) < 0)) __Pyx_ErrFetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __Pyx_XGOTREF(__pyx_t_20); __Pyx_XGOTREF(__pyx_t_21); __pyx_t_6 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_15 = __pyx_filename; { __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_19); __Pyx_XGIVEREF(__pyx_t_20); __Pyx_XGIVEREF(__pyx_t_21); __Pyx_ExceptionReset(__pyx_t_19, __pyx_t_20, __pyx_t_21); } __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_ErrRestore(__pyx_t_16, __pyx_t_17, __pyx_t_18); __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_15; goto __pyx_L5_except_error; } __pyx_L15:; } __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L4_exception_handled; } goto __pyx_L5_except_error; __pyx_L5_except_error:; /* "libzim.pyx":163 * uint32_t uint32_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning an uint_32""" * try: # <<<<<<<<<<<<<< * return call_method(obj, method) * except Exception as e: */ __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_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_L4_exception_handled:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); } /* "libzim.pyx":168 * error[0] = traceback.format_exc().encode('UTF-8') * * return 0 # <<<<<<<<<<<<<< * * zim.GeoPosition geoposition_cy_call_fct(object obj, string method, string *error) with gil: */ __pyx_r = 0; goto __pyx_L0; /* "libzim.pyx":161 * return 0 * * uint32_t uint32_cy_call_fct(object obj, string method, string *error) with gil: # <<<<<<<<<<<<<< * """Lookup and execute a pure virtual method on object returning an uint_32""" * try: */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __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_WriteUnraisable("libzim.uint32_cy_call_fct", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_e); __Pyx_XDECREF(__pyx_v_obj); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif return __pyx_r; } /* "libzim.pyx":170 * return 0 * * zim.GeoPosition geoposition_cy_call_fct(object obj, string method, string *error) with gil: # <<<<<<<<<<<<<< * """Lookup and execute a pure virtual method on object returning a GeoPosition""" * try: */ zim::writer::IndexData::GeoPosition geoposition_cy_call_fct(PyObject *__pyx_v_obj, std::string __pyx_v_method, std::string *__pyx_v_error) { PyObject *__pyx_v_geoPosition = NULL; CYTHON_UNUSED PyObject *__pyx_v_e = NULL; zim::writer::IndexData::GeoPosition __pyx_r; __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; double __pyx_t_6; double __pyx_t_7; 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; std::string __pyx_t_15; int __pyx_t_16; char const *__pyx_t_17; PyObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; PyObject *__pyx_t_20 = NULL; PyObject *__pyx_t_21 = NULL; PyObject *__pyx_t_22 = NULL; PyObject *__pyx_t_23 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("geoposition_cy_call_fct", 0); __Pyx_INCREF(__pyx_v_obj); /* "libzim.pyx":172 * zim.GeoPosition geoposition_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning a GeoPosition""" * try: # <<<<<<<<<<<<<< * geoPosition = call_method(obj, method) * if geoPosition: */ { __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:*/ { /* "libzim.pyx":173 * """Lookup and execute a pure virtual method on object returning a GeoPosition""" * try: * geoPosition = call_method(obj, method) # <<<<<<<<<<<<<< * if geoPosition: * return zim.GeoPosition(True, geoPosition[0], geoPosition[1]); */ __pyx_t_4 = __pyx_f_6libzim_call_method(__pyx_v_obj, __pyx_v_method); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 173, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __pyx_v_geoPosition = __pyx_t_4; __pyx_t_4 = 0; /* "libzim.pyx":174 * try: * geoPosition = call_method(obj, method) * if geoPosition: # <<<<<<<<<<<<<< * return zim.GeoPosition(True, geoPosition[0], geoPosition[1]); * except Exception as e: */ __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_geoPosition); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 174, __pyx_L3_error) if (__pyx_t_5) { /* "libzim.pyx":175 * geoPosition = call_method(obj, method) * if geoPosition: * return zim.GeoPosition(True, geoPosition[0], geoPosition[1]); # <<<<<<<<<<<<<< * except Exception as e: * error[0] = traceback.format_exc().encode('UTF-8') */ __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_geoPosition, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 175, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L3_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_geoPosition, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 175, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L3_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = zim::writer::IndexData::GeoPosition(1, __pyx_t_6, __pyx_t_7); goto __pyx_L7_try_return; /* "libzim.pyx":174 * try: * geoPosition = call_method(obj, method) * if geoPosition: # <<<<<<<<<<<<<< * return zim.GeoPosition(True, geoPosition[0], geoPosition[1]); * except Exception as e: */ } /* "libzim.pyx":172 * zim.GeoPosition geoposition_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning a GeoPosition""" * try: # <<<<<<<<<<<<<< * geoPosition = call_method(obj, method) * if geoPosition: */ } __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_L8_try_end; __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; /* "libzim.pyx":176 * if geoPosition: * return zim.GeoPosition(True, geoPosition[0], geoPosition[1]); * except Exception as e: # <<<<<<<<<<<<<< * error[0] = traceback.format_exc().encode('UTF-8') * */ __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_8) { __Pyx_AddTraceback("libzim.geoposition_cy_call_fct", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(0, 176, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_9); __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_v_e = __pyx_t_9; /*try:*/ { /* "libzim.pyx":177 * return zim.GeoPosition(True, geoPosition[0], geoPosition[1]); * except Exception as e: * error[0] = traceback.format_exc().encode('UTF-8') # <<<<<<<<<<<<<< * * return zim.GeoPosition(False, 0, 0) */ __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_traceback); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 177, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 177, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_14); __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); } } __pyx_t_12 = (__pyx_t_13) ? __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13) : __Pyx_PyObject_CallNoArg(__pyx_t_14); __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 177, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_encode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 177, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) { __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_14); if (likely(__pyx_t_12)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14); __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_14, function); } } __pyx_t_11 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_12, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_kp_u_UTF_8); __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 177, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_15 = __pyx_convert_string_from_py_std__in_string(__pyx_t_11); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L15_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; (__pyx_v_error[0]) = __pyx_t_15; } /* "libzim.pyx":176 * if geoPosition: * return zim.GeoPosition(True, geoPosition[0], geoPosition[1]); * except Exception as e: # <<<<<<<<<<<<<< * error[0] = traceback.format_exc().encode('UTF-8') * */ /*finally:*/ { /*normal exit:*/{ __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; goto __pyx_L16; } __pyx_L15_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __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; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20) < 0)) __Pyx_ErrFetch(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __Pyx_XGOTREF(__pyx_t_20); __Pyx_XGOTREF(__pyx_t_21); __Pyx_XGOTREF(__pyx_t_22); __Pyx_XGOTREF(__pyx_t_23); __pyx_t_8 = __pyx_lineno; __pyx_t_16 = __pyx_clineno; __pyx_t_17 = __pyx_filename; { __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_21); __Pyx_XGIVEREF(__pyx_t_22); __Pyx_XGIVEREF(__pyx_t_23); __Pyx_ExceptionReset(__pyx_t_21, __pyx_t_22, __pyx_t_23); } __Pyx_XGIVEREF(__pyx_t_18); __Pyx_XGIVEREF(__pyx_t_19); __Pyx_XGIVEREF(__pyx_t_20); __Pyx_ErrRestore(__pyx_t_18, __pyx_t_19, __pyx_t_20); __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_16; __pyx_filename = __pyx_t_17; goto __pyx_L5_except_error; } __pyx_L16:; } __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L4_exception_handled; } goto __pyx_L5_except_error; __pyx_L5_except_error:; /* "libzim.pyx":172 * zim.GeoPosition geoposition_cy_call_fct(object obj, string method, string *error) with gil: * """Lookup and execute a pure virtual method on object returning a GeoPosition""" * try: # <<<<<<<<<<<<<< * geoPosition = call_method(obj, method) * if geoPosition: */ __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_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_L4_exception_handled:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); __pyx_L8_try_end:; } /* "libzim.pyx":179 * error[0] = traceback.format_exc().encode('UTF-8') * * return zim.GeoPosition(False, 0, 0) # <<<<<<<<<<<<<< * * map[zim.HintKeys, uint64_t] convertToCppHints(dict hintsDict): */ __pyx_r = zim::writer::IndexData::GeoPosition(0, 0.0, 0.0); goto __pyx_L0; /* "libzim.pyx":170 * return 0 * * zim.GeoPosition geoposition_cy_call_fct(object obj, string method, string *error) with gil: # <<<<<<<<<<<<<< * """Lookup and execute a pure virtual method on object returning a GeoPosition""" * try: */ /* function exit code */ __pyx_L1_error:; __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_WriteUnraisable("libzim.geoposition_cy_call_fct", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __Pyx_pretend_to_initialize(&__pyx_r); __pyx_L0:; __Pyx_XDECREF(__pyx_v_geoPosition); __Pyx_XDECREF(__pyx_v_e); __Pyx_XDECREF(__pyx_v_obj); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif return __pyx_r; } /* "libzim.pyx":181 * return zim.GeoPosition(False, 0, 0) * * map[zim.HintKeys, uint64_t] convertToCppHints(dict hintsDict): # <<<<<<<<<<<<<< * """C++ Hints from Python dict""" * cdef map[zim.HintKeys, uint64_t] ret; */ std::map convertToCppHints(PyObject *__pyx_v_hintsDict) { std::map __pyx_v_ret; PyObject *__pyx_v_key = NULL; PyObject *__pyx_v_value = NULL; std::map __pyx_r; __Pyx_RefNannyDeclarations 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; uint64_t __pyx_t_8; zim::writer::HintKeys __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convertToCppHints", 0); /* "libzim.pyx":184 * """C++ Hints from Python dict""" * cdef map[zim.HintKeys, uint64_t] ret; * for key, value in hintsDict.items(): # <<<<<<<<<<<<<< * ret[key.value] = value * return ret */ __pyx_t_2 = 0; if (unlikely(__pyx_v_hintsDict == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); __PYX_ERR(0, 184, __pyx_L1_error) } __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_hintsDict, 1, __pyx_n_s_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 184, __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, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6); __pyx_t_6 = 0; /* "libzim.pyx":185 * cdef map[zim.HintKeys, uint64_t] ret; * for key, value in hintsDict.items(): * ret[key.value] = value # <<<<<<<<<<<<<< * return ret * */ __pyx_t_8 = __Pyx_PyInt_As_uint64_t(__pyx_v_value); if (unlikely((__pyx_t_8 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L1_error) __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_key, __pyx_n_s_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 185, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_9 = ((zim::writer::HintKeys)__Pyx_PyInt_As_zim_3a__3a_writer_3a__3a_HintKeys(__pyx_t_6)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; (__pyx_v_ret[__pyx_t_9]) = ((uint64_t)__pyx_t_8); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":186 * for key, value in hintsDict.items(): * ret[key.value] = value * return ret # <<<<<<<<<<<<<< * * map[zim.HintKeys, uint64_t] hints_cy_call_fct(object obj, string method, string* error) with gil: */ __pyx_r = __pyx_v_ret; goto __pyx_L0; /* "libzim.pyx":181 * return zim.GeoPosition(False, 0, 0) * * map[zim.HintKeys, uint64_t] convertToCppHints(dict hintsDict): # <<<<<<<<<<<<<< * """C++ Hints from Python dict""" * cdef map[zim.HintKeys, uint64_t] ret; */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_WriteUnraisable("libzim.convertToCppHints", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __Pyx_pretend_to_initialize(&__pyx_r); __pyx_L0:; __Pyx_XDECREF(__pyx_v_key); __Pyx_XDECREF(__pyx_v_value); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":188 * return ret * * map[zim.HintKeys, uint64_t] hints_cy_call_fct(object obj, string method, string* error) with gil: # <<<<<<<<<<<<<< * """Lookup and execute a pure virtual method on object returning Hints""" * cdef map[zim.HintKeys, uint64_t] ret; */ std::map hints_cy_call_fct(PyObject *__pyx_v_obj, std::string __pyx_v_method, std::string *__pyx_v_error) { std::map __pyx_v_ret; PyObject *__pyx_v_func = NULL; PyObject *__pyx_v_hintsDict = NULL; CYTHON_UNUSED PyObject *__pyx_v_e = NULL; PyObject *__pyx_7genexpr__pyx_v_k = NULL; PyObject *__pyx_7genexpr__pyx_v_v = NULL; std::map __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; Py_ssize_t __pyx_t_6; Py_ssize_t __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; int __pyx_t_14; PyObject *__pyx_t_15 = NULL; PyObject *__pyx_t_16 = NULL; std::string __pyx_t_17; char const *__pyx_t_18; PyObject *__pyx_t_19 = NULL; PyObject *__pyx_t_20 = NULL; PyObject *__pyx_t_21 = NULL; PyObject *__pyx_t_22 = NULL; PyObject *__pyx_t_23 = NULL; PyObject *__pyx_t_24 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("hints_cy_call_fct", 0); __Pyx_INCREF(__pyx_v_obj); /* "libzim.pyx":191 * """Lookup and execute a pure virtual method on object returning Hints""" * cdef map[zim.HintKeys, uint64_t] ret; * try: # <<<<<<<<<<<<<< * func = getattr(obj, method.decode('UTF-8')) * hintsDict = {k: pybool(v) for k, v in func().items() if isinstance(k, Hint)} */ { __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:*/ { /* "libzim.pyx":192 * cdef map[zim.HintKeys, uint64_t] ret; * try: * func = getattr(obj, method.decode('UTF-8')) # <<<<<<<<<<<<<< * hintsDict = {k: pybool(v) for k, v in func().items() if isinstance(k, Hint)} * return convertToCppHints(hintsDict) */ __pyx_t_4 = __Pyx_decode_cpp_string(__pyx_v_method, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 192, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_GetAttr(__pyx_v_obj, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 192, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_func = __pyx_t_5; __pyx_t_5 = 0; /* "libzim.pyx":193 * try: * func = getattr(obj, method.decode('UTF-8')) * hintsDict = {k: pybool(v) for k, v in func().items() if isinstance(k, Hint)} # <<<<<<<<<<<<<< * return convertToCppHints(hintsDict) * except Exception as e: */ { /* enter inner scope */ __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 193, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = 0; __Pyx_INCREF(__pyx_v_func); __pyx_t_10 = __pyx_v_func; __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); } } __pyx_t_9 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 193, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(__pyx_t_9 == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); __PYX_ERR(0, 193, __pyx_L11_error) } __pyx_t_10 = __Pyx_dict_iterator(__pyx_t_9, 0, __pyx_n_s_items, (&__pyx_t_7), (&__pyx_t_8)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 193, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = __pyx_t_10; __pyx_t_10 = 0; while (1) { __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_4, __pyx_t_7, &__pyx_t_6, &__pyx_t_10, &__pyx_t_9, NULL, __pyx_t_8); if (unlikely(__pyx_t_12 == 0)) break; if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 193, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GOTREF(__pyx_t_9); __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_k, __pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_v, __pyx_t_9); __pyx_t_9 = 0; __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_Hint); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 193, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_13 = PyObject_IsInstance(__pyx_7genexpr__pyx_v_k, __pyx_t_9); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 193, __pyx_L11_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_14 = (__pyx_t_13 != 0); if (__pyx_t_14) { __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_pybool); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 193, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_10); __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); } } __pyx_t_9 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_11, __pyx_7genexpr__pyx_v_v) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_7genexpr__pyx_v_v); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 193, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(PyDict_SetItem(__pyx_t_5, (PyObject*)__pyx_7genexpr__pyx_v_k, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 193, __pyx_L11_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k); __pyx_7genexpr__pyx_v_k = 0; __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); __pyx_7genexpr__pyx_v_v = 0; goto __pyx_L15_exit_scope; __pyx_L11_error:; __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k); __pyx_7genexpr__pyx_v_k = 0; __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); __pyx_7genexpr__pyx_v_v = 0; goto __pyx_L3_error; __pyx_L15_exit_scope:; } /* exit inner scope */ __pyx_v_hintsDict = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0; /* "libzim.pyx":194 * func = getattr(obj, method.decode('UTF-8')) * hintsDict = {k: pybool(v) for k, v in func().items() if isinstance(k, Hint)} * return convertToCppHints(hintsDict) # <<<<<<<<<<<<<< * except Exception as e: * error[0] = traceback.format_exc().encode('UTF-8') */ __pyx_r = convertToCppHints(__pyx_v_hintsDict); goto __pyx_L7_try_return; /* "libzim.pyx":191 * """Lookup and execute a pure virtual method on object returning Hints""" * cdef map[zim.HintKeys, uint64_t] ret; * try: # <<<<<<<<<<<<<< * func = getattr(obj, method.decode('UTF-8')) * hintsDict = {k: pybool(v) for k, v in func().items() if isinstance(k, Hint)} */ } __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; /* "libzim.pyx":195 * hintsDict = {k: pybool(v) for k, v in func().items() if isinstance(k, Hint)} * return convertToCppHints(hintsDict) * except Exception as e: # <<<<<<<<<<<<<< * error[0] = traceback.format_exc().encode('UTF-8') * */ __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_8) { __Pyx_AddTraceback("libzim.hints_cy_call_fct", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_9) < 0) __PYX_ERR(0, 195, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_v_e = __pyx_t_4; /*try:*/ { /* "libzim.pyx":196 * return convertToCppHints(hintsDict) * except Exception as e: * error[0] = traceback.format_exc().encode('UTF-8') # <<<<<<<<<<<<<< * * return ret */ __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_traceback); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 196, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_15); __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 196, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_15 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) { __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_16); if (likely(__pyx_t_15)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16); __Pyx_INCREF(__pyx_t_15); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_16, function); } } __pyx_t_11 = (__pyx_t_15) ? __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_15) : __Pyx_PyObject_CallNoArg(__pyx_t_16); __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 196, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_encode); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 196, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) { __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_16); if (likely(__pyx_t_11)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16); __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_16, function); } } __pyx_t_10 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_11, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_kp_u_UTF_8); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 196, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; __pyx_t_17 = __pyx_convert_string_from_py_std__in_string(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 196, __pyx_L21_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; (__pyx_v_error[0]) = __pyx_t_17; } /* "libzim.pyx":195 * hintsDict = {k: pybool(v) for k, v in func().items() if isinstance(k, Hint)} * return convertToCppHints(hintsDict) * except Exception as e: # <<<<<<<<<<<<<< * error[0] = traceback.format_exc().encode('UTF-8') * */ /*finally:*/ { /*normal exit:*/{ __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; goto __pyx_L22; } __pyx_L21_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_22, &__pyx_t_23, &__pyx_t_24); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21) < 0)) __Pyx_ErrFetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21); __Pyx_XGOTREF(__pyx_t_19); __Pyx_XGOTREF(__pyx_t_20); __Pyx_XGOTREF(__pyx_t_21); __Pyx_XGOTREF(__pyx_t_22); __Pyx_XGOTREF(__pyx_t_23); __Pyx_XGOTREF(__pyx_t_24); __pyx_t_8 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_18 = __pyx_filename; { __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_22); __Pyx_XGIVEREF(__pyx_t_23); __Pyx_XGIVEREF(__pyx_t_24); __Pyx_ExceptionReset(__pyx_t_22, __pyx_t_23, __pyx_t_24); } __Pyx_XGIVEREF(__pyx_t_19); __Pyx_XGIVEREF(__pyx_t_20); __Pyx_XGIVEREF(__pyx_t_21); __Pyx_ErrRestore(__pyx_t_19, __pyx_t_20, __pyx_t_21); __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_t_21 = 0; __pyx_t_22 = 0; __pyx_t_23 = 0; __pyx_t_24 = 0; __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_18; goto __pyx_L5_except_error; } __pyx_L22:; } __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L4_exception_handled; } goto __pyx_L5_except_error; __pyx_L5_except_error:; /* "libzim.pyx":191 * """Lookup and execute a pure virtual method on object returning Hints""" * cdef map[zim.HintKeys, uint64_t] ret; * try: # <<<<<<<<<<<<<< * func = getattr(obj, method.decode('UTF-8')) * hintsDict = {k: pybool(v) for k, v in func().items() if isinstance(k, Hint)} */ __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_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_L4_exception_handled:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); } /* "libzim.pyx":198 * error[0] = traceback.format_exc().encode('UTF-8') * * return ret # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_ret; goto __pyx_L0; /* "libzim.pyx":188 * return ret * * map[zim.HintKeys, uint64_t] hints_cy_call_fct(object obj, string method, string* error) with gil: # <<<<<<<<<<<<<< * """Lookup and execute a pure virtual method on object returning Hints""" * cdef map[zim.HintKeys, uint64_t] ret; */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_15); __Pyx_XDECREF(__pyx_t_16); __Pyx_WriteUnraisable("libzim.hints_cy_call_fct", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __Pyx_pretend_to_initialize(&__pyx_r); __pyx_L0:; __Pyx_XDECREF(__pyx_v_func); __Pyx_XDECREF(__pyx_v_hintsDict); __Pyx_XDECREF(__pyx_v_e); __Pyx_XDECREF(__pyx_7genexpr__pyx_v_k); __Pyx_XDECREF(__pyx_7genexpr__pyx_v_v); __Pyx_XDECREF(__pyx_v_obj); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif return __pyx_r; } /* "libzim.pyx":212 * cdef bytes ref_content * * def __cinit__(self, content: Union[str, bytes]): # <<<<<<<<<<<<<< * if isinstance(content, str): * self.ref_content = content.encode('UTF-8') */ /* Python wrapper */ static int __pyx_pw_6libzim_11WritingBlob_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6libzim_11WritingBlob_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_content = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_content,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); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_content)) != 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, "__cinit__") < 0)) __PYX_ERR(0, 212, __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_content = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 212, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim.WritingBlob.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6libzim_11WritingBlob___cinit__(((struct __pyx_obj_6libzim_WritingBlob *)__pyx_v_self), __pyx_v_content); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6libzim_11WritingBlob___cinit__(struct __pyx_obj_6libzim_WritingBlob *__pyx_v_self, PyObject *__pyx_v_content) { int __pyx_r; __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; char *__pyx_t_6; Py_ssize_t __pyx_t_7; wrapper::Blob __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); /* "libzim.pyx":213 * * def __cinit__(self, content: Union[str, bytes]): * if isinstance(content, str): # <<<<<<<<<<<<<< * self.ref_content = content.encode('UTF-8') * else: */ __pyx_t_1 = PyUnicode_Check(__pyx_v_content); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* "libzim.pyx":214 * def __cinit__(self, content: Union[str, bytes]): * if isinstance(content, str): * self.ref_content = content.encode('UTF-8') # <<<<<<<<<<<<<< * else: * self.ref_content = content */ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_content, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 214, __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); } } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_UTF_8); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->ref_content); __Pyx_DECREF(__pyx_v_self->ref_content); __pyx_v_self->ref_content = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; /* "libzim.pyx":213 * * def __cinit__(self, content: Union[str, bytes]): * if isinstance(content, str): # <<<<<<<<<<<<<< * self.ref_content = content.encode('UTF-8') * else: */ goto __pyx_L3; } /* "libzim.pyx":216 * self.ref_content = content.encode('UTF-8') * else: * self.ref_content = content # <<<<<<<<<<<<<< * self.c_blob = move(zim.Blob( self.ref_content, len(self.ref_content))) * */ /*else*/ { if (!(likely(PyBytes_CheckExact(__pyx_v_content))||((__pyx_v_content) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_content)->tp_name), 0))) __PYX_ERR(0, 216, __pyx_L1_error) __pyx_t_3 = __pyx_v_content; __Pyx_INCREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->ref_content); __Pyx_DECREF(__pyx_v_self->ref_content); __pyx_v_self->ref_content = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; } __pyx_L3:; /* "libzim.pyx":217 * else: * self.ref_content = content * self.c_blob = move(zim.Blob( self.ref_content, len(self.ref_content))) # <<<<<<<<<<<<<< * * def size(self): */ if (unlikely(__pyx_v_self->ref_content == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); __PYX_ERR(0, 217, __pyx_L1_error) } __pyx_t_6 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->ref_content); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L1_error) __pyx_t_3 = __pyx_v_self->ref_content; __Pyx_INCREF(__pyx_t_3); if (unlikely(__pyx_t_3 == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(0, 217, __pyx_L1_error) } __pyx_t_7 = PyBytes_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; try { __pyx_t_8 = wrapper::Blob(((char *)__pyx_t_6), __pyx_t_7); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 217, __pyx_L1_error) } __pyx_v_self->c_blob = cython_std::move(__pyx_t_8); /* "libzim.pyx":212 * cdef bytes ref_content * * def __cinit__(self, content: Union[str, bytes]): # <<<<<<<<<<<<<< * if isinstance(content, str): * self.ref_content = content.encode('UTF-8') */ /* 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_5); __Pyx_AddTraceback("libzim.WritingBlob.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":219 * self.c_blob = move(zim.Blob( self.ref_content, len(self.ref_content))) * * def size(self): # <<<<<<<<<<<<<< * return self.c_blob.size() * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_11WritingBlob_3size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_6libzim_11WritingBlob_3size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("size (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_11WritingBlob_2size(((struct __pyx_obj_6libzim_WritingBlob *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_11WritingBlob_2size(struct __pyx_obj_6libzim_WritingBlob *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations uint64_t __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("size", 0); /* "libzim.pyx":220 * * def size(self): * return self.c_blob.size() # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_blob.size(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 220, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":219 * self.c_blob = move(zim.Blob( self.ref_content, len(self.ref_content))) * * def size(self): # <<<<<<<<<<<<<< * return self.c_blob.size() * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.WritingBlob.size", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_11WritingBlob_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_6libzim_11WritingBlob_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_11WritingBlob_4__reduce_cython__(((struct __pyx_obj_6libzim_WritingBlob *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_11WritingBlob_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_WritingBlob *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.WritingBlob.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_11WritingBlob_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ static PyObject *__pyx_pw_6libzim_11WritingBlob_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_11WritingBlob_6__setstate_cython__(((struct __pyx_obj_6libzim_WritingBlob *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_11WritingBlob_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_WritingBlob *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.WritingBlob.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":257 * cdef object _started * * def __cinit__(self, object filename: pathlib.Path, *args, **kwargs): # <<<<<<<<<<<<<< * self._filename = pathlib.Path(filename) * self._started = False */ /* Python wrapper */ static int __pyx_pw_6libzim_8_Creator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6libzim_8_Creator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_filename = 0; CYTHON_UNUSED PyObject *__pyx_v_args = 0; CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; __Pyx_GOTREF(__pyx_v_kwargs); if (PyTuple_GET_SIZE(__pyx_args) > 1) { __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); if (unlikely(!__pyx_v_args)) { __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; __Pyx_RefNannyFinishContext(); return -1; } __Pyx_GOTREF(__pyx_v_args); } else { __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); } { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,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) { default: case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1; if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 257, __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_filename = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 257, __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("libzim._Creator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6libzim_8_Creator___cinit__(((struct __pyx_obj_6libzim__Creator *)__pyx_v_self), __pyx_v_filename, __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 int __pyx_pf_6libzim_8_Creator___cinit__(struct __pyx_obj_6libzim__Creator *__pyx_v_self, PyObject *__pyx_v_filename, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) { PyObject *__pyx_v_parent = NULL; int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; int __pyx_t_7; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); /* "libzim.pyx":258 * * def __cinit__(self, object filename: pathlib.Path, *args, **kwargs): * self._filename = pathlib.Path(filename) # <<<<<<<<<<<<<< * self._started = False * # fail early if destination is not writable */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pathlib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 258, __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); } } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_filename) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_filename); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->_filename); __Pyx_DECREF(__pyx_v_self->_filename); __pyx_v_self->_filename = __pyx_t_1; __pyx_t_1 = 0; /* "libzim.pyx":259 * def __cinit__(self, object filename: pathlib.Path, *args, **kwargs): * self._filename = pathlib.Path(filename) * self._started = False # <<<<<<<<<<<<<< * # fail early if destination is not writable * parent = self._filename.expanduser().resolve().parent */ __Pyx_INCREF(Py_False); __Pyx_GIVEREF(Py_False); __Pyx_GOTREF(__pyx_v_self->_started); __Pyx_DECREF(__pyx_v_self->_started); __pyx_v_self->_started = Py_False; /* "libzim.pyx":261 * self._started = False * # fail early if destination is not writable * parent = self._filename.expanduser().resolve().parent # <<<<<<<<<<<<<< * if not os.access(parent, mode=os.W_OK, effective_ids=(os.access in os.supports_effective_ids)): * raise IOError(f"Unable to write ZIM file at {self._filename}") */ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_filename, __pyx_n_s_expanduser); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __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); } } __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_resolve); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __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); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_parent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_parent = __pyx_t_2; __pyx_t_2 = 0; /* "libzim.pyx":262 * # fail early if destination is not writable * parent = self._filename.expanduser().resolve().parent * if not os.access(parent, mode=os.W_OK, effective_ids=(os.access in os.supports_effective_ids)): # <<<<<<<<<<<<<< * raise IOError(f"Unable to write ZIM file at {self._filename}") * */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_access); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 262, __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(0, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_parent); __Pyx_GIVEREF(__pyx_v_parent); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_parent); __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_os); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_W_OK); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_mode, __pyx_t_5) < 0) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_access); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_supports_effective_ids); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_t_4, __pyx_t_6, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_effective_ids, __pyx_t_6) < 0) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 262, __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 262, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_8 = ((!__pyx_t_7) != 0); if (unlikely(__pyx_t_8)) { /* "libzim.pyx":263 * parent = self._filename.expanduser().resolve().parent * if not os.access(parent, mode=os.W_OK, effective_ids=(os.access in os.supports_effective_ids)): * raise IOError(f"Unable to write ZIM file at {self._filename}") # <<<<<<<<<<<<<< * * def __init__(self, filename: pathlib.Path): */ __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_self->_filename, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Unable_to_write_ZIM_file_at, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IOError, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 263, __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(0, 263, __pyx_L1_error) /* "libzim.pyx":262 * # fail early if destination is not writable * parent = self._filename.expanduser().resolve().parent * if not os.access(parent, mode=os.W_OK, effective_ids=(os.access in os.supports_effective_ids)): # <<<<<<<<<<<<<< * raise IOError(f"Unable to write ZIM file at {self._filename}") * */ } /* "libzim.pyx":257 * cdef object _started * * def __cinit__(self, object filename: pathlib.Path, *args, **kwargs): # <<<<<<<<<<<<<< * self._filename = pathlib.Path(filename) * self._started = 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_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("libzim._Creator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_parent); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":265 * raise IOError(f"Unable to write ZIM file at {self._filename}") * * def __init__(self, filename: pathlib.Path): # <<<<<<<<<<<<<< * """Constructs a Creator for a ZIM file at path * */ /* Python wrapper */ static int __pyx_pw_6libzim_8_Creator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6libzim_8_Creator_2__init__[] = "Constructs a Creator for a ZIM file at path\n\n Parameters\n ----------\n filename : pathlib.Path\n Full path to a zim file"; #if CYTHON_UPDATE_DESCRIPTOR_DOC struct wrapperbase __pyx_wrapperbase_6libzim_8_Creator_2__init__; #endif static int __pyx_pw_6libzim_8_Creator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED PyObject *__pyx_v_filename = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,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); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 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, "__init__") < 0)) __PYX_ERR(0, 265, __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_filename = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 265, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim._Creator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6libzim_8_Creator_2__init__(((struct __pyx_obj_6libzim__Creator *)__pyx_v_self), __pyx_v_filename); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6libzim_8_Creator_2__init__(CYTHON_UNUSED struct __pyx_obj_6libzim__Creator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_filename) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":274 * pass * * def config_verbose(self, bool verbose: bool) -> Creator: # <<<<<<<<<<<<<< * """Set creator verbosity (inside libzim). Default is off""" * if self._started: */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_8_Creator_5config_verbose(PyObject *__pyx_v_self, PyObject *__pyx_arg_verbose); /*proto*/ static char __pyx_doc_6libzim_8_Creator_4config_verbose[] = "Set creator verbosity (inside libzim). Default is off"; static PyObject *__pyx_pw_6libzim_8_Creator_5config_verbose(PyObject *__pyx_v_self, PyObject *__pyx_arg_verbose) { bool __pyx_v_verbose; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("config_verbose (wrapper)", 0); assert(__pyx_arg_verbose); { __pyx_v_verbose = __Pyx_PyObject_IsTrue(__pyx_arg_verbose); if (unlikely((__pyx_v_verbose == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 274, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("libzim._Creator.config_verbose", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6libzim_8_Creator_4config_verbose(((struct __pyx_obj_6libzim__Creator *)__pyx_v_self), ((bool)__pyx_v_verbose)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_8_Creator_4config_verbose(struct __pyx_obj_6libzim__Creator *__pyx_v_self, bool __pyx_v_verbose) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("config_verbose", 0); /* "libzim.pyx":276 * def config_verbose(self, bool verbose: bool) -> Creator: * """Set creator verbosity (inside libzim). Default is off""" * if self._started: # <<<<<<<<<<<<<< * raise RuntimeError("Creator started") * self.c_creator.configVerbose(verbose) */ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_started); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 276, __pyx_L1_error) if (unlikely(__pyx_t_1)) { /* "libzim.pyx":277 * """Set creator verbosity (inside libzim). Default is off""" * if self._started: * raise RuntimeError("Creator started") # <<<<<<<<<<<<<< * self.c_creator.configVerbose(verbose) * return self */ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 277, __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, 277, __pyx_L1_error) /* "libzim.pyx":276 * def config_verbose(self, bool verbose: bool) -> Creator: * """Set creator verbosity (inside libzim). Default is off""" * if self._started: # <<<<<<<<<<<<<< * raise RuntimeError("Creator started") * self.c_creator.configVerbose(verbose) */ } /* "libzim.pyx":278 * if self._started: * raise RuntimeError("Creator started") * self.c_creator.configVerbose(verbose) # <<<<<<<<<<<<<< * return self * */ __pyx_v_self->c_creator.configVerbose(__pyx_v_verbose); /* "libzim.pyx":279 * raise RuntimeError("Creator started") * self.c_creator.configVerbose(verbose) * return self # <<<<<<<<<<<<<< * * def config_compression(self, compression: Compression) -> Creator: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; /* "libzim.pyx":274 * pass * * def config_verbose(self, bool verbose: bool) -> Creator: # <<<<<<<<<<<<<< * """Set creator verbosity (inside libzim). Default is off""" * if self._started: */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim._Creator.config_verbose", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":281 * return self * * def config_compression(self, compression: Compression) -> Creator: # <<<<<<<<<<<<<< * """Set compression algorithm to use. Check libzim for default * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_8_Creator_7config_compression(PyObject *__pyx_v_self, PyObject *__pyx_v_compression); /*proto*/ static char __pyx_doc_6libzim_8_Creator_6config_compression[] = "Set compression algorithm to use. Check libzim for default\n\n Fall 2021 default: zstd"; static PyObject *__pyx_pw_6libzim_8_Creator_7config_compression(PyObject *__pyx_v_self, PyObject *__pyx_v_compression) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("config_compression (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_8_Creator_6config_compression(((struct __pyx_obj_6libzim__Creator *)__pyx_v_self), ((PyObject *)__pyx_v_compression)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_8_Creator_6config_compression(struct __pyx_obj_6libzim__Creator *__pyx_v_self, PyObject *__pyx_v_compression) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("config_compression", 0); /* "libzim.pyx":285 * * Fall 2021 default: zstd""" * if self._started: # <<<<<<<<<<<<<< * raise RuntimeError("Creator started") * self.c_creator.configCompression(zim.comp_from_int(compression.value)) */ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_started); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 285, __pyx_L1_error) if (unlikely(__pyx_t_1)) { /* "libzim.pyx":286 * Fall 2021 default: zstd""" * if self._started: * raise RuntimeError("Creator started") # <<<<<<<<<<<<<< * self.c_creator.configCompression(zim.comp_from_int(compression.value)) * return self */ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 286, __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, 286, __pyx_L1_error) /* "libzim.pyx":285 * * Fall 2021 default: zstd""" * if self._started: # <<<<<<<<<<<<<< * raise RuntimeError("Creator started") * self.c_creator.configCompression(zim.comp_from_int(compression.value)) */ } /* "libzim.pyx":287 * if self._started: * raise RuntimeError("Creator started") * self.c_creator.configCompression(zim.comp_from_int(compression.value)) # <<<<<<<<<<<<<< * return self * */ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_compression, __pyx_n_s_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 287, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->c_creator.configCompression(comp_from_int(__pyx_t_3)); /* "libzim.pyx":288 * raise RuntimeError("Creator started") * self.c_creator.configCompression(zim.comp_from_int(compression.value)) * return self # <<<<<<<<<<<<<< * * def config_clustersize(self, int size: pyint) -> Creator: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; /* "libzim.pyx":281 * return self * * def config_compression(self, compression: Compression) -> Creator: # <<<<<<<<<<<<<< * """Set compression algorithm to use. Check libzim for default * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim._Creator.config_compression", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":290 * return self * * def config_clustersize(self, int size: pyint) -> Creator: # <<<<<<<<<<<<<< * """Set size of created clusters. Check libzim for default * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_8_Creator_9config_clustersize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size); /*proto*/ static char __pyx_doc_6libzim_8_Creator_8config_clustersize[] = "Set size of created clusters. Check libzim for default\n\n libzim will store at most this value per cluster before creating\n another one.\n Fall 2021 default: 2Mib"; static PyObject *__pyx_pw_6libzim_8_Creator_9config_clustersize(PyObject *__pyx_v_self, PyObject *__pyx_arg_size) { int __pyx_v_size; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("config_clustersize (wrapper)", 0); assert(__pyx_arg_size); { __pyx_v_size = __Pyx_PyInt_As_int(__pyx_arg_size); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 290, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("libzim._Creator.config_clustersize", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6libzim_8_Creator_8config_clustersize(((struct __pyx_obj_6libzim__Creator *)__pyx_v_self), ((int)__pyx_v_size)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_8_Creator_8config_clustersize(struct __pyx_obj_6libzim__Creator *__pyx_v_self, int __pyx_v_size) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("config_clustersize", 0); /* "libzim.pyx":296 * another one. * Fall 2021 default: 2Mib""" * if self._started: # <<<<<<<<<<<<<< * raise RuntimeError("Creator started") * self.c_creator.configClusterSize(size) */ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_started); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 296, __pyx_L1_error) if (unlikely(__pyx_t_1)) { /* "libzim.pyx":297 * Fall 2021 default: 2Mib""" * if self._started: * raise RuntimeError("Creator started") # <<<<<<<<<<<<<< * self.c_creator.configClusterSize(size) * return self */ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 297, __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, 297, __pyx_L1_error) /* "libzim.pyx":296 * another one. * Fall 2021 default: 2Mib""" * if self._started: # <<<<<<<<<<<<<< * raise RuntimeError("Creator started") * self.c_creator.configClusterSize(size) */ } /* "libzim.pyx":298 * if self._started: * raise RuntimeError("Creator started") * self.c_creator.configClusterSize(size) # <<<<<<<<<<<<<< * return self * */ __pyx_v_self->c_creator.configClusterSize(__pyx_v_size); /* "libzim.pyx":299 * raise RuntimeError("Creator started") * self.c_creator.configClusterSize(size) * return self # <<<<<<<<<<<<<< * * def config_indexing(self, bool indexing: bool, str language: str) -> Creator: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; /* "libzim.pyx":290 * return self * * def config_clustersize(self, int size: pyint) -> Creator: # <<<<<<<<<<<<<< * """Set size of created clusters. Check libzim for default * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim._Creator.config_clustersize", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":301 * return self * * def config_indexing(self, bool indexing: bool, str language: str) -> Creator: # <<<<<<<<<<<<<< * """Configure fulltext indexing feature * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_8_Creator_11config_indexing(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6libzim_8_Creator_10config_indexing[] = "Configure fulltext indexing feature\n\n indexing: whether to create a full-text index of the content\n language: language (ISO-639-3 code) to assume content in during indexation"; static PyObject *__pyx_pw_6libzim_8_Creator_11config_indexing(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { bool __pyx_v_indexing; PyObject *__pyx_v_language = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("config_indexing (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_indexing,&__pyx_n_s_language,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); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_indexing)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_language)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("config_indexing", 1, 2, 2, 1); __PYX_ERR(0, 301, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "config_indexing") < 0)) __PYX_ERR(0, 301, __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_indexing = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_indexing == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 301, __pyx_L3_error) __pyx_v_language = ((PyObject*)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("config_indexing", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 301, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim._Creator.config_indexing", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_language), (&PyUnicode_Type), 1, "language", 1))) __PYX_ERR(0, 301, __pyx_L1_error) __pyx_r = __pyx_pf_6libzim_8_Creator_10config_indexing(((struct __pyx_obj_6libzim__Creator *)__pyx_v_self), __pyx_v_indexing, __pyx_v_language); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_8_Creator_10config_indexing(struct __pyx_obj_6libzim__Creator *__pyx_v_self, bool __pyx_v_indexing, PyObject *__pyx_v_language) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; std::string __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("config_indexing", 0); /* "libzim.pyx":306 * indexing: whether to create a full-text index of the content * language: language (ISO-639-3 code) to assume content in during indexation""" * if self._started: # <<<<<<<<<<<<<< * raise RuntimeError("Creator started") * self.c_creator.configIndexing(indexing, language.encode('UTF-8')) */ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_started); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 306, __pyx_L1_error) if (unlikely(__pyx_t_1)) { /* "libzim.pyx":307 * language: language (ISO-639-3 code) to assume content in during indexation""" * if self._started: * raise RuntimeError("Creator started") # <<<<<<<<<<<<<< * self.c_creator.configIndexing(indexing, language.encode('UTF-8')) * return self */ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __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, 307, __pyx_L1_error) /* "libzim.pyx":306 * indexing: whether to create a full-text index of the content * language: language (ISO-639-3 code) to assume content in during indexation""" * if self._started: # <<<<<<<<<<<<<< * raise RuntimeError("Creator started") * self.c_creator.configIndexing(indexing, language.encode('UTF-8')) */ } /* "libzim.pyx":308 * if self._started: * raise RuntimeError("Creator started") * self.c_creator.configIndexing(indexing, language.encode('UTF-8')) # <<<<<<<<<<<<<< * return self * */ if (unlikely(__pyx_v_language == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 308, __pyx_L1_error) } __pyx_t_2 = PyUnicode_AsUTF8String(__pyx_v_language); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 308, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->c_creator.configIndexing(__pyx_v_indexing, __pyx_t_3); /* "libzim.pyx":309 * raise RuntimeError("Creator started") * self.c_creator.configIndexing(indexing, language.encode('UTF-8')) * return self # <<<<<<<<<<<<<< * * def config_nbworkers(self, int nbWorkers: pyint) -> Creator: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; /* "libzim.pyx":301 * return self * * def config_indexing(self, bool indexing: bool, str language: str) -> Creator: # <<<<<<<<<<<<<< * """Configure fulltext indexing feature * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim._Creator.config_indexing", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":311 * return self * * def config_nbworkers(self, int nbWorkers: pyint) -> Creator: # <<<<<<<<<<<<<< * """Number of thread to use for internal worker""" * if self._started: */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_8_Creator_13config_nbworkers(PyObject *__pyx_v_self, PyObject *__pyx_arg_nbWorkers); /*proto*/ static char __pyx_doc_6libzim_8_Creator_12config_nbworkers[] = "Number of thread to use for internal worker"; static PyObject *__pyx_pw_6libzim_8_Creator_13config_nbworkers(PyObject *__pyx_v_self, PyObject *__pyx_arg_nbWorkers) { int __pyx_v_nbWorkers; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("config_nbworkers (wrapper)", 0); assert(__pyx_arg_nbWorkers); { __pyx_v_nbWorkers = __Pyx_PyInt_As_int(__pyx_arg_nbWorkers); if (unlikely((__pyx_v_nbWorkers == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 311, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("libzim._Creator.config_nbworkers", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6libzim_8_Creator_12config_nbworkers(((struct __pyx_obj_6libzim__Creator *)__pyx_v_self), ((int)__pyx_v_nbWorkers)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_8_Creator_12config_nbworkers(struct __pyx_obj_6libzim__Creator *__pyx_v_self, int __pyx_v_nbWorkers) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("config_nbworkers", 0); /* "libzim.pyx":313 * def config_nbworkers(self, int nbWorkers: pyint) -> Creator: * """Number of thread to use for internal worker""" * if self._started: # <<<<<<<<<<<<<< * raise RuntimeError("Creator started") * self.c_creator.configNbWorkers(nbWorkers) */ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_started); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 313, __pyx_L1_error) if (unlikely(__pyx_t_1)) { /* "libzim.pyx":314 * """Number of thread to use for internal worker""" * if self._started: * raise RuntimeError("Creator started") # <<<<<<<<<<<<<< * self.c_creator.configNbWorkers(nbWorkers) * return self */ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __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, 314, __pyx_L1_error) /* "libzim.pyx":313 * def config_nbworkers(self, int nbWorkers: pyint) -> Creator: * """Number of thread to use for internal worker""" * if self._started: # <<<<<<<<<<<<<< * raise RuntimeError("Creator started") * self.c_creator.configNbWorkers(nbWorkers) */ } /* "libzim.pyx":315 * if self._started: * raise RuntimeError("Creator started") * self.c_creator.configNbWorkers(nbWorkers) # <<<<<<<<<<<<<< * return self * */ __pyx_v_self->c_creator.configNbWorkers(__pyx_v_nbWorkers); /* "libzim.pyx":316 * raise RuntimeError("Creator started") * self.c_creator.configNbWorkers(nbWorkers) * return self # <<<<<<<<<<<<<< * * def set_mainpath(self, str mainPath: str) -> Creator: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; /* "libzim.pyx":311 * return self * * def config_nbworkers(self, int nbWorkers: pyint) -> Creator: # <<<<<<<<<<<<<< * """Number of thread to use for internal worker""" * if self._started: */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim._Creator.config_nbworkers", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":318 * return self * * def set_mainpath(self, str mainPath: str) -> Creator: # <<<<<<<<<<<<<< * """Set path of the main entry""" * self.c_creator.setMainPath(mainPath.encode('UTF-8')) */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_8_Creator_15set_mainpath(PyObject *__pyx_v_self, PyObject *__pyx_v_mainPath); /*proto*/ static char __pyx_doc_6libzim_8_Creator_14set_mainpath[] = "Set path of the main entry"; static PyObject *__pyx_pw_6libzim_8_Creator_15set_mainpath(PyObject *__pyx_v_self, PyObject *__pyx_v_mainPath) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_mainpath (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mainPath), (&PyUnicode_Type), 1, "mainPath", 1))) __PYX_ERR(0, 318, __pyx_L1_error) __pyx_r = __pyx_pf_6libzim_8_Creator_14set_mainpath(((struct __pyx_obj_6libzim__Creator *)__pyx_v_self), ((PyObject*)__pyx_v_mainPath)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_8_Creator_14set_mainpath(struct __pyx_obj_6libzim__Creator *__pyx_v_self, PyObject *__pyx_v_mainPath) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; std::string __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_mainpath", 0); /* "libzim.pyx":320 * def set_mainpath(self, str mainPath: str) -> Creator: * """Set path of the main entry""" * self.c_creator.setMainPath(mainPath.encode('UTF-8')) # <<<<<<<<<<<<<< * return self * */ if (unlikely(__pyx_v_mainPath == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 320, __pyx_L1_error) } __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_mainPath); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 320, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->c_creator.setMainPath(__pyx_t_2); /* "libzim.pyx":321 * """Set path of the main entry""" * self.c_creator.setMainPath(mainPath.encode('UTF-8')) * return self # <<<<<<<<<<<<<< * * def add_illustration(self, int size: pyint, content: bytes): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; /* "libzim.pyx":318 * return self * * def set_mainpath(self, str mainPath: str) -> Creator: # <<<<<<<<<<<<<< * """Set path of the main entry""" * self.c_creator.setMainPath(mainPath.encode('UTF-8')) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim._Creator.set_mainpath", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":323 * return self * * def add_illustration(self, int size: pyint, content: bytes): # <<<<<<<<<<<<<< * """Add a PNG illustration to Archive * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_8_Creator_17add_illustration(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6libzim_8_Creator_16add_illustration[] = "Add a PNG illustration to Archive\n\n https://wiki.openzim.org/wiki/Metadata\n\n Raises\n ------\n RuntimeError\n If an Illustration exists with the same size"; static PyObject *__pyx_pw_6libzim_8_Creator_17add_illustration(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_size; PyObject *__pyx_v_content = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_illustration (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_content,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); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_content)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("add_illustration", 1, 2, 2, 1); __PYX_ERR(0, 323, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_illustration") < 0)) __PYX_ERR(0, 323, __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_size = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 323, __pyx_L3_error) __pyx_v_content = ((PyObject*)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("add_illustration", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 323, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim._Creator.add_illustration", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_content), (&PyBytes_Type), 1, "content", 1))) __PYX_ERR(0, 323, __pyx_L1_error) __pyx_r = __pyx_pf_6libzim_8_Creator_16add_illustration(((struct __pyx_obj_6libzim__Creator *)__pyx_v_self), __pyx_v_size, __pyx_v_content); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_8_Creator_16add_illustration(struct __pyx_obj_6libzim__Creator *__pyx_v_self, int __pyx_v_size, PyObject *__pyx_v_content) { std::string __pyx_v__content; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations std::string __pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("add_illustration", 0); /* "libzim.pyx":332 * RuntimeError * If an Illustration exists with the same size""" * cdef string _content = content # <<<<<<<<<<<<<< * self.c_creator.addIllustration(size, _content) * */ __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_content); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 332, __pyx_L1_error) __pyx_v__content = __pyx_t_1; /* "libzim.pyx":333 * If an Illustration exists with the same size""" * cdef string _content = content * self.c_creator.addIllustration(size, _content) # <<<<<<<<<<<<<< * * # def set_uuid(self, uuid) -> Creator: */ try { __pyx_v_self->c_creator.addIllustration(__pyx_v_size, __pyx_v__content); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 333, __pyx_L1_error) } /* "libzim.pyx":323 * return self * * def add_illustration(self, int size: pyint, content: bytes): # <<<<<<<<<<<<<< * """Add a PNG illustration to Archive * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("libzim._Creator.add_illustration", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":338 * # self.c_creator.setUuid(uuid) * * def add_item(self, writer_item not None: BaseWritingItem): # <<<<<<<<<<<<<< * """Add an item to the Creator object. * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_8_Creator_19add_item(PyObject *__pyx_v_self, PyObject *__pyx_v_writer_item); /*proto*/ static char __pyx_doc_6libzim_8_Creator_18add_item[] = "Add an item to the Creator object.\n\n Parameters\n ----------\n item : WriterItem\n The item to add to the file\n Raises\n ------\n RuntimeError\n If an Item exists with the same path\n RuntimeError\n If the ZimCreator was already finalized"; static PyObject *__pyx_pw_6libzim_8_Creator_19add_item(PyObject *__pyx_v_self, PyObject *__pyx_v_writer_item) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_item (wrapper)", 0); if (unlikely(((PyObject *)__pyx_v_writer_item) == Py_None)) { PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "writer_item"); __PYX_ERR(0, 338, __pyx_L1_error) } __pyx_r = __pyx_pf_6libzim_8_Creator_18add_item(((struct __pyx_obj_6libzim__Creator *)__pyx_v_self), ((PyObject *)__pyx_v_writer_item)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_8_Creator_18add_item(struct __pyx_obj_6libzim__Creator *__pyx_v_self, PyObject *__pyx_v_writer_item) { std::shared_ptr __pyx_v_item; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; WriterItemWrapper *__pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("add_item", 0); /* "libzim.pyx":351 * RuntimeError * If the ZimCreator was already finalized""" * if not self._started: # <<<<<<<<<<<<<< * raise RuntimeError("Creator not started") * */ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_started); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 351, __pyx_L1_error) __pyx_t_2 = ((!__pyx_t_1) != 0); if (unlikely(__pyx_t_2)) { /* "libzim.pyx":352 * If the ZimCreator was already finalized""" * if not self._started: * raise RuntimeError("Creator not started") # <<<<<<<<<<<<<< * * # Make a shared pointer to ZimArticleWrapper from the ZimArticle object */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 352, __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, 352, __pyx_L1_error) /* "libzim.pyx":351 * RuntimeError * If the ZimCreator was already finalized""" * if not self._started: # <<<<<<<<<<<<<< * raise RuntimeError("Creator not started") * */ } /* "libzim.pyx":356 * # Make a shared pointer to ZimArticleWrapper from the ZimArticle object * cdef shared_ptr[zim.WriterItem] item = shared_ptr[zim.WriterItem]( * new zim.WriterItemWrapper(writer_item)); # <<<<<<<<<<<<<< * with nogil: * self.c_creator.addItem(item) */ try { __pyx_t_4 = new WriterItemWrapper(((PyObject *)__pyx_v_writer_item)); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 356, __pyx_L1_error) } /* "libzim.pyx":355 * * # Make a shared pointer to ZimArticleWrapper from the ZimArticle object * cdef shared_ptr[zim.WriterItem] item = shared_ptr[zim.WriterItem]( # <<<<<<<<<<<<<< * new zim.WriterItemWrapper(writer_item)); * with nogil: */ __pyx_v_item = std::shared_ptr (__pyx_t_4); /* "libzim.pyx":357 * cdef shared_ptr[zim.WriterItem] item = shared_ptr[zim.WriterItem]( * new zim.WriterItemWrapper(writer_item)); * with nogil: # <<<<<<<<<<<<<< * self.c_creator.addItem(item) * */ { #ifdef WITH_THREAD PyThreadState *_save; Py_UNBLOCK_THREADS __Pyx_FastGIL_Remember(); #endif /*try:*/ { /* "libzim.pyx":358 * new zim.WriterItemWrapper(writer_item)); * with nogil: * self.c_creator.addItem(item) # <<<<<<<<<<<<<< * * def add_metadata(self, str name: str, bytes content: bytes, str mimetype: str): */ try { __pyx_v_self->c_creator.addItem(__pyx_v_item); } catch(...) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_CppExn2PyErr(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 358, __pyx_L5_error) } } /* "libzim.pyx":357 * cdef shared_ptr[zim.WriterItem] item = shared_ptr[zim.WriterItem]( * new zim.WriterItemWrapper(writer_item)); * with nogil: # <<<<<<<<<<<<<< * self.c_creator.addItem(item) * */ /*finally:*/ { /*normal exit:*/{ #ifdef WITH_THREAD __Pyx_FastGIL_Forget(); Py_BLOCK_THREADS #endif goto __pyx_L6; } __pyx_L5_error: { #ifdef WITH_THREAD __Pyx_FastGIL_Forget(); Py_BLOCK_THREADS #endif goto __pyx_L1_error; } __pyx_L6:; } } /* "libzim.pyx":338 * # self.c_creator.setUuid(uuid) * * def add_item(self, writer_item not None: BaseWritingItem): # <<<<<<<<<<<<<< * """Add an item to the Creator object. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("libzim._Creator.add_item", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":360 * self.c_creator.addItem(item) * * def add_metadata(self, str name: str, bytes content: bytes, str mimetype: str): # <<<<<<<<<<<<<< * """Add metadata entry to Archive * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_8_Creator_21add_metadata(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6libzim_8_Creator_20add_metadata[] = "Add metadata entry to Archive\n\n https://wiki.openzim.org/wiki/Metadata\n\n Raises\n ------\n RuntimeError\n If a Metadata exists with the same name"; static PyObject *__pyx_pw_6libzim_8_Creator_21add_metadata(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_name = 0; PyObject *__pyx_v_content = 0; PyObject *__pyx_v_mimetype = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_metadata (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_content,&__pyx_n_s_mimetype,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); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_content)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("add_metadata", 1, 3, 3, 1); __PYX_ERR(0, 360, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mimetype)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("add_metadata", 1, 3, 3, 2); __PYX_ERR(0, 360, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_metadata") < 0)) __PYX_ERR(0, 360, __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_name = ((PyObject*)values[0]); __pyx_v_content = ((PyObject*)values[1]); __pyx_v_mimetype = ((PyObject*)values[2]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("add_metadata", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 360, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim._Creator.add_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 1, "name", 1))) __PYX_ERR(0, 360, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_content), (&PyBytes_Type), 1, "content", 1))) __PYX_ERR(0, 360, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mimetype), (&PyUnicode_Type), 1, "mimetype", 1))) __PYX_ERR(0, 360, __pyx_L1_error) __pyx_r = __pyx_pf_6libzim_8_Creator_20add_metadata(((struct __pyx_obj_6libzim__Creator *)__pyx_v_self), __pyx_v_name, __pyx_v_content, __pyx_v_mimetype); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_8_Creator_20add_metadata(struct __pyx_obj_6libzim__Creator *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_content, PyObject *__pyx_v_mimetype) { std::string __pyx_v__name; std::string __pyx_v__content; std::string __pyx_v__mimetype; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; std::string __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("add_metadata", 0); /* "libzim.pyx":369 * RuntimeError * If a Metadata exists with the same name""" * if not self._started: # <<<<<<<<<<<<<< * raise RuntimeError("Creator not started") * */ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_started); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 369, __pyx_L1_error) __pyx_t_2 = ((!__pyx_t_1) != 0); if (unlikely(__pyx_t_2)) { /* "libzim.pyx":370 * If a Metadata exists with the same name""" * if not self._started: * raise RuntimeError("Creator not started") # <<<<<<<<<<<<<< * * cdef string _name = name.encode('UTF-8') */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 370, __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, 370, __pyx_L1_error) /* "libzim.pyx":369 * RuntimeError * If a Metadata exists with the same name""" * if not self._started: # <<<<<<<<<<<<<< * raise RuntimeError("Creator not started") * */ } /* "libzim.pyx":372 * raise RuntimeError("Creator not started") * * cdef string _name = name.encode('UTF-8') # <<<<<<<<<<<<<< * cdef string _content = content * cdef string _mimetype = mimetype.encode('UTF-8') */ if (unlikely(__pyx_v_name == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 372, __pyx_L1_error) } __pyx_t_3 = PyUnicode_AsUTF8String(__pyx_v_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v__name = __pyx_t_4; /* "libzim.pyx":373 * * cdef string _name = name.encode('UTF-8') * cdef string _content = content # <<<<<<<<<<<<<< * cdef string _mimetype = mimetype.encode('UTF-8') * with nogil: */ __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_v_content); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 373, __pyx_L1_error) __pyx_v__content = __pyx_t_4; /* "libzim.pyx":374 * cdef string _name = name.encode('UTF-8') * cdef string _content = content * cdef string _mimetype = mimetype.encode('UTF-8') # <<<<<<<<<<<<<< * with nogil: * self.c_creator.addMetadata(_name, _content, _mimetype) */ if (unlikely(__pyx_v_mimetype == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 374, __pyx_L1_error) } __pyx_t_3 = PyUnicode_AsUTF8String(__pyx_v_mimetype); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 374, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v__mimetype = __pyx_t_4; /* "libzim.pyx":375 * cdef string _content = content * cdef string _mimetype = mimetype.encode('UTF-8') * with nogil: # <<<<<<<<<<<<<< * self.c_creator.addMetadata(_name, _content, _mimetype) * */ { #ifdef WITH_THREAD PyThreadState *_save; Py_UNBLOCK_THREADS __Pyx_FastGIL_Remember(); #endif /*try:*/ { /* "libzim.pyx":376 * cdef string _mimetype = mimetype.encode('UTF-8') * with nogil: * self.c_creator.addMetadata(_name, _content, _mimetype) # <<<<<<<<<<<<<< * * def add_redirection(self, str path: str, str title: str, str targetPath: str, dict hints: Dict[Hint, pyint]): */ try { __pyx_v_self->c_creator.addMetadata(__pyx_v__name, __pyx_v__content, __pyx_v__mimetype); } catch(...) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_CppExn2PyErr(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 376, __pyx_L5_error) } } /* "libzim.pyx":375 * cdef string _content = content * cdef string _mimetype = mimetype.encode('UTF-8') * with nogil: # <<<<<<<<<<<<<< * self.c_creator.addMetadata(_name, _content, _mimetype) * */ /*finally:*/ { /*normal exit:*/{ #ifdef WITH_THREAD __Pyx_FastGIL_Forget(); Py_BLOCK_THREADS #endif goto __pyx_L6; } __pyx_L5_error: { #ifdef WITH_THREAD __Pyx_FastGIL_Forget(); Py_BLOCK_THREADS #endif goto __pyx_L1_error; } __pyx_L6:; } } /* "libzim.pyx":360 * self.c_creator.addItem(item) * * def add_metadata(self, str name: str, bytes content: bytes, str mimetype: str): # <<<<<<<<<<<<<< * """Add metadata entry to Archive * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("libzim._Creator.add_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":378 * self.c_creator.addMetadata(_name, _content, _mimetype) * * def add_redirection(self, str path: str, str title: str, str targetPath: str, dict hints: Dict[Hint, pyint]): # <<<<<<<<<<<<<< * """Add redirection entry to Archive * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_8_Creator_23add_redirection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6libzim_8_Creator_22add_redirection[] = "Add redirection entry to Archive\n\n https://wiki.openzim.org/wiki/ZIM_file_format#Redirect_Entry\n\n Raises\n ------\n RuntimeError\n If a Rediction exists with the same path\n "; static PyObject *__pyx_pw_6libzim_8_Creator_23add_redirection(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_path = 0; PyObject *__pyx_v_title = 0; PyObject *__pyx_v_targetPath = 0; PyObject *__pyx_v_hints = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_redirection (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_title,&__pyx_n_s_targetPath,&__pyx_n_s_hints,0}; PyObject* values[4] = {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 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_title)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("add_redirection", 1, 4, 4, 1); __PYX_ERR(0, 378, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_targetPath)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("add_redirection", 1, 4, 4, 2); __PYX_ERR(0, 378, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hints)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("add_redirection", 1, 4, 4, 3); __PYX_ERR(0, 378, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_redirection") < 0)) __PYX_ERR(0, 378, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { 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); } __pyx_v_path = ((PyObject*)values[0]); __pyx_v_title = ((PyObject*)values[1]); __pyx_v_targetPath = ((PyObject*)values[2]); __pyx_v_hints = ((PyObject*)values[3]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("add_redirection", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 378, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim._Creator.add_redirection", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_path), (&PyUnicode_Type), 1, "path", 1))) __PYX_ERR(0, 378, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_title), (&PyUnicode_Type), 1, "title", 1))) __PYX_ERR(0, 378, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_targetPath), (&PyUnicode_Type), 1, "targetPath", 1))) __PYX_ERR(0, 378, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hints), (&PyDict_Type), 1, "hints", 1))) __PYX_ERR(0, 378, __pyx_L1_error) __pyx_r = __pyx_pf_6libzim_8_Creator_22add_redirection(((struct __pyx_obj_6libzim__Creator *)__pyx_v_self), __pyx_v_path, __pyx_v_title, __pyx_v_targetPath, __pyx_v_hints); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_8_Creator_22add_redirection(struct __pyx_obj_6libzim__Creator *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_title, PyObject *__pyx_v_targetPath, PyObject *__pyx_v_hints) { std::string __pyx_v__path; std::string __pyx_v__title; std::string __pyx_v__targetPath; std::map __pyx_v__hints; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; std::string __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("add_redirection", 0); /* "libzim.pyx":388 * If a Rediction exists with the same path * """ * if not self._started: # <<<<<<<<<<<<<< * raise RuntimeError("Creator not started") * */ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->_started); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 388, __pyx_L1_error) __pyx_t_2 = ((!__pyx_t_1) != 0); if (unlikely(__pyx_t_2)) { /* "libzim.pyx":389 * """ * if not self._started: * raise RuntimeError("Creator not started") # <<<<<<<<<<<<<< * * cdef string _path = path.encode('UTF-8') */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 389, __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, 389, __pyx_L1_error) /* "libzim.pyx":388 * If a Rediction exists with the same path * """ * if not self._started: # <<<<<<<<<<<<<< * raise RuntimeError("Creator not started") * */ } /* "libzim.pyx":391 * raise RuntimeError("Creator not started") * * cdef string _path = path.encode('UTF-8') # <<<<<<<<<<<<<< * cdef string _title = title.encode('UTF-8') * cdef string _targetPath = targetPath.encode('UTF-8') */ if (unlikely(__pyx_v_path == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 391, __pyx_L1_error) } __pyx_t_3 = PyUnicode_AsUTF8String(__pyx_v_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 391, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 391, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v__path = __pyx_t_4; /* "libzim.pyx":392 * * cdef string _path = path.encode('UTF-8') * cdef string _title = title.encode('UTF-8') # <<<<<<<<<<<<<< * cdef string _targetPath = targetPath.encode('UTF-8') * cdef map[zim.HintKeys, uint64_t] _hints = convertToCppHints(hints) */ if (unlikely(__pyx_v_title == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 392, __pyx_L1_error) } __pyx_t_3 = PyUnicode_AsUTF8String(__pyx_v_title); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 392, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 392, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v__title = __pyx_t_4; /* "libzim.pyx":393 * cdef string _path = path.encode('UTF-8') * cdef string _title = title.encode('UTF-8') * cdef string _targetPath = targetPath.encode('UTF-8') # <<<<<<<<<<<<<< * cdef map[zim.HintKeys, uint64_t] _hints = convertToCppHints(hints) * with nogil: */ if (unlikely(__pyx_v_targetPath == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 393, __pyx_L1_error) } __pyx_t_3 = PyUnicode_AsUTF8String(__pyx_v_targetPath); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 393, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __pyx_convert_string_from_py_std__in_string(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 393, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v__targetPath = __pyx_t_4; /* "libzim.pyx":394 * cdef string _title = title.encode('UTF-8') * cdef string _targetPath = targetPath.encode('UTF-8') * cdef map[zim.HintKeys, uint64_t] _hints = convertToCppHints(hints) # <<<<<<<<<<<<<< * with nogil: * self.c_creator.addRedirection(_path, _title, _targetPath, _hints) */ __pyx_v__hints = convertToCppHints(__pyx_v_hints); /* "libzim.pyx":395 * cdef string _targetPath = targetPath.encode('UTF-8') * cdef map[zim.HintKeys, uint64_t] _hints = convertToCppHints(hints) * with nogil: # <<<<<<<<<<<<<< * self.c_creator.addRedirection(_path, _title, _targetPath, _hints) * */ { #ifdef WITH_THREAD PyThreadState *_save; Py_UNBLOCK_THREADS __Pyx_FastGIL_Remember(); #endif /*try:*/ { /* "libzim.pyx":396 * cdef map[zim.HintKeys, uint64_t] _hints = convertToCppHints(hints) * with nogil: * self.c_creator.addRedirection(_path, _title, _targetPath, _hints) # <<<<<<<<<<<<<< * * def __enter__(self): */ try { __pyx_v_self->c_creator.addRedirection(__pyx_v__path, __pyx_v__title, __pyx_v__targetPath, __pyx_v__hints); } catch(...) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_CppExn2PyErr(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 396, __pyx_L5_error) } } /* "libzim.pyx":395 * cdef string _targetPath = targetPath.encode('UTF-8') * cdef map[zim.HintKeys, uint64_t] _hints = convertToCppHints(hints) * with nogil: # <<<<<<<<<<<<<< * self.c_creator.addRedirection(_path, _title, _targetPath, _hints) * */ /*finally:*/ { /*normal exit:*/{ #ifdef WITH_THREAD __Pyx_FastGIL_Forget(); Py_BLOCK_THREADS #endif goto __pyx_L6; } __pyx_L5_error: { #ifdef WITH_THREAD __Pyx_FastGIL_Forget(); Py_BLOCK_THREADS #endif goto __pyx_L1_error; } __pyx_L6:; } } /* "libzim.pyx":378 * self.c_creator.addMetadata(_name, _content, _mimetype) * * def add_redirection(self, str path: str, str title: str, str targetPath: str, dict hints: Dict[Hint, pyint]): # <<<<<<<<<<<<<< * """Add redirection entry to Archive * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("libzim._Creator.add_redirection", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":398 * self.c_creator.addRedirection(_path, _title, _targetPath, _hints) * * def __enter__(self): # <<<<<<<<<<<<<< * cdef string _path = str(self._filename).encode('UTF-8') * with nogil: */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_8_Creator_25__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_6libzim_8_Creator_25__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_8_Creator_24__enter__(((struct __pyx_obj_6libzim__Creator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_8_Creator_24__enter__(struct __pyx_obj_6libzim__Creator *__pyx_v_self) { std::string __pyx_v__path; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; std::string __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__enter__", 0); /* "libzim.pyx":399 * * def __enter__(self): * cdef string _path = str(self._filename).encode('UTF-8') # <<<<<<<<<<<<<< * with nogil: * self.c_creator.startZimCreation(_path) */ __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_self->_filename); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 399, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 399, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v__path = __pyx_t_3; /* "libzim.pyx":400 * def __enter__(self): * cdef string _path = str(self._filename).encode('UTF-8') * with nogil: # <<<<<<<<<<<<<< * self.c_creator.startZimCreation(_path) * self._started = True */ { #ifdef WITH_THREAD PyThreadState *_save; Py_UNBLOCK_THREADS __Pyx_FastGIL_Remember(); #endif /*try:*/ { /* "libzim.pyx":401 * cdef string _path = str(self._filename).encode('UTF-8') * with nogil: * self.c_creator.startZimCreation(_path) # <<<<<<<<<<<<<< * self._started = True * return self */ try { __pyx_v_self->c_creator.startZimCreation(__pyx_v__path); } catch(...) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_CppExn2PyErr(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 401, __pyx_L4_error) } } /* "libzim.pyx":400 * def __enter__(self): * cdef string _path = str(self._filename).encode('UTF-8') * with nogil: # <<<<<<<<<<<<<< * self.c_creator.startZimCreation(_path) * self._started = True */ /*finally:*/ { /*normal exit:*/{ #ifdef WITH_THREAD __Pyx_FastGIL_Forget(); Py_BLOCK_THREADS #endif goto __pyx_L5; } __pyx_L4_error: { #ifdef WITH_THREAD __Pyx_FastGIL_Forget(); Py_BLOCK_THREADS #endif goto __pyx_L1_error; } __pyx_L5:; } } /* "libzim.pyx":402 * with nogil: * self.c_creator.startZimCreation(_path) * self._started = True # <<<<<<<<<<<<<< * return self * */ __Pyx_INCREF(Py_True); __Pyx_GIVEREF(Py_True); __Pyx_GOTREF(__pyx_v_self->_started); __Pyx_DECREF(__pyx_v_self->_started); __pyx_v_self->_started = Py_True; /* "libzim.pyx":403 * self.c_creator.startZimCreation(_path) * self._started = True * return self # <<<<<<<<<<<<<< * * def __exit__(self, exc_type, exc_val, exc_tb): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; /* "libzim.pyx":398 * self.c_creator.addRedirection(_path, _title, _targetPath, _hints) * * def __enter__(self): # <<<<<<<<<<<<<< * cdef string _path = str(self._filename).encode('UTF-8') * with nogil: */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim._Creator.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":405 * return self * * def __exit__(self, exc_type, exc_val, exc_tb): # <<<<<<<<<<<<<< * if True or exc_type is None: * with nogil: */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_8_Creator_27__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_6libzim_8_Creator_27__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED PyObject *__pyx_v_exc_type = 0; CYTHON_UNUSED PyObject *__pyx_v_exc_val = 0; CYTHON_UNUSED PyObject *__pyx_v_exc_tb = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exc_type,&__pyx_n_s_exc_val,&__pyx_n_s_exc_tb,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); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exc_type)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exc_val)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(0, 405, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exc_tb)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(0, 405, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) __PYX_ERR(0, 405, __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_exc_type = values[0]; __pyx_v_exc_val = values[1]; __pyx_v_exc_tb = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 405, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim._Creator.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6libzim_8_Creator_26__exit__(((struct __pyx_obj_6libzim__Creator *)__pyx_v_self), __pyx_v_exc_type, __pyx_v_exc_val, __pyx_v_exc_tb); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_8_Creator_26__exit__(struct __pyx_obj_6libzim__Creator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_val, CYTHON_UNUSED PyObject *__pyx_v_exc_tb) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__exit__", 0); /* "libzim.pyx":407 * def __exit__(self, exc_type, exc_val, exc_tb): * if True or exc_type is None: * with nogil: # <<<<<<<<<<<<<< * self.c_creator.finishZimCreation() * self._started = False */ { #ifdef WITH_THREAD PyThreadState *_save; Py_UNBLOCK_THREADS __Pyx_FastGIL_Remember(); #endif /*try:*/ { /* "libzim.pyx":408 * if True or exc_type is None: * with nogil: * self.c_creator.finishZimCreation() # <<<<<<<<<<<<<< * self._started = False * */ try { __pyx_v_self->c_creator.finishZimCreation(); } catch(...) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_CppExn2PyErr(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif __PYX_ERR(0, 408, __pyx_L4_error) } } /* "libzim.pyx":407 * def __exit__(self, exc_type, exc_val, exc_tb): * if True or exc_type is None: * with nogil: # <<<<<<<<<<<<<< * self.c_creator.finishZimCreation() * self._started = False */ /*finally:*/ { /*normal exit:*/{ #ifdef WITH_THREAD __Pyx_FastGIL_Forget(); Py_BLOCK_THREADS #endif goto __pyx_L5; } __pyx_L4_error: { #ifdef WITH_THREAD __Pyx_FastGIL_Forget(); Py_BLOCK_THREADS #endif goto __pyx_L1_error; } __pyx_L5:; } } /* "libzim.pyx":409 * with nogil: * self.c_creator.finishZimCreation() * self._started = False # <<<<<<<<<<<<<< * * @property */ __Pyx_INCREF(Py_False); __Pyx_GIVEREF(Py_False); __Pyx_GOTREF(__pyx_v_self->_started); __Pyx_DECREF(__pyx_v_self->_started); __pyx_v_self->_started = Py_False; /* "libzim.pyx":405 * return self * * def __exit__(self, exc_type, exc_val, exc_tb): # <<<<<<<<<<<<<< * if True or exc_type is None: * with nogil: */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("libzim._Creator.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":412 * * @property * def filename(self) -> pathlib.Path: # <<<<<<<<<<<<<< * return self._filename * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_8_Creator_8filename_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_8_Creator_8filename_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_8_Creator_8filename___get__(((struct __pyx_obj_6libzim__Creator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_8_Creator_8filename___get__(struct __pyx_obj_6libzim__Creator *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":413 * @property * def filename(self) -> pathlib.Path: * return self._filename # <<<<<<<<<<<<<< * * class ContentProvider: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->_filename); __pyx_r = __pyx_v_self->_filename; goto __pyx_L0; /* "libzim.pyx":412 * * @property * def filename(self) -> pathlib.Path: # <<<<<<<<<<<<<< * return self._filename * */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_8_Creator_29__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_6libzim_8_Creator_29__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_8_Creator_28__reduce_cython__(((struct __pyx_obj_6libzim__Creator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_8_Creator_28__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim__Creator *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim._Creator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_8_Creator_31__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ static PyObject *__pyx_pw_6libzim_8_Creator_31__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_8_Creator_30__setstate_cython__(((struct __pyx_obj_6libzim__Creator *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_8_Creator_30__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim__Creator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim._Creator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":417 * class ContentProvider: * __module__ = writer_module_name * def __init__(self): # <<<<<<<<<<<<<< * self.generator = None * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_15ContentProvider_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static PyMethodDef __pyx_mdef_6libzim_15ContentProvider_1__init__ = {"__init__", (PyCFunction)__pyx_pw_6libzim_15ContentProvider_1__init__, METH_O, 0}; static PyObject *__pyx_pw_6libzim_15ContentProvider_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_15ContentProvider___init__(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_15ContentProvider___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); /* "libzim.pyx":418 * __module__ = writer_module_name * def __init__(self): * self.generator = None # <<<<<<<<<<<<<< * * def get_size(self) -> pyint: */ if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_generator, Py_None) < 0) __PYX_ERR(0, 418, __pyx_L1_error) /* "libzim.pyx":417 * class ContentProvider: * __module__ = writer_module_name * def __init__(self): # <<<<<<<<<<<<<< * self.generator = None * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("libzim.ContentProvider.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":420 * self.generator = None * * def get_size(self) -> pyint: # <<<<<<<<<<<<<< * """Size of get_data's result in bytes""" * raise NotImplementedError("get_size must be implemented.") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_15ContentProvider_3get_size(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_6libzim_15ContentProvider_2get_size[] = "Size of get_data's result in bytes"; static PyMethodDef __pyx_mdef_6libzim_15ContentProvider_3get_size = {"get_size", (PyCFunction)__pyx_pw_6libzim_15ContentProvider_3get_size, METH_O, __pyx_doc_6libzim_15ContentProvider_2get_size}; static PyObject *__pyx_pw_6libzim_15ContentProvider_3get_size(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_size (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_15ContentProvider_2get_size(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_15ContentProvider_2get_size(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_size", 0); /* "libzim.pyx":422 * def get_size(self) -> pyint: * """Size of get_data's result in bytes""" * raise NotImplementedError("get_size must be implemented.") # <<<<<<<<<<<<<< * * def feed(self) -> WritingBlob: */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 422, __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, 422, __pyx_L1_error) /* "libzim.pyx":420 * self.generator = None * * def get_size(self) -> pyint: # <<<<<<<<<<<<<< * """Size of get_data's result in bytes""" * raise NotImplementedError("get_size must be implemented.") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.ContentProvider.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":424 * raise NotImplementedError("get_size must be implemented.") * * def feed(self) -> WritingBlob: # <<<<<<<<<<<<<< * """Blob(s) containing the complete content of the article. * Must return an empty blob to tell writer no more content has to be written. */ /* Python wrapper */ static struct __pyx_obj_6libzim_WritingBlob *__pyx_pw_6libzim_15ContentProvider_5feed(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_6libzim_15ContentProvider_4feed[] = "Blob(s) containing the complete content of the article.\n Must return an empty blob to tell writer no more content has to be written.\n Sum(size(blobs)) must be equals to `self.get_size()`\n "; static PyMethodDef __pyx_mdef_6libzim_15ContentProvider_5feed = {"feed", (PyCFunction)__pyx_pw_6libzim_15ContentProvider_5feed, METH_O, __pyx_doc_6libzim_15ContentProvider_4feed}; static struct __pyx_obj_6libzim_WritingBlob *__pyx_pw_6libzim_15ContentProvider_5feed(PyObject *__pyx_self, PyObject *__pyx_v_self) { struct __pyx_obj_6libzim_WritingBlob *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("feed (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_15ContentProvider_4feed(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_obj_6libzim_WritingBlob *__pyx_pf_6libzim_15ContentProvider_4feed(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { struct __pyx_obj_6libzim_WritingBlob *__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; PyObject *__pyx_t_8 = NULL; int __pyx_t_9; PyObject *__pyx_t_10 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("feed", 0); /* "libzim.pyx":429 * Sum(size(blobs)) must be equals to `self.get_size()` * """ * if self.generator is None: # <<<<<<<<<<<<<< * self.generator = self.gen_blob() * */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_generator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 429, __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) { /* "libzim.pyx":430 * """ * if self.generator is None: * self.generator = self.gen_blob() # <<<<<<<<<<<<<< * * try: */ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_gen_blob); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 430, __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); } } __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_generator, __pyx_t_1) < 0) __PYX_ERR(0, 430, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":429 * Sum(size(blobs)) must be equals to `self.get_size()` * """ * if self.generator is None: # <<<<<<<<<<<<<< * self.generator = self.gen_blob() * */ } /* "libzim.pyx":432 * self.generator = self.gen_blob() * * try: # <<<<<<<<<<<<<< * # We have to keep a ref to _blob to be sure gc do not del it while cpp is * # using it */ { __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:*/ { /* "libzim.pyx":435 * # We have to keep a ref to _blob to be sure gc do not del it while cpp is * # using it * self._blob = next(self.generator) # <<<<<<<<<<<<<< * except StopIteration: * self._blob = WritingBlob("") */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_generator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 435, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyIter_Next(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 435, __pyx_L4_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_blob, __pyx_t_4) < 0) __PYX_ERR(0, 435, __pyx_L4_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "libzim.pyx":432 * self.generator = self.gen_blob() * * try: # <<<<<<<<<<<<<< * # We have to keep a ref to _blob to be sure gc do not del it while cpp is * # using it */ } __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_L9_try_end; __pyx_L4_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; /* "libzim.pyx":436 * # using it * self._blob = next(self.generator) * except StopIteration: # <<<<<<<<<<<<<< * self._blob = WritingBlob("") * */ __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration); if (__pyx_t_9) { __Pyx_AddTraceback("libzim.ContentProvider.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_5) < 0) __PYX_ERR(0, 436, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_5); /* "libzim.pyx":437 * self._blob = next(self.generator) * except StopIteration: * self._blob = WritingBlob("") # <<<<<<<<<<<<<< * * return self._blob */ __pyx_t_10 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_6libzim_WritingBlob), __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 437, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_10); if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_blob, __pyx_t_10) < 0) __PYX_ERR(0, 437, __pyx_L6_except_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L5_exception_handled; } goto __pyx_L6_except_error; __pyx_L6_except_error:; /* "libzim.pyx":432 * self.generator = self.gen_blob() * * try: # <<<<<<<<<<<<<< * # We have to keep a ref to _blob to be sure gc do not del it while cpp is * # using it */ __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_L5_exception_handled:; __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); __pyx_L9_try_end:; } /* "libzim.pyx":439 * self._blob = WritingBlob("") * * return self._blob # <<<<<<<<<<<<<< * * def gen_blob(self) -> Generator[WritingBlob, None, None]: */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_blob); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_6libzim_WritingBlob))))) __PYX_ERR(0, 439, __pyx_L1_error) __pyx_r = ((struct __pyx_obj_6libzim_WritingBlob *)__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L0; /* "libzim.pyx":424 * raise NotImplementedError("get_size must be implemented.") * * def feed(self) -> WritingBlob: # <<<<<<<<<<<<<< * """Blob(s) containing the complete content of the article. * Must return an empty blob to tell writer no more content has to be written. */ /* 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_10); __Pyx_AddTraceback("libzim.ContentProvider.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":441 * return self._blob * * def gen_blob(self) -> Generator[WritingBlob, None, None]: # <<<<<<<<<<<<<< * """Generator yielding blobs for the content of the article""" * raise NotImplementedError("gen_blob (ro feed) must be implemented") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_15ContentProvider_7gen_blob(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_6libzim_15ContentProvider_6gen_blob[] = "Generator yielding blobs for the content of the article"; static PyMethodDef __pyx_mdef_6libzim_15ContentProvider_7gen_blob = {"gen_blob", (PyCFunction)__pyx_pw_6libzim_15ContentProvider_7gen_blob, METH_O, __pyx_doc_6libzim_15ContentProvider_6gen_blob}; static PyObject *__pyx_pw_6libzim_15ContentProvider_7gen_blob(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gen_blob (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_15ContentProvider_6gen_blob(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_15ContentProvider_6gen_blob(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gen_blob", 0); /* "libzim.pyx":443 * def gen_blob(self) -> Generator[WritingBlob, None, None]: * """Generator yielding blobs for the content of the article""" * raise NotImplementedError("gen_blob (ro feed) must be implemented") # <<<<<<<<<<<<<< * * */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 443, __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, 443, __pyx_L1_error) /* "libzim.pyx":441 * return self._blob * * def gen_blob(self) -> Generator[WritingBlob, None, None]: # <<<<<<<<<<<<<< * """Generator yielding blobs for the content of the article""" * raise NotImplementedError("gen_blob (ro feed) must be implemented") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.ContentProvider.gen_blob", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":449 * """ContentProvider for a single encoded-or-not UTF-8 string""" * __module__ = writer_module_name * def __init__(self, content: Union[str, bytes]): # <<<<<<<<<<<<<< * super().__init__() * self.content = content.encode("UTF-8") if isinstance(content, str) else content */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_14StringProvider_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_6libzim_14StringProvider_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6libzim_14StringProvider_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_6libzim_14StringProvider_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_content = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_content,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); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_content)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 449, __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, 449, __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_content = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 449, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim.StringProvider.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6libzim_14StringProvider___init__(__pyx_self, __pyx_v_self, __pyx_v_content); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_14StringProvider___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_content) { 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); /* "libzim.pyx":450 * __module__ = writer_module_name * def __init__(self, content: Union[str, bytes]): * super().__init__() # <<<<<<<<<<<<<< * self.content = content.encode("UTF-8") if isinstance(content, str) else content * */ __pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self); if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 450, __pyx_L1_error) } __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 450, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_INCREF(__pyx_v_self); __Pyx_GIVEREF(__pyx_v_self); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 450, __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_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 450, __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); } } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 450, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":451 * def __init__(self, content: Union[str, bytes]): * super().__init__() * self.content = content.encode("UTF-8") if isinstance(content, str) else content # <<<<<<<<<<<<<< * * def get_size(self) -> pyint: */ __pyx_t_4 = PyUnicode_Check(__pyx_v_content); if ((__pyx_t_4 != 0)) { __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_content, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 451, __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); } } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_UTF_8); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_3; __pyx_t_3 = 0; } else { __Pyx_INCREF(__pyx_v_content); __pyx_t_1 = __pyx_v_content; } if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_content, __pyx_t_1) < 0) __PYX_ERR(0, 451, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":449 * """ContentProvider for a single encoded-or-not UTF-8 string""" * __module__ = writer_module_name * def __init__(self, content: Union[str, bytes]): # <<<<<<<<<<<<<< * super().__init__() * self.content = content.encode("UTF-8") if isinstance(content, str) else content */ /* 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_5); __Pyx_AddTraceback("libzim.StringProvider.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":453 * self.content = content.encode("UTF-8") if isinstance(content, str) else content * * def get_size(self) -> pyint: # <<<<<<<<<<<<<< * return len(self.content) * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_14StringProvider_3get_size(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static PyMethodDef __pyx_mdef_6libzim_14StringProvider_3get_size = {"get_size", (PyCFunction)__pyx_pw_6libzim_14StringProvider_3get_size, METH_O, 0}; static PyObject *__pyx_pw_6libzim_14StringProvider_3get_size(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_size (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_14StringProvider_2get_size(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_14StringProvider_2get_size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_size", 0); /* "libzim.pyx":454 * * def get_size(self) -> pyint: * return len(self.content) # <<<<<<<<<<<<<< * * def gen_blob(self) -> Generator[WritingBlob, None, None]: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_content); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 454, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 454, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 454, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "libzim.pyx":453 * self.content = content.encode("UTF-8") if isinstance(content, str) else content * * def get_size(self) -> pyint: # <<<<<<<<<<<<<< * return len(self.content) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.StringProvider.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_6libzim_14StringProvider_6generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ /* "libzim.pyx":456 * return len(self.content) * * def gen_blob(self) -> Generator[WritingBlob, None, None]: # <<<<<<<<<<<<<< * yield WritingBlob(self.content) * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_14StringProvider_5gen_blob(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static PyMethodDef __pyx_mdef_6libzim_14StringProvider_5gen_blob = {"gen_blob", (PyCFunction)__pyx_pw_6libzim_14StringProvider_5gen_blob, METH_O, 0}; static PyObject *__pyx_pw_6libzim_14StringProvider_5gen_blob(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gen_blob (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_14StringProvider_4gen_blob(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_14StringProvider_4gen_blob(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { struct __pyx_obj_6libzim___pyx_scope_struct__gen_blob *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gen_blob", 0); __pyx_cur_scope = (struct __pyx_obj_6libzim___pyx_scope_struct__gen_blob *)__pyx_tp_new_6libzim___pyx_scope_struct__gen_blob(__pyx_ptype_6libzim___pyx_scope_struct__gen_blob, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_6libzim___pyx_scope_struct__gen_blob *)Py_None); __Pyx_INCREF(Py_None); __PYX_ERR(0, 456, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } __pyx_cur_scope->__pyx_v_self = __pyx_v_self; __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self); { __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6libzim_14StringProvider_6generator, __pyx_codeobj__13, (PyObject *) __pyx_cur_scope, __pyx_n_s_gen_blob, __pyx_n_s_StringProvider_gen_blob, __pyx_n_s_libzim); if (unlikely(!gen)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; } /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("libzim.StringProvider.gen_blob", __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_6libzim_14StringProvider_6generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ { struct __pyx_obj_6libzim___pyx_scope_struct__gen_blob *__pyx_cur_scope = ((struct __pyx_obj_6libzim___pyx_scope_struct__gen_blob *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gen_blob", 0); switch (__pyx_generator->resume_label) { case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L4_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, 456, __pyx_L1_error) /* "libzim.pyx":457 * * def gen_blob(self) -> Generator[WritingBlob, None, None]: * yield WritingBlob(self.content) # <<<<<<<<<<<<<< * * */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_content); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_6libzim_WritingBlob), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, yielding value */ __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L4_resume_from_yield:; if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 457, __pyx_L1_error) CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); /* "libzim.pyx":456 * return len(self.content) * * def gen_blob(self) -> Generator[WritingBlob, None, None]: # <<<<<<<<<<<<<< * yield WritingBlob(self.content) * */ /* function exit code */ PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("gen_blob", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_r = 0; #if !CYTHON_USE_EXC_INFO_STACK __Pyx_Coroutine_ResetAndClearException(__pyx_generator); #endif __pyx_generator->resume_label = -1; __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":463 * """ContentProvider for a file using its local path""" * __module__ = writer_module_name * def __init__(self, filepath: Union[pathlib.Path, str]): # <<<<<<<<<<<<<< * super().__init__() * self.filepath = filepath */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_12FileProvider_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_6libzim_12FileProvider_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6libzim_12FileProvider_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_6libzim_12FileProvider_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_filepath = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_filepath,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); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filepath)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 463, __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, 463, __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_filepath = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 463, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim.FileProvider.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6libzim_12FileProvider___init__(__pyx_self, __pyx_v_self, __pyx_v_filepath); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_12FileProvider___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_filepath) { 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_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); /* "libzim.pyx":464 * __module__ = writer_module_name * def __init__(self, filepath: Union[pathlib.Path, str]): * super().__init__() # <<<<<<<<<<<<<< * self.filepath = filepath * self.size = os.path.getsize(self.filepath) */ __pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self); if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 464, __pyx_L1_error) } __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 464, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_INCREF(__pyx_v_self); __Pyx_GIVEREF(__pyx_v_self); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 464, __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_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 464, __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); } } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 464, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":465 * def __init__(self, filepath: Union[pathlib.Path, str]): * super().__init__() * self.filepath = filepath # <<<<<<<<<<<<<< * self.size = os.path.getsize(self.filepath) * */ if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_filepath, __pyx_v_filepath) < 0) __PYX_ERR(0, 465, __pyx_L1_error) /* "libzim.pyx":466 * super().__init__() * self.filepath = filepath * self.size = os.path.getsize(self.filepath) # <<<<<<<<<<<<<< * * def get_size(self) -> pyint: */ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 466, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 466, __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_getsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 466, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_filepath); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 466, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __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); } } __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_size, __pyx_t_1) < 0) __PYX_ERR(0, 466, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":463 * """ContentProvider for a file using its local path""" * __module__ = writer_module_name * def __init__(self, filepath: Union[pathlib.Path, str]): # <<<<<<<<<<<<<< * super().__init__() * self.filepath = filepath */ /* 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_AddTraceback("libzim.FileProvider.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":468 * self.size = os.path.getsize(self.filepath) * * def get_size(self) -> pyint: # <<<<<<<<<<<<<< * return self.size * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_12FileProvider_3get_size(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static PyMethodDef __pyx_mdef_6libzim_12FileProvider_3get_size = {"get_size", (PyCFunction)__pyx_pw_6libzim_12FileProvider_3get_size, METH_O, 0}; static PyObject *__pyx_pw_6libzim_12FileProvider_3get_size(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_size (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_12FileProvider_2get_size(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_12FileProvider_2get_size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_size", 0); /* "libzim.pyx":469 * * def get_size(self) -> pyint: * return self.size # <<<<<<<<<<<<<< * * def gen_blob(self) -> Generator[WritingBlob, None, None]: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 469, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "libzim.pyx":468 * self.size = os.path.getsize(self.filepath) * * def get_size(self) -> pyint: # <<<<<<<<<<<<<< * return self.size * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.FileProvider.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_6libzim_12FileProvider_6generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ /* "libzim.pyx":471 * return self.size * * def gen_blob(self) -> Generator[WritingBlob, None, None]: # <<<<<<<<<<<<<< * bsize = 1048576 # 1MiB chunk * with open(self.filepath, "rb") as fh: */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_12FileProvider_5gen_blob(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static PyMethodDef __pyx_mdef_6libzim_12FileProvider_5gen_blob = {"gen_blob", (PyCFunction)__pyx_pw_6libzim_12FileProvider_5gen_blob, METH_O, 0}; static PyObject *__pyx_pw_6libzim_12FileProvider_5gen_blob(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gen_blob (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_12FileProvider_4gen_blob(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_12FileProvider_4gen_blob(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { struct __pyx_obj_6libzim___pyx_scope_struct_1_gen_blob *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gen_blob", 0); __pyx_cur_scope = (struct __pyx_obj_6libzim___pyx_scope_struct_1_gen_blob *)__pyx_tp_new_6libzim___pyx_scope_struct_1_gen_blob(__pyx_ptype_6libzim___pyx_scope_struct_1_gen_blob, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_6libzim___pyx_scope_struct_1_gen_blob *)Py_None); __Pyx_INCREF(Py_None); __PYX_ERR(0, 471, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } __pyx_cur_scope->__pyx_v_self = __pyx_v_self; __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self); { __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6libzim_12FileProvider_6generator1, __pyx_codeobj__14, (PyObject *) __pyx_cur_scope, __pyx_n_s_gen_blob, __pyx_n_s_FileProvider_gen_blob, __pyx_n_s_libzim); if (unlikely(!gen)) __PYX_ERR(0, 471, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; } /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("libzim.FileProvider.gen_blob", __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_6libzim_12FileProvider_6generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ { struct __pyx_obj_6libzim___pyx_scope_struct_1_gen_blob *__pyx_cur_scope = ((struct __pyx_obj_6libzim___pyx_scope_struct_1_gen_blob *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; int __pyx_t_9; PyObject *__pyx_t_10 = NULL; int __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gen_blob", 0); switch (__pyx_generator->resume_label) { case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L16_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, 471, __pyx_L1_error) /* "libzim.pyx":472 * * def gen_blob(self) -> Generator[WritingBlob, None, None]: * bsize = 1048576 # 1MiB chunk # <<<<<<<<<<<<<< * with open(self.filepath, "rb") as fh: * res = fh.read(bsize) */ __pyx_cur_scope->__pyx_v_bsize = 0x100000; /* "libzim.pyx":473 * def gen_blob(self) -> Generator[WritingBlob, None, None]: * bsize = 1048576 # 1MiB chunk * with open(self.filepath, "rb") as fh: # <<<<<<<<<<<<<< * res = fh.read(bsize) * while res: */ /*with:*/ { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_filepath); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 473, __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_n_u_rb); __Pyx_GIVEREF(__pyx_n_u_rb); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_u_rb); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 473, __pyx_L4_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); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 473, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { { __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:*/ { __Pyx_GIVEREF(__pyx_t_4); __pyx_cur_scope->__pyx_v_fh = __pyx_t_4; __pyx_t_4 = 0; /* "libzim.pyx":474 * bsize = 1048576 # 1MiB chunk * with open(self.filepath, "rb") as fh: * res = fh.read(bsize) # <<<<<<<<<<<<<< * while res: * yield WritingBlob(res) */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_fh, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_cur_scope->__pyx_v_bsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_2); __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); } } __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 474, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_4); __pyx_cur_scope->__pyx_v_res = __pyx_t_4; __pyx_t_4 = 0; /* "libzim.pyx":475 * with open(self.filepath, "rb") as fh: * res = fh.read(bsize) * while res: # <<<<<<<<<<<<<< * yield WritingBlob(res) * res = fh.read(bsize) */ while (1) { __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_res); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 475, __pyx_L8_error) if (!__pyx_t_9) break; /* "libzim.pyx":476 * res = fh.read(bsize) * while res: * yield WritingBlob(res) # <<<<<<<<<<<<<< * res = fh.read(bsize) * */ __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_6libzim_WritingBlob), __pyx_cur_scope->__pyx_v_res); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 476, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; __Pyx_XGIVEREF(__pyx_t_3); __pyx_cur_scope->__pyx_t_0 = __pyx_t_3; __Pyx_XGIVEREF(__pyx_t_6); __pyx_cur_scope->__pyx_t_1 = __pyx_t_6; __Pyx_XGIVEREF(__pyx_t_7); __pyx_cur_scope->__pyx_t_2 = __pyx_t_7; __Pyx_XGIVEREF(__pyx_t_8); __pyx_cur_scope->__pyx_t_3 = __pyx_t_8; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, yielding value */ __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L16_resume_from_yield:; __pyx_t_3 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_3); __pyx_t_6 = __pyx_cur_scope->__pyx_t_1; __pyx_cur_scope->__pyx_t_1 = 0; __Pyx_XGOTREF(__pyx_t_6); __pyx_t_7 = __pyx_cur_scope->__pyx_t_2; __pyx_cur_scope->__pyx_t_2 = 0; __Pyx_XGOTREF(__pyx_t_7); __pyx_t_8 = __pyx_cur_scope->__pyx_t_3; __pyx_cur_scope->__pyx_t_3 = 0; __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 476, __pyx_L8_error) /* "libzim.pyx":477 * while res: * yield WritingBlob(res) * res = fh.read(bsize) # <<<<<<<<<<<<<< * * class IndexData: */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_fh, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_cur_scope->__pyx_v_bsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_2); __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); } } __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_res); __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_res, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; } /* "libzim.pyx":473 * def gen_blob(self) -> Generator[WritingBlob, None, None]: * bsize = 1048576 # 1MiB chunk * with open(self.filepath, "rb") as fh: # <<<<<<<<<<<<<< * res = fh.read(bsize) * while res: */ } __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_L13_try_end; __pyx_L8_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; /*except:*/ { __Pyx_AddTraceback("libzim.FileProvider.gen_blob", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_2) < 0) __PYX_ERR(0, 473, __pyx_L10_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 473, __pyx_L10_except_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 473, __pyx_L10_except_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_10); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (__pyx_t_9 < 0) __PYX_ERR(0, 473, __pyx_L10_except_error) __pyx_t_11 = ((!(__pyx_t_9 != 0)) != 0); if (__pyx_t_11) { __Pyx_GIVEREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_1, __pyx_t_2); __pyx_t_4 = 0; __pyx_t_1 = 0; __pyx_t_2 = 0; __PYX_ERR(0, 473, __pyx_L10_except_error) } __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L9_exception_handled; } __pyx_L10_except_error:; __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_L9_exception_handled:; __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); __pyx_L13_try_end:; } } /*finally:*/ { /*normal exit:*/{ if (__pyx_t_3) { __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__15, NULL); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } goto __pyx_L7; } __pyx_L7:; } goto __pyx_L20; __pyx_L4_error:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L1_error; __pyx_L20:; } CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); /* "libzim.pyx":471 * return self.size * * def gen_blob(self) -> Generator[WritingBlob, None, None]: # <<<<<<<<<<<<<< * bsize = 1048576 # 1MiB chunk * with open(self.filepath, "rb") as fh: */ /* function exit code */ PyErr_SetNone(PyExc_StopIteration); 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_AddTraceback("gen_blob", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_r = 0; #if !CYTHON_USE_EXC_INFO_STACK __Pyx_Coroutine_ResetAndClearException(__pyx_generator); #endif __pyx_generator->resume_label = -1; __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":485 * __module__ = writer_module_name * * def has_indexdata(self) -> bool: # <<<<<<<<<<<<<< * """Return true if the IndexData actually contains data""" * return False */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_9IndexData_1has_indexdata(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_6libzim_9IndexData_has_indexdata[] = "Return true if the IndexData actually contains data"; static PyMethodDef __pyx_mdef_6libzim_9IndexData_1has_indexdata = {"has_indexdata", (PyCFunction)__pyx_pw_6libzim_9IndexData_1has_indexdata, METH_O, __pyx_doc_6libzim_9IndexData_has_indexdata}; static PyObject *__pyx_pw_6libzim_9IndexData_1has_indexdata(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("has_indexdata (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_9IndexData_has_indexdata(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_9IndexData_has_indexdata(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("has_indexdata", 0); /* "libzim.pyx":487 * def has_indexdata(self) -> bool: * """Return true if the IndexData actually contains data""" * return False # <<<<<<<<<<<<<< * * def get_title(self) -> str: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_False); __pyx_r = Py_False; goto __pyx_L0; /* "libzim.pyx":485 * __module__ = writer_module_name * * def has_indexdata(self) -> bool: # <<<<<<<<<<<<<< * """Return true if the IndexData actually contains data""" * return False */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":489 * return False * * def get_title(self) -> str: # <<<<<<<<<<<<<< * """Title to index. Might be the same as Item.get_title or not""" * raise NotImplementedError("get_title must be implemented.") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_9IndexData_3get_title(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_6libzim_9IndexData_2get_title[] = "Title to index. Might be the same as Item.get_title or not"; static PyMethodDef __pyx_mdef_6libzim_9IndexData_3get_title = {"get_title", (PyCFunction)__pyx_pw_6libzim_9IndexData_3get_title, METH_O, __pyx_doc_6libzim_9IndexData_2get_title}; static PyObject *__pyx_pw_6libzim_9IndexData_3get_title(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_title (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_9IndexData_2get_title(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_9IndexData_2get_title(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_title", 0); /* "libzim.pyx":491 * def get_title(self) -> str: * """Title to index. Might be the same as Item.get_title or not""" * raise NotImplementedError("get_title must be implemented.") # <<<<<<<<<<<<<< * * def get_content(self) -> str: */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 491, __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, 491, __pyx_L1_error) /* "libzim.pyx":489 * return False * * def get_title(self) -> str: # <<<<<<<<<<<<<< * """Title to index. Might be the same as Item.get_title or not""" * raise NotImplementedError("get_title must be implemented.") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.IndexData.get_title", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":493 * raise NotImplementedError("get_title must be implemented.") * * def get_content(self) -> str: # <<<<<<<<<<<<<< * """Content to index. Might be the same as Item.get_title or not""" * raise NotImplementedError("get_content must be implemented.") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_9IndexData_5get_content(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_6libzim_9IndexData_4get_content[] = "Content to index. Might be the same as Item.get_title or not"; static PyMethodDef __pyx_mdef_6libzim_9IndexData_5get_content = {"get_content", (PyCFunction)__pyx_pw_6libzim_9IndexData_5get_content, METH_O, __pyx_doc_6libzim_9IndexData_4get_content}; static PyObject *__pyx_pw_6libzim_9IndexData_5get_content(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_content (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_9IndexData_4get_content(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_9IndexData_4get_content(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_content", 0); /* "libzim.pyx":495 * def get_content(self) -> str: * """Content to index. Might be the same as Item.get_title or not""" * raise NotImplementedError("get_content must be implemented.") # <<<<<<<<<<<<<< * * def get_keywords(self) -> str: */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __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, 495, __pyx_L1_error) /* "libzim.pyx":493 * raise NotImplementedError("get_title must be implemented.") * * def get_content(self) -> str: # <<<<<<<<<<<<<< * """Content to index. Might be the same as Item.get_title or not""" * raise NotImplementedError("get_content must be implemented.") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.IndexData.get_content", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":497 * raise NotImplementedError("get_content must be implemented.") * * def get_keywords(self) -> str: # <<<<<<<<<<<<<< * """Keywords used to index the item. * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_9IndexData_7get_keywords(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_6libzim_9IndexData_6get_keywords[] = "Keywords used to index the item.\n\n Must be a string containing keywords separated by a space"; static PyMethodDef __pyx_mdef_6libzim_9IndexData_7get_keywords = {"get_keywords", (PyCFunction)__pyx_pw_6libzim_9IndexData_7get_keywords, METH_O, __pyx_doc_6libzim_9IndexData_6get_keywords}; static PyObject *__pyx_pw_6libzim_9IndexData_7get_keywords(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_keywords (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_9IndexData_6get_keywords(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_9IndexData_6get_keywords(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_keywords", 0); /* "libzim.pyx":501 * * Must be a string containing keywords separated by a space""" * raise NotImplementedError("get_keywords must be implemented.") # <<<<<<<<<<<<<< * * def get_wordcount(self) -> int: */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 501, __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, 501, __pyx_L1_error) /* "libzim.pyx":497 * raise NotImplementedError("get_content must be implemented.") * * def get_keywords(self) -> str: # <<<<<<<<<<<<<< * """Keywords used to index the item. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.IndexData.get_keywords", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":503 * raise NotImplementedError("get_keywords must be implemented.") * * def get_wordcount(self) -> int: # <<<<<<<<<<<<<< * """Number of word in content""" * raise NotImplementedError("get_wordcount must be implemented.") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_9IndexData_9get_wordcount(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_6libzim_9IndexData_8get_wordcount[] = "Number of word in content"; static PyMethodDef __pyx_mdef_6libzim_9IndexData_9get_wordcount = {"get_wordcount", (PyCFunction)__pyx_pw_6libzim_9IndexData_9get_wordcount, METH_O, __pyx_doc_6libzim_9IndexData_8get_wordcount}; static PyObject *__pyx_pw_6libzim_9IndexData_9get_wordcount(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_wordcount (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_9IndexData_8get_wordcount(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_9IndexData_8get_wordcount(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_wordcount", 0); /* "libzim.pyx":505 * def get_wordcount(self) -> int: * """Number of word in content""" * raise NotImplementedError("get_wordcount must be implemented.") # <<<<<<<<<<<<<< * * def get_geoposition(self) -> Optional[Tuple[float, float]]: */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __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, 505, __pyx_L1_error) /* "libzim.pyx":503 * raise NotImplementedError("get_keywords must be implemented.") * * def get_wordcount(self) -> int: # <<<<<<<<<<<<<< * """Number of word in content""" * raise NotImplementedError("get_wordcount must be implemented.") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.IndexData.get_wordcount", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":507 * raise NotImplementedError("get_wordcount must be implemented.") * * def get_geoposition(self) -> Optional[Tuple[float, float]]: # <<<<<<<<<<<<<< * """GeoPosition used to index the item. * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_9IndexData_11get_geoposition(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_6libzim_9IndexData_10get_geoposition[] = "GeoPosition used to index the item.\n\n Must be a tuple (latitude, longitude) or None"; static PyMethodDef __pyx_mdef_6libzim_9IndexData_11get_geoposition = {"get_geoposition", (PyCFunction)__pyx_pw_6libzim_9IndexData_11get_geoposition, METH_O, __pyx_doc_6libzim_9IndexData_10get_geoposition}; static PyObject *__pyx_pw_6libzim_9IndexData_11get_geoposition(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_geoposition (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_9IndexData_10get_geoposition(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_9IndexData_10get_geoposition(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_geoposition", 0); /* "libzim.pyx":511 * * Must be a tuple (latitude, longitude) or None""" * return None # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; /* "libzim.pyx":507 * raise NotImplementedError("get_wordcount must be implemented.") * * def get_geoposition(self) -> Optional[Tuple[float, float]]: # <<<<<<<<<<<<<< * """GeoPosition used to index the item. * */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":520 * __module__ = writer_module_name * * def __init__(self): # <<<<<<<<<<<<<< * self._blob = None * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_15BaseWritingItem_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static PyMethodDef __pyx_mdef_6libzim_15BaseWritingItem_1__init__ = {"__init__", (PyCFunction)__pyx_pw_6libzim_15BaseWritingItem_1__init__, METH_O, 0}; static PyObject *__pyx_pw_6libzim_15BaseWritingItem_1__init__(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_15BaseWritingItem___init__(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_15BaseWritingItem___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); /* "libzim.pyx":521 * * def __init__(self): * self._blob = None # <<<<<<<<<<<<<< * * def get_path(self) -> str: */ if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_blob, Py_None) < 0) __PYX_ERR(0, 521, __pyx_L1_error) /* "libzim.pyx":520 * __module__ = writer_module_name * * def __init__(self): # <<<<<<<<<<<<<< * self._blob = None * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("libzim.BaseWritingItem.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":523 * self._blob = None * * def get_path(self) -> str: # <<<<<<<<<<<<<< * """Full path of item""" * raise NotImplementedError("get_path must be implemented.") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_15BaseWritingItem_3get_path(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_6libzim_15BaseWritingItem_2get_path[] = "Full path of item"; static PyMethodDef __pyx_mdef_6libzim_15BaseWritingItem_3get_path = {"get_path", (PyCFunction)__pyx_pw_6libzim_15BaseWritingItem_3get_path, METH_O, __pyx_doc_6libzim_15BaseWritingItem_2get_path}; static PyObject *__pyx_pw_6libzim_15BaseWritingItem_3get_path(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_path (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_15BaseWritingItem_2get_path(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_15BaseWritingItem_2get_path(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_path", 0); /* "libzim.pyx":525 * def get_path(self) -> str: * """Full path of item""" * raise NotImplementedError("get_path must be implemented.") # <<<<<<<<<<<<<< * * def get_title(self) -> str: */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __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, 525, __pyx_L1_error) /* "libzim.pyx":523 * self._blob = None * * def get_path(self) -> str: # <<<<<<<<<<<<<< * """Full path of item""" * raise NotImplementedError("get_path must be implemented.") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.BaseWritingItem.get_path", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":527 * raise NotImplementedError("get_path must be implemented.") * * def get_title(self) -> str: # <<<<<<<<<<<<<< * """Item title. Might be indexed and used in suggestions""" * raise NotImplementedError("get_title must be implemented.") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_15BaseWritingItem_5get_title(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_6libzim_15BaseWritingItem_4get_title[] = "Item title. Might be indexed and used in suggestions"; static PyMethodDef __pyx_mdef_6libzim_15BaseWritingItem_5get_title = {"get_title", (PyCFunction)__pyx_pw_6libzim_15BaseWritingItem_5get_title, METH_O, __pyx_doc_6libzim_15BaseWritingItem_4get_title}; static PyObject *__pyx_pw_6libzim_15BaseWritingItem_5get_title(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_title (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_15BaseWritingItem_4get_title(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_15BaseWritingItem_4get_title(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_title", 0); /* "libzim.pyx":529 * def get_title(self) -> str: * """Item title. Might be indexed and used in suggestions""" * raise NotImplementedError("get_title must be implemented.") # <<<<<<<<<<<<<< * * def get_mimetype(self) -> str: */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __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, 529, __pyx_L1_error) /* "libzim.pyx":527 * raise NotImplementedError("get_path must be implemented.") * * def get_title(self) -> str: # <<<<<<<<<<<<<< * """Item title. Might be indexed and used in suggestions""" * raise NotImplementedError("get_title must be implemented.") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.BaseWritingItem.get_title", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":531 * raise NotImplementedError("get_title must be implemented.") * * def get_mimetype(self) -> str: # <<<<<<<<<<<<<< * """MIME-type of the item's content.""" * raise NotImplementedError("get_mimetype must be implemented.") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_15BaseWritingItem_7get_mimetype(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_6libzim_15BaseWritingItem_6get_mimetype[] = "MIME-type of the item's content."; static PyMethodDef __pyx_mdef_6libzim_15BaseWritingItem_7get_mimetype = {"get_mimetype", (PyCFunction)__pyx_pw_6libzim_15BaseWritingItem_7get_mimetype, METH_O, __pyx_doc_6libzim_15BaseWritingItem_6get_mimetype}; static PyObject *__pyx_pw_6libzim_15BaseWritingItem_7get_mimetype(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_mimetype (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_15BaseWritingItem_6get_mimetype(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_15BaseWritingItem_6get_mimetype(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_mimetype", 0); /* "libzim.pyx":533 * def get_mimetype(self) -> str: * """MIME-type of the item's content.""" * raise NotImplementedError("get_mimetype must be implemented.") # <<<<<<<<<<<<<< * * def get_contentprovider(self) -> ContentProvider: */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 533, __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, 533, __pyx_L1_error) /* "libzim.pyx":531 * raise NotImplementedError("get_title must be implemented.") * * def get_mimetype(self) -> str: # <<<<<<<<<<<<<< * """MIME-type of the item's content.""" * raise NotImplementedError("get_mimetype must be implemented.") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.BaseWritingItem.get_mimetype", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":535 * raise NotImplementedError("get_mimetype must be implemented.") * * def get_contentprovider(self) -> ContentProvider: # <<<<<<<<<<<<<< * """ContentProvider containing the complete content of the item""" * raise NotImplementedError("get_contentprovider must be implemented.") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_15BaseWritingItem_9get_contentprovider(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_6libzim_15BaseWritingItem_8get_contentprovider[] = "ContentProvider containing the complete content of the item"; static PyMethodDef __pyx_mdef_6libzim_15BaseWritingItem_9get_contentprovider = {"get_contentprovider", (PyCFunction)__pyx_pw_6libzim_15BaseWritingItem_9get_contentprovider, METH_O, __pyx_doc_6libzim_15BaseWritingItem_8get_contentprovider}; static PyObject *__pyx_pw_6libzim_15BaseWritingItem_9get_contentprovider(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_contentprovider (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_15BaseWritingItem_8get_contentprovider(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_15BaseWritingItem_8get_contentprovider(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_contentprovider", 0); /* "libzim.pyx":537 * def get_contentprovider(self) -> ContentProvider: * """ContentProvider containing the complete content of the item""" * raise NotImplementedError("get_contentprovider must be implemented.") # <<<<<<<<<<<<<< * * def get_hints(self) -> Dict[Hint, pyint]: */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __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, 537, __pyx_L1_error) /* "libzim.pyx":535 * raise NotImplementedError("get_mimetype must be implemented.") * * def get_contentprovider(self) -> ContentProvider: # <<<<<<<<<<<<<< * """ContentProvider containing the complete content of the item""" * raise NotImplementedError("get_contentprovider must be implemented.") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.BaseWritingItem.get_contentprovider", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":539 * raise NotImplementedError("get_contentprovider must be implemented.") * * def get_hints(self) -> Dict[Hint, pyint]: # <<<<<<<<<<<<<< * """Dict of Hint: value informing Creator how to handle this item""" * raise NotImplementedError("get_hints must be implemented.") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_15BaseWritingItem_11get_hints(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_6libzim_15BaseWritingItem_10get_hints[] = "Dict of Hint: value informing Creator how to handle this item"; static PyMethodDef __pyx_mdef_6libzim_15BaseWritingItem_11get_hints = {"get_hints", (PyCFunction)__pyx_pw_6libzim_15BaseWritingItem_11get_hints, METH_O, __pyx_doc_6libzim_15BaseWritingItem_10get_hints}; static PyObject *__pyx_pw_6libzim_15BaseWritingItem_11get_hints(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_hints (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_15BaseWritingItem_10get_hints(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_15BaseWritingItem_10get_hints(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_hints", 0); /* "libzim.pyx":541 * def get_hints(self) -> Dict[Hint, pyint]: * """Dict of Hint: value informing Creator how to handle this item""" * raise NotImplementedError("get_hints must be implemented.") # <<<<<<<<<<<<<< * * def __repr__(self) -> str: */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 541, __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, 541, __pyx_L1_error) /* "libzim.pyx":539 * raise NotImplementedError("get_contentprovider must be implemented.") * * def get_hints(self) -> Dict[Hint, pyint]: # <<<<<<<<<<<<<< * """Dict of Hint: value informing Creator how to handle this item""" * raise NotImplementedError("get_hints must be implemented.") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.BaseWritingItem.get_hints", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":543 * raise NotImplementedError("get_hints must be implemented.") * * def __repr__(self) -> str: # <<<<<<<<<<<<<< * return ( * f"{self.__class__.__name__}(path={self.get_path()}, " */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_15BaseWritingItem_13__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static PyMethodDef __pyx_mdef_6libzim_15BaseWritingItem_13__repr__ = {"__repr__", (PyCFunction)__pyx_pw_6libzim_15BaseWritingItem_13__repr__, METH_O, 0}; static PyObject *__pyx_pw_6libzim_15BaseWritingItem_13__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_15BaseWritingItem_12__repr__(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_15BaseWritingItem_12__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; Py_UCS4 __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__repr__", 0); /* "libzim.pyx":544 * * def __repr__(self) -> str: * return ( # <<<<<<<<<<<<<< * f"{self.__class__.__name__}(path={self.get_path()}, " * f"title={self.get_title()})" */ __Pyx_XDECREF(__pyx_r); /* "libzim.pyx":545 * def __repr__(self) -> str: * return ( * f"{self.__class__.__name__}(path={self.get_path()}, " # <<<<<<<<<<<<<< * f"title={self.get_title()})" * ) */ __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 545, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = 127; __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 545, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 545, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 545, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = 0; __Pyx_INCREF(__pyx_kp_u_path_2); __pyx_t_2 += 6; __Pyx_GIVEREF(__pyx_kp_u_path_2); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u_path_2); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 545, __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); } } __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 545, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 545, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_kp_u_title_2); __pyx_t_2 += 8; __Pyx_GIVEREF(__pyx_kp_u_title_2); PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_kp_u_title_2); /* "libzim.pyx":546 * return ( * f"{self.__class__.__name__}(path={self.get_path()}, " * f"title={self.get_title()})" # <<<<<<<<<<<<<< * ) * */ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_title); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 546, __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); } } __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 546, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 546, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_4); __pyx_t_4 = 0; __Pyx_INCREF(__pyx_kp_u__24); __pyx_t_2 += 1; __Pyx_GIVEREF(__pyx_kp_u__24); PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_kp_u__24); /* "libzim.pyx":545 * def __repr__(self) -> str: * return ( * f"{self.__class__.__name__}(path={self.get_path()}, " # <<<<<<<<<<<<<< * f"title={self.get_title()})" * ) */ __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 6, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 545, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0; /* "libzim.pyx":543 * raise NotImplementedError("get_hints must be implemented.") * * def __repr__(self) -> str: # <<<<<<<<<<<<<< * return ( * f"{self.__class__.__name__}(path={self.get_path()}, " */ /* 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_AddTraceback("libzim.BaseWritingItem.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":552 * class Creator(_Creator): * __module__ = writer_module_name * def config_compression(self, compression: Compression): # <<<<<<<<<<<<<< * if not isinstance(compression, Compression): * compression = getattr(Compression, compression.lower()) */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Creator_1config_compression(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_6libzim_7Creator_1config_compression = {"config_compression", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6libzim_7Creator_1config_compression, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_6libzim_7Creator_1config_compression(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_compression = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("config_compression (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_compression,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); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compression)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("config_compression", 1, 2, 2, 1); __PYX_ERR(0, 552, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "config_compression") < 0)) __PYX_ERR(0, 552, __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_compression = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("config_compression", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 552, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim.Creator.config_compression", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6libzim_7Creator_config_compression(__pyx_self, __pyx_v_self, __pyx_v_compression); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Creator_config_compression(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_compression) { 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("config_compression", 0); __Pyx_INCREF(__pyx_v_compression); /* "libzim.pyx":553 * __module__ = writer_module_name * def config_compression(self, compression: Compression): * if not isinstance(compression, Compression): # <<<<<<<<<<<<<< * compression = getattr(Compression, compression.lower()) * return super().config_compression(compression) */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Compression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_IsInstance(__pyx_v_compression, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0); if (__pyx_t_3) { /* "libzim.pyx":554 * def config_compression(self, compression: Compression): * if not isinstance(compression, Compression): * compression = getattr(Compression, compression.lower()) # <<<<<<<<<<<<<< * return super().config_compression(compression) * */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Compression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_compression, __pyx_n_s_lower); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 554, __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); } } __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_GetAttr(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_compression, __pyx_t_5); __pyx_t_5 = 0; /* "libzim.pyx":553 * __module__ = writer_module_name * def config_compression(self, compression: Compression): * if not isinstance(compression, Compression): # <<<<<<<<<<<<<< * compression = getattr(Compression, compression.lower()) * return super().config_compression(compression) */ } /* "libzim.pyx":555 * if not isinstance(compression, Compression): * compression = getattr(Compression, compression.lower()) * return super().config_compression(compression) # <<<<<<<<<<<<<< * * def add_metadata( */ __Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_CyFunction_GetClassObj(__pyx_self); if (!__pyx_t_4) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 555, __pyx_L1_error) } __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __Pyx_INCREF(__pyx_v_self); __Pyx_GIVEREF(__pyx_v_self); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 555, __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_config_compression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 555, __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); } } __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_compression) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_compression); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 555, __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; /* "libzim.pyx":552 * class Creator(_Creator): * __module__ = writer_module_name * def config_compression(self, compression: Compression): # <<<<<<<<<<<<<< * if not isinstance(compression, Compression): * compression = getattr(Compression, compression.lower()) */ /* 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_AddTraceback("libzim.Creator.config_compression", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_compression); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":557 * return super().config_compression(compression) * * def add_metadata( # <<<<<<<<<<<<<< * self, name: str, content: Union[str, bytes, datetime.date, datetime.datetime], * mimetype: str = "text/plain;charset=UTF-8" */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Creator_3add_metadata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_6libzim_7Creator_3add_metadata = {"add_metadata", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6libzim_7Creator_3add_metadata, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_6libzim_7Creator_3add_metadata(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_name = 0; PyObject *__pyx_v_content = 0; PyObject *__pyx_v_mimetype = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("add_metadata (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_name,&__pyx_n_s_content,&__pyx_n_s_mimetype,0}; PyObject* values[4] = {0,0,0,0}; values[3] = ((PyObject*)((PyObject*)__pyx_kp_u_text_plain_charset_UTF_8)); 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); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("add_metadata", 0, 3, 4, 1); __PYX_ERR(0, 557, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_content)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("add_metadata", 0, 3, 4, 2); __PYX_ERR(0, 557, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mimetype); if (value) { values[3] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_metadata") < 0)) __PYX_ERR(0, 557, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 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; default: goto __pyx_L5_argtuple_error; } } __pyx_v_self = values[0]; __pyx_v_name = ((PyObject*)values[1]); __pyx_v_content = values[2]; __pyx_v_mimetype = ((PyObject*)values[3]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("add_metadata", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 557, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim.Creator.add_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 1, "name", 1))) __PYX_ERR(0, 558, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mimetype), (&PyUnicode_Type), 1, "mimetype", 1))) __PYX_ERR(0, 559, __pyx_L1_error) __pyx_r = __pyx_pf_6libzim_7Creator_2add_metadata(__pyx_self, __pyx_v_self, __pyx_v_name, __pyx_v_content, __pyx_v_mimetype); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Creator_2add_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_content, PyObject *__pyx_v_mimetype) { 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; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("add_metadata", 0); __Pyx_INCREF(__pyx_v_content); /* "libzim.pyx":561 * mimetype: str = "text/plain;charset=UTF-8" * ): * if name == "Date" and isinstance(content, (datetime.date, datetime.datetime)): # <<<<<<<<<<<<<< * content = content.strftime("%Y-%m-%d").encode("UTF-8") * if isinstance(content, str): */ __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_n_u_Date, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 561, __pyx_L1_error) __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_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 561, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_date); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 561, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_datetime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 561, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_datetime); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 561, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = PyObject_IsInstance(__pyx_v_content, __pyx_t_5); __pyx_t_7 = (__pyx_t_2 != 0); if (!__pyx_t_7) { } else { __pyx_t_3 = __pyx_t_7; goto __pyx_L6_bool_binop_done; } __pyx_t_7 = PyObject_IsInstance(__pyx_v_content, __pyx_t_6); __pyx_t_2 = (__pyx_t_7 != 0); __pyx_t_3 = __pyx_t_2; __pyx_L6_bool_binop_done:; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = (__pyx_t_3 != 0); __pyx_t_1 = __pyx_t_2; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { /* "libzim.pyx":562 * ): * if name == "Date" and isinstance(content, (datetime.date, datetime.datetime)): * content = content.strftime("%Y-%m-%d").encode("UTF-8") # <<<<<<<<<<<<<< * if isinstance(content, str): * content = content.encode("UTF-8") */ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_content, __pyx_n_s_strftime); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 562, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __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); } } __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_8, __pyx_kp_u_Y_m_d) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_Y_m_d); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 562, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 562, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __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); } } __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_UTF_8); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; 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_SET(__pyx_v_content, __pyx_t_5); __pyx_t_5 = 0; /* "libzim.pyx":561 * mimetype: str = "text/plain;charset=UTF-8" * ): * if name == "Date" and isinstance(content, (datetime.date, datetime.datetime)): # <<<<<<<<<<<<<< * content = content.strftime("%Y-%m-%d").encode("UTF-8") * if isinstance(content, str): */ } /* "libzim.pyx":563 * if name == "Date" and isinstance(content, (datetime.date, datetime.datetime)): * content = content.strftime("%Y-%m-%d").encode("UTF-8") * if isinstance(content, str): # <<<<<<<<<<<<<< * content = content.encode("UTF-8") * super().add_metadata(name=name, content=content, mimetype=mimetype) */ __pyx_t_1 = PyUnicode_Check(__pyx_v_content); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* "libzim.pyx":564 * content = content.strftime("%Y-%m-%d").encode("UTF-8") * if isinstance(content, str): * content = content.encode("UTF-8") # <<<<<<<<<<<<<< * super().add_metadata(name=name, content=content, mimetype=mimetype) * */ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_content, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 564, __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); } } __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_u_UTF_8); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_content, __pyx_t_5); __pyx_t_5 = 0; /* "libzim.pyx":563 * if name == "Date" and isinstance(content, (datetime.date, datetime.datetime)): * content = content.strftime("%Y-%m-%d").encode("UTF-8") * if isinstance(content, str): # <<<<<<<<<<<<<< * content = content.encode("UTF-8") * super().add_metadata(name=name, content=content, mimetype=mimetype) */ } /* "libzim.pyx":565 * if isinstance(content, str): * content = content.encode("UTF-8") * super().add_metadata(name=name, content=content, mimetype=mimetype) # <<<<<<<<<<<<<< * * def __repr__(self) -> str: */ __pyx_t_5 = __Pyx_CyFunction_GetClassObj(__pyx_self); if (!__pyx_t_5) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 565, __pyx_L1_error) } __Pyx_INCREF(__pyx_t_5); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 565, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_INCREF(__pyx_v_self); __Pyx_GIVEREF(__pyx_v_self); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 565, __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_add_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 565, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 565, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_name, __pyx_v_name) < 0) __PYX_ERR(0, 565, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_content, __pyx_v_content) < 0) __PYX_ERR(0, 565, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_mimetype, __pyx_v_mimetype) < 0) __PYX_ERR(0, 565, __pyx_L1_error) __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 565, __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_6); __pyx_t_6 = 0; /* "libzim.pyx":557 * return super().config_compression(compression) * * def add_metadata( # <<<<<<<<<<<<<< * self, name: str, content: Union[str, bytes, datetime.date, datetime.datetime], * mimetype: str = "text/plain;charset=UTF-8" */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("libzim.Creator.add_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_content); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":567 * super().add_metadata(name=name, content=content, mimetype=mimetype) * * def __repr__(self) -> str: # <<<<<<<<<<<<<< * return f"Creator(filename={self.filename})" * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Creator_5__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static PyMethodDef __pyx_mdef_6libzim_7Creator_5__repr__ = {"__repr__", (PyCFunction)__pyx_pw_6libzim_7Creator_5__repr__, METH_O, 0}; static PyObject *__pyx_pw_6libzim_7Creator_5__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Creator_4__repr__(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Creator_4__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; Py_UCS4 __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__repr__", 0); /* "libzim.pyx":568 * * def __repr__(self) -> str: * return f"Creator(filename={self.filename})" # <<<<<<<<<<<<<< * * writer_module_doc = """libzim writer module */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = 127; __Pyx_INCREF(__pyx_kp_u_Creator_filename); __pyx_t_2 += 17; __Pyx_GIVEREF(__pyx_kp_u_Creator_filename); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Creator_filename); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 568, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 568, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_kp_u__24); __pyx_t_2 += 1; __Pyx_GIVEREF(__pyx_kp_u__24); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__24); __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 568, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L0; /* "libzim.pyx":567 * super().add_metadata(name=name, content=content, mimetype=mimetype) * * def __repr__(self) -> str: # <<<<<<<<<<<<<< * return f"Creator(filename={self.filename})" * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("libzim.Creator.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":615 * # Factory functions - Currently Cython can't use classmethods * @staticmethod * cdef from_blob(zim.Blob blob): # <<<<<<<<<<<<<< * """Creates a python Blob from a C++ Blob (zim::) -> Blob * */ static PyObject *__pyx_f_6libzim_11ReadingBlob_from_blob(wrapper::Blob __pyx_v_blob) { struct __pyx_obj_6libzim_ReadingBlob *__pyx_v_rblob = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; uint64_t __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("from_blob", 0); /* "libzim.pyx":626 * Blob * Casted blob""" * cdef ReadingBlob rblob = ReadingBlob() # <<<<<<<<<<<<<< * rblob.c_blob = move(blob) * rblob.size = rblob.c_blob.size() */ __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6libzim_ReadingBlob)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_rblob = ((struct __pyx_obj_6libzim_ReadingBlob *)__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":627 * Casted blob""" * cdef ReadingBlob rblob = ReadingBlob() * rblob.c_blob = move(blob) # <<<<<<<<<<<<<< * rblob.size = rblob.c_blob.size() * rblob.view_count = 0 */ __pyx_v_rblob->c_blob = cython_std::move(__pyx_v_blob); /* "libzim.pyx":628 * cdef ReadingBlob rblob = ReadingBlob() * rblob.c_blob = move(blob) * rblob.size = rblob.c_blob.size() # <<<<<<<<<<<<<< * rblob.view_count = 0 * return rblob */ try { __pyx_t_2 = __pyx_v_rblob->c_blob.size(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 628, __pyx_L1_error) } __pyx_v_rblob->size = __pyx_t_2; /* "libzim.pyx":629 * rblob.c_blob = move(blob) * rblob.size = rblob.c_blob.size() * rblob.view_count = 0 # <<<<<<<<<<<<<< * return rblob * */ __pyx_v_rblob->view_count = 0; /* "libzim.pyx":630 * rblob.size = rblob.c_blob.size() * rblob.view_count = 0 * return rblob # <<<<<<<<<<<<<< * * def __dealloc__(self): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_rblob)); __pyx_r = ((PyObject *)__pyx_v_rblob); goto __pyx_L0; /* "libzim.pyx":615 * # Factory functions - Currently Cython can't use classmethods * @staticmethod * cdef from_blob(zim.Blob blob): # <<<<<<<<<<<<<< * """Creates a python Blob from a C++ Blob (zim::) -> Blob * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.ReadingBlob.from_blob", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_rblob); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":632 * return rblob * * def __dealloc__(self): # <<<<<<<<<<<<<< * if self.view_count: * raise RuntimeError("Blob has views") */ /* Python wrapper */ static void __pyx_pw_6libzim_11ReadingBlob_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_6libzim_11ReadingBlob_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_6libzim_11ReadingBlob___dealloc__(((struct __pyx_obj_6libzim_ReadingBlob *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_6libzim_11ReadingBlob___dealloc__(struct __pyx_obj_6libzim_ReadingBlob *__pyx_v_self) { __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__dealloc__", 0); /* "libzim.pyx":633 * * def __dealloc__(self): * if self.view_count: # <<<<<<<<<<<<<< * raise RuntimeError("Blob has views") * */ __pyx_t_1 = (__pyx_v_self->view_count != 0); if (unlikely(__pyx_t_1)) { /* "libzim.pyx":634 * def __dealloc__(self): * if self.view_count: * raise RuntimeError("Blob has views") # <<<<<<<<<<<<<< * * def __getbuffer__(self, Py_buffer *buffer, int flags): */ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 634, __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, 634, __pyx_L1_error) /* "libzim.pyx":633 * * def __dealloc__(self): * if self.view_count: # <<<<<<<<<<<<<< * raise RuntimeError("Blob has views") * */ } /* "libzim.pyx":632 * return rblob * * def __dealloc__(self): # <<<<<<<<<<<<<< * if self.view_count: * raise RuntimeError("Blob has views") */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_WriteUnraisable("libzim.ReadingBlob.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* "libzim.pyx":636 * raise RuntimeError("Blob has views") * * def __getbuffer__(self, Py_buffer *buffer, int flags): # <<<<<<<<<<<<<< * if flags&PyBUF_WRITABLE: * raise BufferError("Cannot create writable memoryview on readonly data") */ /* Python wrapper */ static CYTHON_UNUSED int __pyx_pw_6libzim_11ReadingBlob_3__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pw_6libzim_11ReadingBlob_3__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_11ReadingBlob_2__getbuffer__(((struct __pyx_obj_6libzim_ReadingBlob *)__pyx_v_self), ((Py_buffer *)__pyx_v_buffer), ((int)__pyx_v_flags)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6libzim_11ReadingBlob_2__getbuffer__(struct __pyx_obj_6libzim_ReadingBlob *__pyx_v_self, Py_buffer *__pyx_v_buffer, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; char const *__pyx_t_3; Py_ssize_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; if (__pyx_v_buffer == NULL) { PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); return -1; } __Pyx_RefNannySetupContext("__getbuffer__", 0); __pyx_v_buffer->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_buffer->obj); /* "libzim.pyx":637 * * def __getbuffer__(self, Py_buffer *buffer, int flags): * if flags&PyBUF_WRITABLE: # <<<<<<<<<<<<<< * raise BufferError("Cannot create writable memoryview on readonly data") * buffer.obj = self */ __pyx_t_1 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0); if (unlikely(__pyx_t_1)) { /* "libzim.pyx":638 * def __getbuffer__(self, Py_buffer *buffer, int flags): * if flags&PyBUF_WRITABLE: * raise BufferError("Cannot create writable memoryview on readonly data") # <<<<<<<<<<<<<< * buffer.obj = self * buffer.buf = self.c_blob.data() */ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_BufferError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 638, __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, 638, __pyx_L1_error) /* "libzim.pyx":637 * * def __getbuffer__(self, Py_buffer *buffer, int flags): * if flags&PyBUF_WRITABLE: # <<<<<<<<<<<<<< * raise BufferError("Cannot create writable memoryview on readonly data") * buffer.obj = self */ } /* "libzim.pyx":639 * if flags&PyBUF_WRITABLE: * raise BufferError("Cannot create writable memoryview on readonly data") * buffer.obj = self # <<<<<<<<<<<<<< * buffer.buf = self.c_blob.data() * buffer.len = self.size */ __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_buffer->obj); __Pyx_DECREF(__pyx_v_buffer->obj); __pyx_v_buffer->obj = ((PyObject *)__pyx_v_self); /* "libzim.pyx":640 * raise BufferError("Cannot create writable memoryview on readonly data") * buffer.obj = self * buffer.buf = self.c_blob.data() # <<<<<<<<<<<<<< * buffer.len = self.size * buffer.readonly = 1 */ try { __pyx_t_3 = __pyx_v_self->c_blob.data(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 640, __pyx_L1_error) } __pyx_v_buffer->buf = ((void *)__pyx_t_3); /* "libzim.pyx":641 * buffer.obj = self * buffer.buf = self.c_blob.data() * buffer.len = self.size # <<<<<<<<<<<<<< * buffer.readonly = 1 * buffer.format = 'c' */ __pyx_t_4 = __pyx_v_self->size; __pyx_v_buffer->len = __pyx_t_4; /* "libzim.pyx":642 * buffer.buf = self.c_blob.data() * buffer.len = self.size * buffer.readonly = 1 # <<<<<<<<<<<<<< * buffer.format = 'c' * buffer.internal = NULL # see References */ __pyx_v_buffer->readonly = 1; /* "libzim.pyx":643 * buffer.len = self.size * buffer.readonly = 1 * buffer.format = 'c' # <<<<<<<<<<<<<< * buffer.internal = NULL # see References * buffer.itemsize = itemsize */ __pyx_v_buffer->format = ((char *)"c"); /* "libzim.pyx":644 * buffer.readonly = 1 * buffer.format = 'c' * buffer.internal = NULL # see References # <<<<<<<<<<<<<< * buffer.itemsize = itemsize * buffer.ndim = 1 */ __pyx_v_buffer->internal = NULL; /* "libzim.pyx":645 * buffer.format = 'c' * buffer.internal = NULL # see References * buffer.itemsize = itemsize # <<<<<<<<<<<<<< * buffer.ndim = 1 * buffer.shape = &self.size */ __pyx_v_buffer->itemsize = __pyx_v_6libzim_itemsize; /* "libzim.pyx":646 * buffer.internal = NULL # see References * buffer.itemsize = itemsize * buffer.ndim = 1 # <<<<<<<<<<<<<< * buffer.shape = &self.size * buffer.strides = &itemsize */ __pyx_v_buffer->ndim = 1; /* "libzim.pyx":647 * buffer.itemsize = itemsize * buffer.ndim = 1 * buffer.shape = &self.size # <<<<<<<<<<<<<< * buffer.strides = &itemsize * buffer.suboffsets = NULL # for pointer arrays only */ __pyx_v_buffer->shape = (&__pyx_v_self->size); /* "libzim.pyx":648 * buffer.ndim = 1 * buffer.shape = &self.size * buffer.strides = &itemsize # <<<<<<<<<<<<<< * buffer.suboffsets = NULL # for pointer arrays only * */ __pyx_v_buffer->strides = (&__pyx_v_6libzim_itemsize); /* "libzim.pyx":649 * buffer.shape = &self.size * buffer.strides = &itemsize * buffer.suboffsets = NULL # for pointer arrays only # <<<<<<<<<<<<<< * * self.view_count += 1 */ __pyx_v_buffer->suboffsets = NULL; /* "libzim.pyx":651 * buffer.suboffsets = NULL # for pointer arrays only * * self.view_count += 1 # <<<<<<<<<<<<<< * * def __releasebuffer__(self, Py_buffer *buffer): */ __pyx_v_self->view_count = (__pyx_v_self->view_count + 1); /* "libzim.pyx":636 * raise RuntimeError("Blob has views") * * def __getbuffer__(self, Py_buffer *buffer, int flags): # <<<<<<<<<<<<<< * if flags&PyBUF_WRITABLE: * raise BufferError("Cannot create writable memoryview on readonly data") */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.ReadingBlob.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_buffer->obj != NULL) { __Pyx_GOTREF(__pyx_v_buffer->obj); __Pyx_DECREF(__pyx_v_buffer->obj); __pyx_v_buffer->obj = 0; } goto __pyx_L2; __pyx_L0:; if (__pyx_v_buffer->obj == Py_None) { __Pyx_GOTREF(__pyx_v_buffer->obj); __Pyx_DECREF(__pyx_v_buffer->obj); __pyx_v_buffer->obj = 0; } __pyx_L2:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":653 * self.view_count += 1 * * def __releasebuffer__(self, Py_buffer *buffer): # <<<<<<<<<<<<<< * self.view_count -= 1 * */ /* Python wrapper */ static CYTHON_UNUSED void __pyx_pw_6libzim_11ReadingBlob_5__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer); /*proto*/ static CYTHON_UNUSED void __pyx_pw_6libzim_11ReadingBlob_5__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_buffer) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); __pyx_pf_6libzim_11ReadingBlob_4__releasebuffer__(((struct __pyx_obj_6libzim_ReadingBlob *)__pyx_v_self), ((Py_buffer *)__pyx_v_buffer)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_6libzim_11ReadingBlob_4__releasebuffer__(struct __pyx_obj_6libzim_ReadingBlob *__pyx_v_self, CYTHON_UNUSED Py_buffer *__pyx_v_buffer) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__releasebuffer__", 0); /* "libzim.pyx":654 * * def __releasebuffer__(self, Py_buffer *buffer): * self.view_count -= 1 # <<<<<<<<<<<<<< * * */ __pyx_v_self->view_count = (__pyx_v_self->view_count - 1); /* "libzim.pyx":653 * self.view_count += 1 * * def __releasebuffer__(self, Py_buffer *buffer): # <<<<<<<<<<<<<< * self.view_count -= 1 * */ /* function exit code */ __Pyx_RefNannyFinishContext(); } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("self.c_blob cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_11ReadingBlob_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_6libzim_11ReadingBlob_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_11ReadingBlob_6__reduce_cython__(((struct __pyx_obj_6libzim_ReadingBlob *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_11ReadingBlob_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_ReadingBlob *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("self.c_blob cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_blob cannot be converted to a Python object for pickling") */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("self.c_blob cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.ReadingBlob.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("self.c_blob cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("self.c_blob cannot be converted to a Python object for pickling") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_11ReadingBlob_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ static PyObject *__pyx_pw_6libzim_11ReadingBlob_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_11ReadingBlob_8__setstate_cython__(((struct __pyx_obj_6libzim_ReadingBlob *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_11ReadingBlob_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_ReadingBlob *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError("self.c_blob cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_blob cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("self.c_blob cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("self.c_blob cannot be converted to a Python object for pickling") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.ReadingBlob.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":669 * # Factory functions - Currently Cython can't use classmethods * @staticmethod * cdef from_entry(zim.Entry ent): # <<<<<<<<<<<<<< * """Creates a python Entry from a C++ Entry (zim::) -> Entry * */ static PyObject *__pyx_f_6libzim_5Entry_from_entry(wrapper::Entry __pyx_v_ent) { struct __pyx_obj_6libzim_Entry *__pyx_v_entry = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("from_entry", 0); /* "libzim.pyx":680 * Entry * Casted entry""" * cdef Entry entry = Entry() # <<<<<<<<<<<<<< * entry.c_entry = move(ent) * return entry */ __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6libzim_Entry)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_entry = ((struct __pyx_obj_6libzim_Entry *)__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":681 * Casted entry""" * cdef Entry entry = Entry() * entry.c_entry = move(ent) # <<<<<<<<<<<<<< * return entry * */ __pyx_v_entry->c_entry = cython_std::move(__pyx_v_ent); /* "libzim.pyx":682 * cdef Entry entry = Entry() * entry.c_entry = move(ent) * return entry # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_entry)); __pyx_r = ((PyObject *)__pyx_v_entry); goto __pyx_L0; /* "libzim.pyx":669 * # Factory functions - Currently Cython can't use classmethods * @staticmethod * cdef from_entry(zim.Entry ent): # <<<<<<<<<<<<<< * """Creates a python Entry from a C++ Entry (zim::) -> Entry * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Entry.from_entry", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_entry); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":685 * * @property * def title(self) -> str: # <<<<<<<<<<<<<< * return self.c_entry.getTitle().decode('UTF-8') * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_5Entry_5title_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_5Entry_5title_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_5Entry_5title___get__(((struct __pyx_obj_6libzim_Entry *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_5Entry_5title___get__(struct __pyx_obj_6libzim_Entry *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":686 * @property * def title(self) -> str: * return self.c_entry.getTitle().decode('UTF-8') # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_v_self->c_entry.getTitle(), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 686, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "libzim.pyx":685 * * @property * def title(self) -> str: # <<<<<<<<<<<<<< * return self.c_entry.getTitle().decode('UTF-8') * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Entry.title.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":689 * * @property * def path(self) -> str: # <<<<<<<<<<<<<< * return self.c_entry.getPath().decode("UTF-8", "strict") * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_5Entry_4path_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_5Entry_4path_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_5Entry_4path___get__(((struct __pyx_obj_6libzim_Entry *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_5Entry_4path___get__(struct __pyx_obj_6libzim_Entry *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations std::string __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":690 * @property * def path(self) -> str: * return self.c_entry.getPath().decode("UTF-8", "strict") # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_entry.getPath(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 690, __pyx_L1_error) } __pyx_t_2 = __Pyx_decode_cpp_string(__pyx_t_1, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 690, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":689 * * @property * def path(self) -> str: # <<<<<<<<<<<<<< * return self.c_entry.getPath().decode("UTF-8", "strict") * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Entry.path.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":693 * * @property * def _index(self) -> pyint: # <<<<<<<<<<<<<< * """Internal index in Archive""" * return self.c_entry.getIndex() */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_5Entry_6_index_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_5Entry_6_index_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_5Entry_6_index___get__(((struct __pyx_obj_6libzim_Entry *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_5Entry_6_index___get__(struct __pyx_obj_6libzim_Entry *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":695 * def _index(self) -> pyint: * """Internal index in Archive""" * return self.c_entry.getIndex() # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_entry.getIndex(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 695, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":693 * * @property * def _index(self) -> pyint: # <<<<<<<<<<<<<< * """Internal index in Archive""" * return self.c_entry.getIndex() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Entry._index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":698 * * @property * def is_redirect(self) -> pybool: # <<<<<<<<<<<<<< * """Whether entry is a redirect""" * return self.c_entry.isRedirect() */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_5Entry_11is_redirect_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_5Entry_11is_redirect_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_5Entry_11is_redirect___get__(((struct __pyx_obj_6libzim_Entry *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_5Entry_11is_redirect___get__(struct __pyx_obj_6libzim_Entry *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":700 * def is_redirect(self) -> pybool: * """Whether entry is a redirect""" * return self.c_entry.isRedirect() # <<<<<<<<<<<<<< * * def get_redirect_entry(self) -> Entry: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->c_entry.isRedirect()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 700, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "libzim.pyx":698 * * @property * def is_redirect(self) -> pybool: # <<<<<<<<<<<<<< * """Whether entry is a redirect""" * return self.c_entry.isRedirect() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Entry.is_redirect.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":702 * return self.c_entry.isRedirect() * * def get_redirect_entry(self) -> Entry: # <<<<<<<<<<<<<< * """Target of this entry, if a redirect""" * cdef zim.Entry entry = move(self.c_entry.getRedirectEntry()) */ /* Python wrapper */ static struct __pyx_obj_6libzim_Entry *__pyx_pw_6libzim_5Entry_1get_redirect_entry(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6libzim_5Entry_get_redirect_entry[] = "Target of this entry, if a redirect"; static struct __pyx_obj_6libzim_Entry *__pyx_pw_6libzim_5Entry_1get_redirect_entry(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { struct __pyx_obj_6libzim_Entry *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_redirect_entry (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_5Entry_get_redirect_entry(((struct __pyx_obj_6libzim_Entry *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_obj_6libzim_Entry *__pyx_pf_6libzim_5Entry_get_redirect_entry(struct __pyx_obj_6libzim_Entry *__pyx_v_self) { wrapper::Entry __pyx_v_entry; struct __pyx_obj_6libzim_Entry *__pyx_r = NULL; __Pyx_RefNannyDeclarations wrapper::Entry __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_redirect_entry", 0); /* "libzim.pyx":704 * def get_redirect_entry(self) -> Entry: * """Target of this entry, if a redirect""" * cdef zim.Entry entry = move(self.c_entry.getRedirectEntry()) # <<<<<<<<<<<<<< * return Entry.from_entry(move(entry)) * */ try { __pyx_t_1 = __pyx_v_self->c_entry.getRedirectEntry(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 704, __pyx_L1_error) } __pyx_v_entry = cython_std::move(__pyx_t_1); /* "libzim.pyx":705 * """Target of this entry, if a redirect""" * cdef zim.Entry entry = move(self.c_entry.getRedirectEntry()) * return Entry.from_entry(move(entry)) # <<<<<<<<<<<<<< * * def get_item(self) -> Item: */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_2 = __pyx_f_6libzim_5Entry_from_entry(cython_std::move(__pyx_v_entry)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 705, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6libzim_Entry))))) __PYX_ERR(0, 705, __pyx_L1_error) __pyx_r = ((struct __pyx_obj_6libzim_Entry *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":702 * return self.c_entry.isRedirect() * * def get_redirect_entry(self) -> Entry: # <<<<<<<<<<<<<< * """Target of this entry, if a redirect""" * cdef zim.Entry entry = move(self.c_entry.getRedirectEntry()) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Entry.get_redirect_entry", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":707 * return Entry.from_entry(move(entry)) * * def get_item(self) -> Item: # <<<<<<<<<<<<<< * cdef zim.Item item = move(self.c_entry.getItem(True)) * return Item.from_item(move(item)) */ /* Python wrapper */ static struct __pyx_obj_6libzim_Item *__pyx_pw_6libzim_5Entry_3get_item(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static struct __pyx_obj_6libzim_Item *__pyx_pw_6libzim_5Entry_3get_item(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { struct __pyx_obj_6libzim_Item *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_item (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_5Entry_2get_item(((struct __pyx_obj_6libzim_Entry *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_obj_6libzim_Item *__pyx_pf_6libzim_5Entry_2get_item(struct __pyx_obj_6libzim_Entry *__pyx_v_self) { wrapper::Item __pyx_v_item; struct __pyx_obj_6libzim_Item *__pyx_r = NULL; __Pyx_RefNannyDeclarations wrapper::Item __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_item", 0); /* "libzim.pyx":708 * * def get_item(self) -> Item: * cdef zim.Item item = move(self.c_entry.getItem(True)) # <<<<<<<<<<<<<< * return Item.from_item(move(item)) * */ try { __pyx_t_1 = __pyx_v_self->c_entry.getItem(1); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 708, __pyx_L1_error) } __pyx_v_item = cython_std::move(__pyx_t_1); /* "libzim.pyx":709 * def get_item(self) -> Item: * cdef zim.Item item = move(self.c_entry.getItem(True)) * return Item.from_item(move(item)) # <<<<<<<<<<<<<< * * def __repr__(self) -> str: */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_2 = __pyx_f_6libzim_4Item_from_item(cython_std::move(__pyx_v_item)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 709, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6libzim_Item))))) __PYX_ERR(0, 709, __pyx_L1_error) __pyx_r = ((struct __pyx_obj_6libzim_Item *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":707 * return Entry.from_entry(move(entry)) * * def get_item(self) -> Item: # <<<<<<<<<<<<<< * cdef zim.Item item = move(self.c_entry.getItem(True)) * return Item.from_item(move(item)) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Entry.get_item", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":711 * return Item.from_item(move(item)) * * def __repr__(self) -> str: # <<<<<<<<<<<<<< * return f"{self.__class__.__name__}(url={self.path}, title={self.title})" * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_5Entry_5__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_5Entry_5__repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_5Entry_4__repr__(((struct __pyx_obj_6libzim_Entry *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_5Entry_4__repr__(struct __pyx_obj_6libzim_Entry *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; Py_UCS4 __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__repr__", 0); /* "libzim.pyx":712 * * def __repr__(self) -> str: * return f"{self.__class__.__name__}(url={self.path}, title={self.title})" # <<<<<<<<<<<<<< * * cdef class Item: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 712, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = 127; __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 712, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 712, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 712, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = 0; __Pyx_INCREF(__pyx_kp_u_url); __pyx_t_2 += 5; __Pyx_GIVEREF(__pyx_kp_u_url); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u_url); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 712, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 712, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_kp_u_title_2); __pyx_t_2 += 8; __Pyx_GIVEREF(__pyx_kp_u_title_2); PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_kp_u_title_2); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_title); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 712, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 712, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_4); __pyx_t_4 = 0; __Pyx_INCREF(__pyx_kp_u__24); __pyx_t_2 += 1; __Pyx_GIVEREF(__pyx_kp_u__24); PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_kp_u__24); __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 6, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 712, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; /* "libzim.pyx":711 * return Item.from_item(move(item)) * * def __repr__(self) -> str: # <<<<<<<<<<<<<< * return f"{self.__class__.__name__}(url={self.path}, title={self.title})" * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("libzim.Entry.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("self.c_entry cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_5Entry_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_6libzim_5Entry_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_5Entry_6__reduce_cython__(((struct __pyx_obj_6libzim_Entry *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_5Entry_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Entry *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("self.c_entry cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_entry cannot be converted to a Python object for pickling") */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("self.c_entry cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Entry.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("self.c_entry cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("self.c_entry cannot be converted to a Python object for pickling") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_5Entry_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ static PyObject *__pyx_pw_6libzim_5Entry_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_5Entry_8__setstate_cython__(((struct __pyx_obj_6libzim_Entry *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_5Entry_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Entry *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError("self.c_entry cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_entry cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("self.c_entry cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("self.c_entry cannot be converted to a Python object for pickling") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Entry.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":728 * # Factory functions - Currently Cython can't use classmethods * @staticmethod * cdef from_item(zim.Item _item): # <<<<<<<<<<<<<< * """Creates a python ReadArticle from a C++ Article (zim::) -> ReadArticle * */ static PyObject *__pyx_f_6libzim_4Item_from_item(wrapper::Item __pyx_v__item) { struct __pyx_obj_6libzim_Item *__pyx_v_item = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("from_item", 0); /* "libzim.pyx":739 * Item * Casted item""" * cdef Item item = Item() # <<<<<<<<<<<<<< * item.c_item = move(_item) * return item */ __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6libzim_Item)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 739, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_item = ((struct __pyx_obj_6libzim_Item *)__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":740 * Casted item""" * cdef Item item = Item() * item.c_item = move(_item) # <<<<<<<<<<<<<< * return item * */ __pyx_v_item->c_item = cython_std::move(__pyx_v__item); /* "libzim.pyx":741 * cdef Item item = Item() * item.c_item = move(_item) * return item # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_item)); __pyx_r = ((PyObject *)__pyx_v_item); goto __pyx_L0; /* "libzim.pyx":728 * # Factory functions - Currently Cython can't use classmethods * @staticmethod * cdef from_item(zim.Item _item): # <<<<<<<<<<<<<< * """Creates a python ReadArticle from a C++ Article (zim::) -> ReadArticle * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Item.from_item", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_item); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":744 * * @property * def title(self) -> str: # <<<<<<<<<<<<<< * return self.c_item.getTitle().decode('UTF-8') * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_4Item_5title_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_4Item_5title_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_4Item_5title___get__(((struct __pyx_obj_6libzim_Item *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_4Item_5title___get__(struct __pyx_obj_6libzim_Item *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations std::string __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":745 * @property * def title(self) -> str: * return self.c_item.getTitle().decode('UTF-8') # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_item.getTitle(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 745, __pyx_L1_error) } __pyx_t_2 = __Pyx_decode_cpp_string(__pyx_t_1, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 745, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":744 * * @property * def title(self) -> str: # <<<<<<<<<<<<<< * return self.c_item.getTitle().decode('UTF-8') * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Item.title.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":748 * * @property * def path(self) -> str: # <<<<<<<<<<<<<< * return self.c_item.getPath().decode("UTF-8", "strict") * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_4Item_4path_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_4Item_4path_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_4Item_4path___get__(((struct __pyx_obj_6libzim_Item *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_4Item_4path___get__(struct __pyx_obj_6libzim_Item *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations std::string __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":749 * @property * def path(self) -> str: * return self.c_item.getPath().decode("UTF-8", "strict") # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_item.getPath(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 749, __pyx_L1_error) } __pyx_t_2 = __Pyx_decode_cpp_string(__pyx_t_1, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 749, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":748 * * @property * def path(self) -> str: # <<<<<<<<<<<<<< * return self.c_item.getPath().decode("UTF-8", "strict") * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Item.path.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":752 * * @property * def content(self) -> memoryview: # <<<<<<<<<<<<<< * if not self._haveBlob: * self._blob = ReadingBlob.from_blob(move(self.c_item.getData( 0))) */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_4Item_7content_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_4Item_7content_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_4Item_7content___get__(((struct __pyx_obj_6libzim_Item *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_4Item_7content___get__(struct __pyx_obj_6libzim_Item *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; wrapper::Blob __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":753 * @property * def content(self) -> memoryview: * if not self._haveBlob: # <<<<<<<<<<<<<< * self._blob = ReadingBlob.from_blob(move(self.c_item.getData( 0))) * self._haveBlob = True */ __pyx_t_1 = ((!(__pyx_v_self->_haveBlob != 0)) != 0); if (__pyx_t_1) { /* "libzim.pyx":754 * def content(self) -> memoryview: * if not self._haveBlob: * self._blob = ReadingBlob.from_blob(move(self.c_item.getData( 0))) # <<<<<<<<<<<<<< * self._haveBlob = True * return memoryview(self._blob) */ try { __pyx_t_2 = __pyx_v_self->c_item.getData(((int)0)); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 754, __pyx_L1_error) } __pyx_t_3 = __pyx_f_6libzim_11ReadingBlob_from_blob(cython_std::move(__pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 754, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6libzim_ReadingBlob))))) __PYX_ERR(0, 754, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->_blob); __Pyx_DECREF(((PyObject *)__pyx_v_self->_blob)); __pyx_v_self->_blob = ((struct __pyx_obj_6libzim_ReadingBlob *)__pyx_t_3); __pyx_t_3 = 0; /* "libzim.pyx":755 * if not self._haveBlob: * self._blob = ReadingBlob.from_blob(move(self.c_item.getData( 0))) * self._haveBlob = True # <<<<<<<<<<<<<< * return memoryview(self._blob) * */ __pyx_v_self->_haveBlob = 1; /* "libzim.pyx":753 * @property * def content(self) -> memoryview: * if not self._haveBlob: # <<<<<<<<<<<<<< * self._blob = ReadingBlob.from_blob(move(self.c_item.getData( 0))) * self._haveBlob = True */ } /* "libzim.pyx":756 * self._blob = ReadingBlob.from_blob(move(self.c_item.getData( 0))) * self._haveBlob = True * return memoryview(self._blob) # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_memoryview); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_self->_blob)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 756, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; /* "libzim.pyx":752 * * @property * def content(self) -> memoryview: # <<<<<<<<<<<<<< * if not self._haveBlob: * self._blob = ReadingBlob.from_blob(move(self.c_item.getData( 0))) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("libzim.Item.content.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":759 * * @property * def mimetype(self) -> str: # <<<<<<<<<<<<<< * return self.c_item.getMimetype().decode('UTF-8') * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_4Item_8mimetype_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_4Item_8mimetype_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_4Item_8mimetype___get__(((struct __pyx_obj_6libzim_Item *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_4Item_8mimetype___get__(struct __pyx_obj_6libzim_Item *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations std::string __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":760 * @property * def mimetype(self) -> str: * return self.c_item.getMimetype().decode('UTF-8') # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_item.getMimetype(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 760, __pyx_L1_error) } __pyx_t_2 = __Pyx_decode_cpp_string(__pyx_t_1, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 760, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":759 * * @property * def mimetype(self) -> str: # <<<<<<<<<<<<<< * return self.c_item.getMimetype().decode('UTF-8') * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Item.mimetype.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":763 * * @property * def _index(self) -> pyint: # <<<<<<<<<<<<<< * """Internal index in Archive""" * return self.c_item.getIndex() */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_4Item_6_index_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_4Item_6_index_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_4Item_6_index___get__(((struct __pyx_obj_6libzim_Item *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_4Item_6_index___get__(struct __pyx_obj_6libzim_Item *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":765 * def _index(self) -> pyint: * """Internal index in Archive""" * return self.c_item.getIndex() # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_item.getIndex(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 765, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 765, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":763 * * @property * def _index(self) -> pyint: # <<<<<<<<<<<<<< * """Internal index in Archive""" * return self.c_item.getIndex() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Item._index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":768 * * @property * def size(self) -> pyint: # <<<<<<<<<<<<<< * return self.c_item.getSize() * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_4Item_4size_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_4Item_4size_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_4Item_4size___get__(((struct __pyx_obj_6libzim_Item *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_4Item_4size___get__(struct __pyx_obj_6libzim_Item *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations zim::size_type __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":769 * @property * def size(self) -> pyint: * return self.c_item.getSize() # <<<<<<<<<<<<<< * * def __repr__(self) -> str: */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_item.getSize(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 769, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 769, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":768 * * @property * def size(self) -> pyint: # <<<<<<<<<<<<<< * return self.c_item.getSize() * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Item.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":771 * return self.c_item.getSize() * * def __repr__(self) -> str: # <<<<<<<<<<<<<< * return f"{self.__class__.__name__}(url={self.path}, title={self.title})" * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_4Item_1__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_4Item_1__repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_4Item___repr__(((struct __pyx_obj_6libzim_Item *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_4Item___repr__(struct __pyx_obj_6libzim_Item *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; Py_UCS4 __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__repr__", 0); /* "libzim.pyx":772 * * def __repr__(self) -> str: * return f"{self.__class__.__name__}(url={self.path}, title={self.title})" # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = 127; __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = 0; __Pyx_INCREF(__pyx_kp_u_url); __pyx_t_2 += 5; __Pyx_GIVEREF(__pyx_kp_u_url); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u_url); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_kp_u_title_2); __pyx_t_2 += 8; __Pyx_GIVEREF(__pyx_kp_u_title_2); PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_kp_u_title_2); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_title); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_4); __pyx_t_4 = 0; __Pyx_INCREF(__pyx_kp_u__24); __pyx_t_2 += 1; __Pyx_GIVEREF(__pyx_kp_u__24); PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_kp_u__24); __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 6, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; /* "libzim.pyx":771 * return self.c_item.getSize() * * def __repr__(self) -> str: # <<<<<<<<<<<<<< * return f"{self.__class__.__name__}(url={self.path}, title={self.title})" * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("libzim.Item.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("self.c_item cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_4Item_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_6libzim_4Item_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_4Item_2__reduce_cython__(((struct __pyx_obj_6libzim_Item *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_4Item_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Item *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("self.c_item cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_item cannot be converted to a Python object for pickling") */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("self.c_item cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Item.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("self.c_item cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("self.c_item cannot be converted to a Python object for pickling") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_4Item_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ static PyObject *__pyx_pw_6libzim_4Item_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_4Item_4__setstate_cython__(((struct __pyx_obj_6libzim_Item *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_4Item_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Item *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError("self.c_item cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_item cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("self.c_item cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("self.c_item cannot be converted to a Python object for pickling") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Item.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":789 * cdef object _filename * * def __cinit__(self, object filename: pathlib.Path): # <<<<<<<<<<<<<< * """Constructs an Archive from full zim file path * */ /* Python wrapper */ static int __pyx_pw_6libzim_7Archive_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6libzim_7Archive_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_filename = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,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); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename)) != 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, "__cinit__") < 0)) __PYX_ERR(0, 789, __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_filename = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 789, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim.Archive.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6libzim_7Archive___cinit__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self), __pyx_v_filename); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6libzim_7Archive___cinit__(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_filename) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; std::string __pyx_t_3; wrapper::Archive __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); /* "libzim.pyx":797 * Full path to a zim file""" * * self.c_archive = move(zim.Archive(str(filename).encode('UTF-8'))) # <<<<<<<<<<<<<< * self._filename = pathlib.Path(self.c_archive.getFilename().decode("UTF-8", "strict")) * */ __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_filename); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 797, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyUnicode_AsUTF8String(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 797, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = __pyx_convert_string_from_py_std__in_string(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 797, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; try { __pyx_t_4 = wrapper::Archive(__pyx_t_3); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 797, __pyx_L1_error) } __pyx_v_self->c_archive = cython_std::move(__pyx_t_4); /* "libzim.pyx":798 * * self.c_archive = move(zim.Archive(str(filename).encode('UTF-8'))) * self._filename = pathlib.Path(self.c_archive.getFilename().decode("UTF-8", "strict")) # <<<<<<<<<<<<<< * * def __eq__(self, other) -> pybool: */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pathlib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 798, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 798, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; try { __pyx_t_3 = __pyx_v_self->c_archive.getFilename(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 798, __pyx_L1_error) } __pyx_t_1 = __Pyx_decode_cpp_string(__pyx_t_3, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 798, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __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); } } __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 798, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->_filename); __Pyx_DECREF(__pyx_v_self->_filename); __pyx_v_self->_filename = __pyx_t_2; __pyx_t_2 = 0; /* "libzim.pyx":789 * cdef object _filename * * def __cinit__(self, object filename: pathlib.Path): # <<<<<<<<<<<<<< * """Constructs an Archive from full zim file path * */ /* 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_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("libzim.Archive.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":800 * self._filename = pathlib.Path(self.c_archive.getFilename().decode("UTF-8", "strict")) * * def __eq__(self, other) -> pybool: # <<<<<<<<<<<<<< * if Archive not in type(self).mro() or Archive not in type(other).mro(): * return False */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_3__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_3__eq__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_2__eq__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self), ((PyObject *)__pyx_v_other)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_2__eq__(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_other) { 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; 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__eq__", 0); /* "libzim.pyx":801 * * def __eq__(self, other) -> pybool: * if Archive not in type(self).mro() or Archive not in type(other).mro(): # <<<<<<<<<<<<<< * return False * try: */ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))), __pyx_n_s_mro); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 801, __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); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 801, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = (__Pyx_PySequence_ContainsTF(((PyObject *)__pyx_ptype_6libzim_Archive), __pyx_t_2, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 801, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = (__pyx_t_5 != 0); if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_other)), __pyx_n_s_mro); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 801, __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); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 801, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = (__Pyx_PySequence_ContainsTF(((PyObject *)__pyx_ptype_6libzim_Archive), __pyx_t_2, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 801, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = (__pyx_t_6 != 0); __pyx_t_1 = __pyx_t_5; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { /* "libzim.pyx":802 * def __eq__(self, other) -> pybool: * if Archive not in type(self).mro() or Archive not in type(other).mro(): * return False # <<<<<<<<<<<<<< * try: * return self.filename.expanduser().resolve() == other.filename.expanduser().resolve() */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_False); __pyx_r = Py_False; goto __pyx_L0; /* "libzim.pyx":801 * * def __eq__(self, other) -> pybool: * if Archive not in type(self).mro() or Archive not in type(other).mro(): # <<<<<<<<<<<<<< * return False * try: */ } /* "libzim.pyx":803 * if Archive not in type(self).mro() or Archive not in type(other).mro(): * return False * try: # <<<<<<<<<<<<<< * return self.filename.expanduser().resolve() == other.filename.expanduser().resolve() * except Exception: */ { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); __Pyx_XGOTREF(__pyx_t_7); __Pyx_XGOTREF(__pyx_t_8); __Pyx_XGOTREF(__pyx_t_9); /*try:*/ { /* "libzim.pyx":804 * return False * try: * return self.filename.expanduser().resolve() == other.filename.expanduser().resolve() # <<<<<<<<<<<<<< * except Exception: * return False */ __Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 804, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_expanduser); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 804, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(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); } } __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_10); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 804, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_resolve); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 804, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_10); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_10, function); } } __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_10); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 804, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 804, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_expanduser); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 804, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_11); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_11, function); } } __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_11); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 804, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_resolve); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 804, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_11, function); } } __pyx_t_10 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_11); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 804, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = PyObject_RichCompare(__pyx_t_2, __pyx_t_10, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 804, __pyx_L6_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_r = __pyx_t_11; __pyx_t_11 = 0; goto __pyx_L10_try_return; /* "libzim.pyx":803 * if Archive not in type(self).mro() or Archive not in type(other).mro(): * return False * try: # <<<<<<<<<<<<<< * return self.filename.expanduser().resolve() == other.filename.expanduser().resolve() * except Exception: */ } __pyx_L6_error:; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __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; /* "libzim.pyx":805 * try: * return self.filename.expanduser().resolve() == other.filename.expanduser().resolve() * except Exception: # <<<<<<<<<<<<<< * return False * */ __pyx_t_12 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_12) { __Pyx_AddTraceback("libzim.Archive.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_11, &__pyx_t_10, &__pyx_t_2) < 0) __PYX_ERR(0, 805, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_GOTREF(__pyx_t_10); __Pyx_GOTREF(__pyx_t_2); /* "libzim.pyx":806 * return self.filename.expanduser().resolve() == other.filename.expanduser().resolve() * except Exception: * return False # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_False); __pyx_r = Py_False; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L9_except_return; } goto __pyx_L8_except_error; __pyx_L8_except_error:; /* "libzim.pyx":803 * if Archive not in type(self).mro() or Archive not in type(other).mro(): * return False * try: # <<<<<<<<<<<<<< * return self.filename.expanduser().resolve() == other.filename.expanduser().resolve() * except Exception: */ __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); goto __pyx_L1_error; __pyx_L10_try_return:; __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); goto __pyx_L0; __pyx_L9_except_return:; __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); goto __pyx_L0; } /* "libzim.pyx":800 * self._filename = pathlib.Path(self.c_archive.getFilename().decode("UTF-8", "strict")) * * def __eq__(self, other) -> pybool: # <<<<<<<<<<<<<< * if Archive not in type(self).mro() or Archive not in type(other).mro(): * return False */ /* 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_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("libzim.Archive.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":809 * * @property * def filename(self) -> pathlib.Path: # <<<<<<<<<<<<<< * return self._filename * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_8filename_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_8filename_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_8filename___get__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_8filename___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":810 * @property * def filename(self) -> pathlib.Path: * return self._filename # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->_filename); __pyx_r = __pyx_v_self->_filename; goto __pyx_L0; /* "libzim.pyx":809 * * @property * def filename(self) -> pathlib.Path: # <<<<<<<<<<<<<< * return self._filename * */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":813 * * @property * def filesize(self) -> pyint: # <<<<<<<<<<<<<< * """Total size of ZIM file (or files if split""" * return self.c_archive.getFilesize() */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_8filesize_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_8filesize_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_8filesize___get__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_8filesize___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations uint64_t __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":815 * def filesize(self) -> pyint: * """Total size of ZIM file (or files if split""" * return self.c_archive.getFilesize() # <<<<<<<<<<<<<< * * def has_entry_by_path(self, path: str) -> pybool: */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_archive.getFilesize(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 815, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 815, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":813 * * @property * def filesize(self) -> pyint: # <<<<<<<<<<<<<< * """Total size of ZIM file (or files if split""" * return self.c_archive.getFilesize() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Archive.filesize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":817 * return self.c_archive.getFilesize() * * def has_entry_by_path(self, path: str) -> pybool: # <<<<<<<<<<<<<< * """Whether Archive has an entry with this path""" * return self.c_archive.hasEntryByPath(path.encode('UTF-8')) */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_5has_entry_by_path(PyObject *__pyx_v_self, PyObject *__pyx_v_path); /*proto*/ static char __pyx_doc_6libzim_7Archive_4has_entry_by_path[] = "Whether Archive has an entry with this path"; static PyObject *__pyx_pw_6libzim_7Archive_5has_entry_by_path(PyObject *__pyx_v_self, PyObject *__pyx_v_path) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("has_entry_by_path (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_path), (&PyUnicode_Type), 1, "path", 1))) __PYX_ERR(0, 817, __pyx_L1_error) __pyx_r = __pyx_pf_6libzim_7Archive_4has_entry_by_path(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self), ((PyObject*)__pyx_v_path)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_4has_entry_by_path(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_path) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; std::string __pyx_t_2; bool __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("has_entry_by_path", 0); /* "libzim.pyx":819 * def has_entry_by_path(self, path: str) -> pybool: * """Whether Archive has an entry with this path""" * return self.c_archive.hasEntryByPath(path.encode('UTF-8')) # <<<<<<<<<<<<<< * * def get_entry_by_path(self, path: str) -> Entry: */ __Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_path == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 819, __pyx_L1_error) } __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 819, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 819, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; try { __pyx_t_3 = __pyx_v_self->c_archive.hasEntryByPath(((std::string)__pyx_t_2)); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 819, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 819, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "libzim.pyx":817 * return self.c_archive.getFilesize() * * def has_entry_by_path(self, path: str) -> pybool: # <<<<<<<<<<<<<< * """Whether Archive has an entry with this path""" * return self.c_archive.hasEntryByPath(path.encode('UTF-8')) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Archive.has_entry_by_path", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":821 * return self.c_archive.hasEntryByPath(path.encode('UTF-8')) * * def get_entry_by_path(self, path: str) -> Entry: # <<<<<<<<<<<<<< * """Entry from a path -> Entry * */ /* Python wrapper */ static struct __pyx_obj_6libzim_Entry *__pyx_pw_6libzim_7Archive_7get_entry_by_path(PyObject *__pyx_v_self, PyObject *__pyx_v_path); /*proto*/ static char __pyx_doc_6libzim_7Archive_6get_entry_by_path[] = "Entry from a path -> Entry\n\n Parameters\n ----------\n path : str\n The path of the article\n Returns\n -------\n Entry\n The Entry object\n Raises\n ------\n KeyError\n If an entry with the provided path is not found in the archive"; static struct __pyx_obj_6libzim_Entry *__pyx_pw_6libzim_7Archive_7get_entry_by_path(PyObject *__pyx_v_self, PyObject *__pyx_v_path) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; struct __pyx_obj_6libzim_Entry *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_entry_by_path (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_path), (&PyUnicode_Type), 1, "path", 1))) __PYX_ERR(0, 821, __pyx_L1_error) __pyx_r = __pyx_pf_6libzim_7Archive_6get_entry_by_path(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self), ((PyObject*)__pyx_v_path)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_obj_6libzim_Entry *__pyx_pf_6libzim_7Archive_6get_entry_by_path(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_path) { wrapper::Entry __pyx_v_entry; PyObject *__pyx_v_e = NULL; struct __pyx_obj_6libzim_Entry *__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; std::string __pyx_t_5; wrapper::Entry __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 = NULL; int __pyx_t_12; char const *__pyx_t_13; 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; PyObject *__pyx_t_19 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_entry_by_path", 0); /* "libzim.pyx":837 * If an entry with the provided path is not found in the archive""" * cdef zim.Entry entry * try: # <<<<<<<<<<<<<< * entry = move(self.c_archive.getEntryByPath(path.encode('UTF-8'))) * except RuntimeError as e: */ { __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:*/ { /* "libzim.pyx":838 * cdef zim.Entry entry * try: * entry = move(self.c_archive.getEntryByPath(path.encode('UTF-8'))) # <<<<<<<<<<<<<< * except RuntimeError as e: * raise KeyError(str(e)) */ if (unlikely(__pyx_v_path == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 838, __pyx_L3_error) } __pyx_t_4 = PyUnicode_AsUTF8String(__pyx_v_path); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 838, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 838, __pyx_L3_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; try { __pyx_t_6 = __pyx_v_self->c_archive.getEntryByPath(((std::string)__pyx_t_5)); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 838, __pyx_L3_error) } __pyx_v_entry = cython_std::move(__pyx_t_6); /* "libzim.pyx":837 * If an entry with the provided path is not found in the archive""" * cdef zim.Entry entry * try: # <<<<<<<<<<<<<< * entry = move(self.c_archive.getEntryByPath(path.encode('UTF-8'))) * except RuntimeError as e: */ } __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_L8_try_end; __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; /* "libzim.pyx":839 * try: * entry = move(self.c_archive.getEntryByPath(path.encode('UTF-8'))) * except RuntimeError as e: # <<<<<<<<<<<<<< * raise KeyError(str(e)) * return Entry.from_entry(move(entry)) */ __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_RuntimeError); if (__pyx_t_7) { __Pyx_AddTraceback("libzim.Archive.get_entry_by_path", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(0, 839, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_8); __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_v_e = __pyx_t_8; /*try:*/ { /* "libzim.pyx":840 * entry = move(self.c_archive.getEntryByPath(path.encode('UTF-8'))) * except RuntimeError as e: * raise KeyError(str(e)) # <<<<<<<<<<<<<< * return Entry.from_entry(move(entry)) * */ __pyx_t_10 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_e); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 840, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 840, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_Raise(__pyx_t_11, 0, 0, 0); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __PYX_ERR(0, 840, __pyx_L14_error) } /* "libzim.pyx":839 * try: * entry = move(self.c_archive.getEntryByPath(path.encode('UTF-8'))) * except RuntimeError as e: # <<<<<<<<<<<<<< * raise KeyError(str(e)) * return Entry.from_entry(move(entry)) */ /*finally:*/ { __pyx_L14_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __pyx_t_7 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_13 = __pyx_filename; { __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_XGIVEREF(__pyx_t_19); __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19); } __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_ErrRestore(__pyx_t_14, __pyx_t_15, __pyx_t_16); __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_13; goto __pyx_L5_except_error; } } } goto __pyx_L5_except_error; __pyx_L5_except_error:; /* "libzim.pyx":837 * If an entry with the provided path is not found in the archive""" * cdef zim.Entry entry * try: # <<<<<<<<<<<<<< * entry = move(self.c_archive.getEntryByPath(path.encode('UTF-8'))) * except RuntimeError as e: */ __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_L8_try_end:; } /* "libzim.pyx":841 * except RuntimeError as e: * raise KeyError(str(e)) * return Entry.from_entry(move(entry)) # <<<<<<<<<<<<<< * * def has_entry_by_title(self, title: str) -> pybool: */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_9 = __pyx_f_6libzim_5Entry_from_entry(cython_std::move(__pyx_v_entry)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 841, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_6libzim_Entry))))) __PYX_ERR(0, 841, __pyx_L1_error) __pyx_r = ((struct __pyx_obj_6libzim_Entry *)__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L0; /* "libzim.pyx":821 * return self.c_archive.hasEntryByPath(path.encode('UTF-8')) * * def get_entry_by_path(self, path: str) -> Entry: # <<<<<<<<<<<<<< * """Entry from a path -> Entry * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("libzim.Archive.get_entry_by_path", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_e); __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":843 * return Entry.from_entry(move(entry)) * * def has_entry_by_title(self, title: str) -> pybool: # <<<<<<<<<<<<<< * """Whether Archive has en entry with this title * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_9has_entry_by_title(PyObject *__pyx_v_self, PyObject *__pyx_v_title); /*proto*/ static char __pyx_doc_6libzim_7Archive_8has_entry_by_title[] = "Whether Archive has en entry with this title\n\n Uses get_entry_by_title() so it's specificities apply as well"; static PyObject *__pyx_pw_6libzim_7Archive_9has_entry_by_title(PyObject *__pyx_v_self, PyObject *__pyx_v_title) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("has_entry_by_title (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_title), (&PyUnicode_Type), 1, "title", 1))) __PYX_ERR(0, 843, __pyx_L1_error) __pyx_r = __pyx_pf_6libzim_7Archive_8has_entry_by_title(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self), ((PyObject*)__pyx_v_title)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_8has_entry_by_title(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_title) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; std::string __pyx_t_2; bool __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("has_entry_by_title", 0); /* "libzim.pyx":847 * * Uses get_entry_by_title() so it's specificities apply as well""" * return self.c_archive.hasEntryByTitle(title.encode('UTF-8')) # <<<<<<<<<<<<<< * * def get_entry_by_title(self, title: str) -> Entry: */ __Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_title == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 847, __pyx_L1_error) } __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_title); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 847, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 847, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; try { __pyx_t_3 = __pyx_v_self->c_archive.hasEntryByTitle(((std::string)__pyx_t_2)); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 847, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 847, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "libzim.pyx":843 * return Entry.from_entry(move(entry)) * * def has_entry_by_title(self, title: str) -> pybool: # <<<<<<<<<<<<<< * """Whether Archive has en entry with this title * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Archive.has_entry_by_title", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":849 * return self.c_archive.hasEntryByTitle(title.encode('UTF-8')) * * def get_entry_by_title(self, title: str) -> Entry: # <<<<<<<<<<<<<< * """Entry from a title -> Entry * */ /* Python wrapper */ static struct __pyx_obj_6libzim_Entry *__pyx_pw_6libzim_7Archive_11get_entry_by_title(PyObject *__pyx_v_self, PyObject *__pyx_v_title); /*proto*/ static char __pyx_doc_6libzim_7Archive_10get_entry_by_title[] = "Entry from a title -> Entry\n\n If ZIM doesn't contain a listing/titleOrdered/v1 entry (most likely\n because if was created without any FRONT_ARTICLE) then this yields results\n for matching path if the title was not set at creation time.\n Otherwise raises KeyError.\n\n Parameters\n ----------\n title : str\n The title of the article\n Returns\n -------\n Entry\n The first Entry object matching the title\n Raises\n ------\n KeyError\n If an entry with the provided title is not found in the archive"; static struct __pyx_obj_6libzim_Entry *__pyx_pw_6libzim_7Archive_11get_entry_by_title(PyObject *__pyx_v_self, PyObject *__pyx_v_title) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; struct __pyx_obj_6libzim_Entry *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_entry_by_title (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_title), (&PyUnicode_Type), 1, "title", 1))) __PYX_ERR(0, 849, __pyx_L1_error) __pyx_r = __pyx_pf_6libzim_7Archive_10get_entry_by_title(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self), ((PyObject*)__pyx_v_title)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_obj_6libzim_Entry *__pyx_pf_6libzim_7Archive_10get_entry_by_title(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_title) { wrapper::Entry __pyx_v_entry; PyObject *__pyx_v_e = NULL; struct __pyx_obj_6libzim_Entry *__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; std::string __pyx_t_5; wrapper::Entry __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 = NULL; int __pyx_t_12; char const *__pyx_t_13; 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; PyObject *__pyx_t_19 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_entry_by_title", 0); /* "libzim.pyx":870 * If an entry with the provided title is not found in the archive""" * cdef zim.Entry entry * try: # <<<<<<<<<<<<<< * entry = move(self.c_archive.getEntryByTitle(title.encode('UTF-8'))) * except RuntimeError as e: */ { __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:*/ { /* "libzim.pyx":871 * cdef zim.Entry entry * try: * entry = move(self.c_archive.getEntryByTitle(title.encode('UTF-8'))) # <<<<<<<<<<<<<< * except RuntimeError as e: * raise KeyError(str(e)) */ if (unlikely(__pyx_v_title == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 871, __pyx_L3_error) } __pyx_t_4 = PyUnicode_AsUTF8String(__pyx_v_title); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 871, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __pyx_convert_string_from_py_std__in_string(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 871, __pyx_L3_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; try { __pyx_t_6 = __pyx_v_self->c_archive.getEntryByTitle(((std::string)__pyx_t_5)); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 871, __pyx_L3_error) } __pyx_v_entry = cython_std::move(__pyx_t_6); /* "libzim.pyx":870 * If an entry with the provided title is not found in the archive""" * cdef zim.Entry entry * try: # <<<<<<<<<<<<<< * entry = move(self.c_archive.getEntryByTitle(title.encode('UTF-8'))) * except RuntimeError as e: */ } __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_L8_try_end; __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; /* "libzim.pyx":872 * try: * entry = move(self.c_archive.getEntryByTitle(title.encode('UTF-8'))) * except RuntimeError as e: # <<<<<<<<<<<<<< * raise KeyError(str(e)) * return Entry.from_entry(move(entry)) */ __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_RuntimeError); if (__pyx_t_7) { __Pyx_AddTraceback("libzim.Archive.get_entry_by_title", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_8, &__pyx_t_9) < 0) __PYX_ERR(0, 872, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_8); __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_v_e = __pyx_t_8; /*try:*/ { /* "libzim.pyx":873 * entry = move(self.c_archive.getEntryByTitle(title.encode('UTF-8'))) * except RuntimeError as e: * raise KeyError(str(e)) # <<<<<<<<<<<<<< * return Entry.from_entry(move(entry)) * */ __pyx_t_10 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_e); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 873, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 873, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_Raise(__pyx_t_11, 0, 0, 0); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __PYX_ERR(0, 873, __pyx_L14_error) } /* "libzim.pyx":872 * try: * entry = move(self.c_archive.getEntryByTitle(title.encode('UTF-8'))) * except RuntimeError as e: # <<<<<<<<<<<<<< * raise KeyError(str(e)) * return Entry.from_entry(move(entry)) */ /*finally:*/ { __pyx_L14_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __pyx_t_7 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_13 = __pyx_filename; { __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_XGIVEREF(__pyx_t_19); __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19); } __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_ErrRestore(__pyx_t_14, __pyx_t_15, __pyx_t_16); __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_13; goto __pyx_L5_except_error; } } } goto __pyx_L5_except_error; __pyx_L5_except_error:; /* "libzim.pyx":870 * If an entry with the provided title is not found in the archive""" * cdef zim.Entry entry * try: # <<<<<<<<<<<<<< * entry = move(self.c_archive.getEntryByTitle(title.encode('UTF-8'))) * except RuntimeError as e: */ __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_L8_try_end:; } /* "libzim.pyx":874 * except RuntimeError as e: * raise KeyError(str(e)) * return Entry.from_entry(move(entry)) # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_9 = __pyx_f_6libzim_5Entry_from_entry(cython_std::move(__pyx_v_entry)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 874, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_6libzim_Entry))))) __PYX_ERR(0, 874, __pyx_L1_error) __pyx_r = ((struct __pyx_obj_6libzim_Entry *)__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L0; /* "libzim.pyx":849 * return self.c_archive.hasEntryByTitle(title.encode('UTF-8')) * * def get_entry_by_title(self, title: str) -> Entry: # <<<<<<<<<<<<<< * """Entry from a title -> Entry * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("libzim.Archive.get_entry_by_title", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_e); __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":877 * * @property * def metadata_keys(self) -> List[str]: # <<<<<<<<<<<<<< * """List of Metadata keys present in this archive""" * return [key.decode("UTF-8", "strict") for key in self.c_archive.getMetadataKeys()] */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_13metadata_keys_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_13metadata_keys_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_13metadata_keys___get__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_13metadata_keys___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self) { std::string __pyx_8genexpr1__pyx_v_key; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; std::vector __pyx_t_2; std::vector ::iterator __pyx_t_3; std::vector *__pyx_t_4; std::string __pyx_t_5; PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":879 * def metadata_keys(self) -> List[str]: * """List of Metadata keys present in this archive""" * return [key.decode("UTF-8", "strict") for key in self.c_archive.getMetadataKeys()] # <<<<<<<<<<<<<< * * def get_metadata_item(self, name: str) -> Item: */ __Pyx_XDECREF(__pyx_r); { /* enter inner scope */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 879, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); try { __pyx_t_2 = __pyx_v_self->c_archive.getMetadataKeys(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 879, __pyx_L1_error) } __pyx_t_4 = &__pyx_t_2; __pyx_t_3 = __pyx_t_4->begin(); for (;;) { if (!(__pyx_t_3 != __pyx_t_4->end())) break; __pyx_t_5 = *__pyx_t_3; ++__pyx_t_3; __pyx_8genexpr1__pyx_v_key = __pyx_t_5; __pyx_t_6 = __Pyx_decode_cpp_string(__pyx_8genexpr1__pyx_v_key, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 879, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 879, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } } /* exit inner scope */ __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "libzim.pyx":877 * * @property * def metadata_keys(self) -> List[str]: # <<<<<<<<<<<<<< * """List of Metadata keys present in this archive""" * return [key.decode("UTF-8", "strict") for key in self.c_archive.getMetadataKeys()] */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("libzim.Archive.metadata_keys.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":881 * return [key.decode("UTF-8", "strict") for key in self.c_archive.getMetadataKeys()] * * def get_metadata_item(self, name: str) -> Item: # <<<<<<<<<<<<<< * """A Metadata's Item""" * cdef zim.Item item = move(self.c_archive.getMetadataItem(name.encode('UTF-8'))) */ /* Python wrapper */ static struct __pyx_obj_6libzim_Item *__pyx_pw_6libzim_7Archive_13get_metadata_item(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/ static char __pyx_doc_6libzim_7Archive_12get_metadata_item[] = "A Metadata's Item"; static struct __pyx_obj_6libzim_Item *__pyx_pw_6libzim_7Archive_13get_metadata_item(PyObject *__pyx_v_self, PyObject *__pyx_v_name) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; struct __pyx_obj_6libzim_Item *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_metadata_item (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 1, "name", 1))) __PYX_ERR(0, 881, __pyx_L1_error) __pyx_r = __pyx_pf_6libzim_7Archive_12get_metadata_item(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self), ((PyObject*)__pyx_v_name)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_obj_6libzim_Item *__pyx_pf_6libzim_7Archive_12get_metadata_item(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_name) { wrapper::Item __pyx_v_item; struct __pyx_obj_6libzim_Item *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; std::string __pyx_t_2; wrapper::Item __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_metadata_item", 0); /* "libzim.pyx":883 * def get_metadata_item(self, name: str) -> Item: * """A Metadata's Item""" * cdef zim.Item item = move(self.c_archive.getMetadataItem(name.encode('UTF-8'))) # <<<<<<<<<<<<<< * return Item.from_item(move(item)) * */ if (unlikely(__pyx_v_name == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 883, __pyx_L1_error) } __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 883, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 883, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; try { __pyx_t_3 = __pyx_v_self->c_archive.getMetadataItem(__pyx_t_2); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 883, __pyx_L1_error) } __pyx_v_item = cython_std::move(__pyx_t_3); /* "libzim.pyx":884 * """A Metadata's Item""" * cdef zim.Item item = move(self.c_archive.getMetadataItem(name.encode('UTF-8'))) * return Item.from_item(move(item)) # <<<<<<<<<<<<<< * * def get_metadata(self, name: str) -> bytes: */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_1 = __pyx_f_6libzim_4Item_from_item(cython_std::move(__pyx_v_item)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 884, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6libzim_Item))))) __PYX_ERR(0, 884, __pyx_L1_error) __pyx_r = ((struct __pyx_obj_6libzim_Item *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "libzim.pyx":881 * return [key.decode("UTF-8", "strict") for key in self.c_archive.getMetadataKeys()] * * def get_metadata_item(self, name: str) -> Item: # <<<<<<<<<<<<<< * """A Metadata's Item""" * cdef zim.Item item = move(self.c_archive.getMetadataItem(name.encode('UTF-8'))) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Archive.get_metadata_item", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":886 * return Item.from_item(move(item)) * * def get_metadata(self, name: str) -> bytes: # <<<<<<<<<<<<<< * """A Metadata's content -> bytes * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_15get_metadata(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/ static char __pyx_doc_6libzim_7Archive_14get_metadata[] = "A Metadata's content -> bytes\n\n Parameters\n ----------\n name: str\n name/path of the Metadata Entry\n Returns\n -------\n bytes\n Metadata entry's content. Can be of any type."; static PyObject *__pyx_pw_6libzim_7Archive_15get_metadata(PyObject *__pyx_v_self, PyObject *__pyx_v_name) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_metadata (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyUnicode_Type), 1, "name", 1))) __PYX_ERR(0, 886, __pyx_L1_error) __pyx_r = __pyx_pf_6libzim_7Archive_14get_metadata(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self), ((PyObject*)__pyx_v_name)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_14get_metadata(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_name) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; std::string __pyx_t_2; std::string __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_metadata", 0); /* "libzim.pyx":897 * bytes * Metadata entry's content. Can be of any type.""" * return bytes(self.c_archive.getMetadata(name.encode('UTF-8'))) # <<<<<<<<<<<<<< * * def _get_entry_by_id(self, entry_id: pyint) -> Entry: */ __Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_name == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 897, __pyx_L1_error) } __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 897, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 897, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; try { __pyx_t_3 = __pyx_v_self->c_archive.getMetadata(__pyx_t_2); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 897, __pyx_L1_error) } __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 897, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 897, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0; /* "libzim.pyx":886 * return Item.from_item(move(item)) * * def get_metadata(self, name: str) -> bytes: # <<<<<<<<<<<<<< * """A Metadata's content -> bytes * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("libzim.Archive.get_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":899 * return bytes(self.c_archive.getMetadata(name.encode('UTF-8'))) * * def _get_entry_by_id(self, entry_id: pyint) -> Entry: # <<<<<<<<<<<<<< * """Entry from an entry Id""" * cdef zim.Entry entry = move(self.c_archive.getEntryByPath(entry_id)) */ /* Python wrapper */ static struct __pyx_obj_6libzim_Entry *__pyx_pw_6libzim_7Archive_17_get_entry_by_id(PyObject *__pyx_v_self, PyObject *__pyx_v_entry_id); /*proto*/ static char __pyx_doc_6libzim_7Archive_16_get_entry_by_id[] = "Entry from an entry Id"; static struct __pyx_obj_6libzim_Entry *__pyx_pw_6libzim_7Archive_17_get_entry_by_id(PyObject *__pyx_v_self, PyObject *__pyx_v_entry_id) { struct __pyx_obj_6libzim_Entry *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get_entry_by_id (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_16_get_entry_by_id(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self), ((PyObject *)__pyx_v_entry_id)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_obj_6libzim_Entry *__pyx_pf_6libzim_7Archive_16_get_entry_by_id(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_entry_id) { wrapper::Entry __pyx_v_entry; struct __pyx_obj_6libzim_Entry *__pyx_r = NULL; __Pyx_RefNannyDeclarations zim::entry_index_type __pyx_t_1; wrapper::Entry __pyx_t_2; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_get_entry_by_id", 0); /* "libzim.pyx":901 * def _get_entry_by_id(self, entry_id: pyint) -> Entry: * """Entry from an entry Id""" * cdef zim.Entry entry = move(self.c_archive.getEntryByPath(entry_id)) # <<<<<<<<<<<<<< * return Entry.from_entry(move(entry)) * */ __pyx_t_1 = __Pyx_PyInt_As_uint32_t(__pyx_v_entry_id); if (unlikely((__pyx_t_1 == ((zim::entry_index_type)-1)) && PyErr_Occurred())) __PYX_ERR(0, 901, __pyx_L1_error) try { __pyx_t_2 = __pyx_v_self->c_archive.getEntryByPath(((zim::entry_index_type)__pyx_t_1)); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 901, __pyx_L1_error) } __pyx_v_entry = cython_std::move(__pyx_t_2); /* "libzim.pyx":902 * """Entry from an entry Id""" * cdef zim.Entry entry = move(self.c_archive.getEntryByPath(entry_id)) * return Entry.from_entry(move(entry)) # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_3 = __pyx_f_6libzim_5Entry_from_entry(cython_std::move(__pyx_v_entry)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 902, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6libzim_Entry))))) __PYX_ERR(0, 902, __pyx_L1_error) __pyx_r = ((struct __pyx_obj_6libzim_Entry *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; /* "libzim.pyx":899 * return bytes(self.c_archive.getMetadata(name.encode('UTF-8'))) * * def _get_entry_by_id(self, entry_id: pyint) -> Entry: # <<<<<<<<<<<<<< * """Entry from an entry Id""" * cdef zim.Entry entry = move(self.c_archive.getEntryByPath(entry_id)) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("libzim.Archive._get_entry_by_id", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":905 * * @property * def has_main_entry(self) -> pybool: # <<<<<<<<<<<<<< * """Whether Archive has a Main Entry set""" * return self.c_archive.hasMainEntry() */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_14has_main_entry_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_14has_main_entry_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_14has_main_entry___get__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_14has_main_entry___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations bool __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":907 * def has_main_entry(self) -> pybool: * """Whether Archive has a Main Entry set""" * return self.c_archive.hasMainEntry() # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_archive.hasMainEntry(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 907, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 907, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":905 * * @property * def has_main_entry(self) -> pybool: # <<<<<<<<<<<<<< * """Whether Archive has a Main Entry set""" * return self.c_archive.hasMainEntry() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Archive.has_main_entry.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":910 * * @property * def main_entry(self) -> Entry: # <<<<<<<<<<<<<< * """Main Entry of the Archive""" * return Entry.from_entry(move(self.c_archive.getMainEntry())) */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_10main_entry_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_10main_entry_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_10main_entry___get__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_10main_entry___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations wrapper::Entry __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":912 * def main_entry(self) -> Entry: * """Main Entry of the Archive""" * return Entry.from_entry(move(self.c_archive.getMainEntry())) # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_archive.getMainEntry(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 912, __pyx_L1_error) } __pyx_t_2 = __pyx_f_6libzim_5Entry_from_entry(cython_std::move(__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 912, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":910 * * @property * def main_entry(self) -> Entry: # <<<<<<<<<<<<<< * """Main Entry of the Archive""" * return Entry.from_entry(move(self.c_archive.getMainEntry())) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Archive.main_entry.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":915 * * @property * def uuid(self) -> UUID: # <<<<<<<<<<<<<< * """Archive UUID""" * return UUID(self.c_archive.getUuid().hex()) */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_4uuid_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_4uuid_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_4uuid___get__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_4uuid___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; std::string __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":917 * def uuid(self) -> UUID: * """Archive UUID""" * return UUID(self.c_archive.getUuid().hex()) # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_UUID); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 917, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); try { __pyx_t_4 = __pyx_v_self->c_archive.getUuid(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 917, __pyx_L1_error) } __pyx_t_5 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 917, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_hex); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 917, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(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); } } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 917, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 917, __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; /* "libzim.pyx":915 * * @property * def uuid(self) -> UUID: # <<<<<<<<<<<<<< * """Archive UUID""" * return UUID(self.c_archive.getUuid().hex()) */ /* 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_6); __Pyx_AddTraceback("libzim.Archive.uuid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":920 * * @property * def has_new_namespace_scheme(self) -> pybool: # <<<<<<<<<<<<<< * """Whether Archive is using new namespaceless namespace scheme""" * return self.c_archive.hasNewNamespaceScheme() */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_24has_new_namespace_scheme_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_24has_new_namespace_scheme_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_24has_new_namespace_scheme___get__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_24has_new_namespace_scheme___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations bool __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":922 * def has_new_namespace_scheme(self) -> pybool: * """Whether Archive is using new namespaceless namespace scheme""" * return self.c_archive.hasNewNamespaceScheme() # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_archive.hasNewNamespaceScheme(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 922, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 922, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":920 * * @property * def has_new_namespace_scheme(self) -> pybool: # <<<<<<<<<<<<<< * """Whether Archive is using new namespaceless namespace scheme""" * return self.c_archive.hasNewNamespaceScheme() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Archive.has_new_namespace_scheme.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":925 * * @property * def is_multipart(self) -> pybool: # <<<<<<<<<<<<<< * """Whether Archive is multipart (split over multiple files)""" * return self.c_archive.isMultiPart() */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_12is_multipart_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_12is_multipart_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_12is_multipart___get__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_12is_multipart___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations bool __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":927 * def is_multipart(self) -> pybool: * """Whether Archive is multipart (split over multiple files)""" * return self.c_archive.isMultiPart() # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_archive.isMultiPart(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 927, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 927, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":925 * * @property * def is_multipart(self) -> pybool: # <<<<<<<<<<<<<< * """Whether Archive is multipart (split over multiple files)""" * return self.c_archive.isMultiPart() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Archive.is_multipart.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":930 * * @property * def has_fulltext_index(self) -> pybool: # <<<<<<<<<<<<<< * """Whether Archive includes a full-text index""" * return self.c_archive.hasFulltextIndex() */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_18has_fulltext_index_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_18has_fulltext_index_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_18has_fulltext_index___get__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_18has_fulltext_index___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations bool __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":932 * def has_fulltext_index(self) -> pybool: * """Whether Archive includes a full-text index""" * return self.c_archive.hasFulltextIndex() # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_archive.hasFulltextIndex(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 932, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 932, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":930 * * @property * def has_fulltext_index(self) -> pybool: # <<<<<<<<<<<<<< * """Whether Archive includes a full-text index""" * return self.c_archive.hasFulltextIndex() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Archive.has_fulltext_index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":935 * * @property * def has_title_index(self) -> pybool: # <<<<<<<<<<<<<< * """Whether Archive includes a Title index""" * return self.c_archive.hasTitleIndex() */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_15has_title_index_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_15has_title_index_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_15has_title_index___get__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_15has_title_index___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations bool __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":937 * def has_title_index(self) -> pybool: * """Whether Archive includes a Title index""" * return self.c_archive.hasTitleIndex() # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_archive.hasTitleIndex(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 937, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 937, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":935 * * @property * def has_title_index(self) -> pybool: # <<<<<<<<<<<<<< * """Whether Archive includes a Title index""" * return self.c_archive.hasTitleIndex() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Archive.has_title_index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":940 * * @property * def has_checksum(self) -> str: # <<<<<<<<<<<<<< * """Whether Archive includes a checksum of its content""" * return self.c_archive.hasChecksum() */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_12has_checksum_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_12has_checksum_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_12has_checksum___get__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_12has_checksum___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations bool __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":942 * def has_checksum(self) -> str: * """Whether Archive includes a checksum of its content""" * return self.c_archive.hasChecksum() # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_archive.hasChecksum(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 942, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 942, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":940 * * @property * def has_checksum(self) -> str: # <<<<<<<<<<<<<< * """Whether Archive includes a checksum of its content""" * return self.c_archive.hasChecksum() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Archive.has_checksum.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":945 * * @property * def checksum(self) -> str: # <<<<<<<<<<<<<< * """Archive's checksum""" * return self.c_archive.getChecksum().decode("UTF-8", "strict") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_8checksum_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_8checksum_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_8checksum___get__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_8checksum___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations std::string __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":947 * def checksum(self) -> str: * """Archive's checksum""" * return self.c_archive.getChecksum().decode("UTF-8", "strict") # <<<<<<<<<<<<<< * * def check(self) -> pybool: */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_archive.getChecksum(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 947, __pyx_L1_error) } __pyx_t_2 = __Pyx_decode_cpp_string(__pyx_t_1, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 947, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":945 * * @property * def checksum(self) -> str: # <<<<<<<<<<<<<< * """Archive's checksum""" * return self.c_archive.getChecksum().decode("UTF-8", "strict") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Archive.checksum.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":949 * return self.c_archive.getChecksum().decode("UTF-8", "strict") * * def check(self) -> pybool: # <<<<<<<<<<<<<< * """Whether Archive has a checksum and file verifies it""" * return self.c_archive.check() */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_19check(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6libzim_7Archive_18check[] = "Whether Archive has a checksum and file verifies it"; static PyObject *__pyx_pw_6libzim_7Archive_19check(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("check (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_18check(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_18check(struct __pyx_obj_6libzim_Archive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations bool __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("check", 0); /* "libzim.pyx":951 * def check(self) -> pybool: * """Whether Archive has a checksum and file verifies it""" * return self.c_archive.check() # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_archive.check(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 951, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 951, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":949 * return self.c_archive.getChecksum().decode("UTF-8", "strict") * * def check(self) -> pybool: # <<<<<<<<<<<<<< * """Whether Archive has a checksum and file verifies it""" * return self.c_archive.check() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Archive.check", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":954 * * @property * def entry_count(self) -> pyint: # <<<<<<<<<<<<<< * """Number of user entries in Archive * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_11entry_count_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_11entry_count_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_11entry_count___get__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_11entry_count___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations zim::size_type __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":959 * If Archive doesn't support user entries * then this returns `all_entry_count`""" * return self.c_archive.getEntryCount() # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_archive.getEntryCount(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 959, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":954 * * @property * def entry_count(self) -> pyint: # <<<<<<<<<<<<<< * """Number of user entries in Archive * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Archive.entry_count.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":962 * * @property * def all_entry_count(self) -> pyint: # <<<<<<<<<<<<<< * """Number of entries in Archive. * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_15all_entry_count_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_15all_entry_count_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_15all_entry_count___get__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_15all_entry_count___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations zim::size_type __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":967 * Total number of entries in the archive, including internal entries * created by libzim itself, metadata, indexes, etc.""" * return self.c_archive.getAllEntryCount() # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_archive.getAllEntryCount(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 967, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 967, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":962 * * @property * def all_entry_count(self) -> pyint: # <<<<<<<<<<<<<< * """Number of entries in Archive. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Archive.all_entry_count.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":970 * * @property * def article_count(self) -> pyint: # <<<<<<<<<<<<<< * """Number of articles in the Archive * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_13article_count_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_13article_count_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_13article_count___get__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_13article_count___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations zim::size_type __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":980 * Note: a few ZIM created during transition might have new scheme but no * listing, resulting in this returning all entries.""" * return self.c_archive.getArticleCount() # <<<<<<<<<<<<<< * * @property */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_archive.getArticleCount(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 980, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 980, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":970 * * @property * def article_count(self) -> pyint: # <<<<<<<<<<<<<< * """Number of articles in the Archive * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Archive.article_count.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":983 * * @property * def media_count(self) -> pyint: # <<<<<<<<<<<<<< * """Number of media in the Archive * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_11media_count_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_11media_count_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_11media_count___get__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_11media_count___get__(struct __pyx_obj_6libzim_Archive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations zim::size_type __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "libzim.pyx":987 * * This definition of "media" is based on the mimetype.""" * return self.c_archive.getMediaCount() # <<<<<<<<<<<<<< * * def get_illustration_sizes(self) -> Set[pyint]: */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_archive.getMediaCount(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 987, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyInt_From_uint64_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 987, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":983 * * @property * def media_count(self) -> pyint: # <<<<<<<<<<<<<< * """Number of media in the Archive * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Archive.media_count.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":989 * return self.c_archive.getMediaCount() * * def get_illustration_sizes(self) -> Set[pyint]: # <<<<<<<<<<<<<< * """Sizes for which an illustration is available (@1 scale only)""" * return self.c_archive.getIllustrationSizes() */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_21get_illustration_sizes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6libzim_7Archive_20get_illustration_sizes[] = "Sizes for which an illustration is available (@1 scale only)"; static PyObject *__pyx_pw_6libzim_7Archive_21get_illustration_sizes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_illustration_sizes (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_20get_illustration_sizes(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_20get_illustration_sizes(struct __pyx_obj_6libzim_Archive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations std::set __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_illustration_sizes", 0); /* "libzim.pyx":991 * def get_illustration_sizes(self) -> Set[pyint]: * """Sizes for which an illustration is available (@1 scale only)""" * return self.c_archive.getIllustrationSizes() # <<<<<<<<<<<<<< * * def has_illustration(self, size: pyint = None) -> pybool: */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_archive.getIllustrationSizes(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 991, __pyx_L1_error) } __pyx_t_2 = __pyx_convert_set_to_py_unsigned_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 991, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":989 * return self.c_archive.getMediaCount() * * def get_illustration_sizes(self) -> Set[pyint]: # <<<<<<<<<<<<<< * """Sizes for which an illustration is available (@1 scale only)""" * return self.c_archive.getIllustrationSizes() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Archive.get_illustration_sizes", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":993 * return self.c_archive.getIllustrationSizes() * * def has_illustration(self, size: pyint = None) -> pybool: # <<<<<<<<<<<<<< * """Whether Archive has an illustration metadata for this size""" * if size is not None: */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_23has_illustration(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6libzim_7Archive_22has_illustration[] = "Whether Archive has an illustration metadata for this size"; static PyObject *__pyx_pw_6libzim_7Archive_23has_illustration(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_size = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("has_illustration (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,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); CYTHON_FALLTHROUGH; 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 = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size); if (value) { values[0] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "has_illustration") < 0)) __PYX_ERR(0, 993, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_size = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("has_illustration", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 993, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim.Archive.has_illustration", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6libzim_7Archive_22has_illustration(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self), __pyx_v_size); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_22has_illustration(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_size) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; unsigned int __pyx_t_3; bool __pyx_t_4; PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("has_illustration", 0); /* "libzim.pyx":995 * def has_illustration(self, size: pyint = None) -> pybool: * """Whether Archive has an illustration metadata for this size""" * if size is not None: # <<<<<<<<<<<<<< * return self.c_archive.hasIllustration(size) * return self.c_archive.hasIllustration() */ __pyx_t_1 = (__pyx_v_size != Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* "libzim.pyx":996 * """Whether Archive has an illustration metadata for this size""" * if size is not None: * return self.c_archive.hasIllustration(size) # <<<<<<<<<<<<<< * return self.c_archive.hasIllustration() * */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyInt_As_unsigned_int(__pyx_v_size); if (unlikely((__pyx_t_3 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 996, __pyx_L1_error) try { __pyx_t_4 = __pyx_v_self->c_archive.hasIllustration(__pyx_t_3); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 996, __pyx_L1_error) } __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 996, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; /* "libzim.pyx":995 * def has_illustration(self, size: pyint = None) -> pybool: * """Whether Archive has an illustration metadata for this size""" * if size is not None: # <<<<<<<<<<<<<< * return self.c_archive.hasIllustration(size) * return self.c_archive.hasIllustration() */ } /* "libzim.pyx":997 * if size is not None: * return self.c_archive.hasIllustration(size) * return self.c_archive.hasIllustration() # <<<<<<<<<<<<<< * * def get_illustration_item(self, size: pyint = None) -> Item: */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_4 = __pyx_v_self->c_archive.hasIllustration(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 997, __pyx_L1_error) } __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 997, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; /* "libzim.pyx":993 * return self.c_archive.getIllustrationSizes() * * def has_illustration(self, size: pyint = None) -> pybool: # <<<<<<<<<<<<<< * """Whether Archive has an illustration metadata for this size""" * if size is not None: */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("libzim.Archive.has_illustration", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":999 * return self.c_archive.hasIllustration() * * def get_illustration_item(self, size: pyint = None) -> Item: # <<<<<<<<<<<<<< * """Illustration Metadata Item for this size""" * try: */ /* Python wrapper */ static struct __pyx_obj_6libzim_Item *__pyx_pw_6libzim_7Archive_25get_illustration_item(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6libzim_7Archive_24get_illustration_item[] = "Illustration Metadata Item for this size"; static struct __pyx_obj_6libzim_Item *__pyx_pw_6libzim_7Archive_25get_illustration_item(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_size = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; struct __pyx_obj_6libzim_Item *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_illustration_item (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,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); CYTHON_FALLTHROUGH; 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 = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size); if (value) { values[0] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_illustration_item") < 0)) __PYX_ERR(0, 999, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_size = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("get_illustration_item", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 999, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim.Archive.get_illustration_item", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6libzim_7Archive_24get_illustration_item(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self), __pyx_v_size); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_obj_6libzim_Item *__pyx_pf_6libzim_7Archive_24get_illustration_item(struct __pyx_obj_6libzim_Archive *__pyx_v_self, PyObject *__pyx_v_size) { PyObject *__pyx_v_e = NULL; struct __pyx_obj_6libzim_Item *__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; wrapper::Item __pyx_t_7; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; int __pyx_t_13; char const *__pyx_t_14; PyObject *__pyx_t_15 = NULL; PyObject *__pyx_t_16 = NULL; PyObject *__pyx_t_17 = NULL; PyObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; PyObject *__pyx_t_20 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_illustration_item", 0); /* "libzim.pyx":1001 * def get_illustration_item(self, size: pyint = None) -> Item: * """Illustration Metadata Item for this size""" * try: # <<<<<<<<<<<<<< * if size is not None: * return Item.from_item(move(self.c_archive.getIllustrationItem(size))) */ { __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:*/ { /* "libzim.pyx":1002 * """Illustration Metadata Item for this size""" * try: * if size is not None: # <<<<<<<<<<<<<< * return Item.from_item(move(self.c_archive.getIllustrationItem(size))) * return Item.from_item(move(self.c_archive.getIllustrationItem())) */ __pyx_t_4 = (__pyx_v_size != Py_None); __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { /* "libzim.pyx":1003 * try: * if size is not None: * return Item.from_item(move(self.c_archive.getIllustrationItem(size))) # <<<<<<<<<<<<<< * return Item.from_item(move(self.c_archive.getIllustrationItem())) * except RuntimeError as e: */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_size); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1003, __pyx_L3_error) try { __pyx_t_7 = __pyx_v_self->c_archive.getIllustrationItem(__pyx_t_6); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 1003, __pyx_L3_error) } __pyx_t_8 = __pyx_f_6libzim_4Item_from_item(cython_std::move(__pyx_t_7)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1003, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_8); if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_6libzim_Item))))) __PYX_ERR(0, 1003, __pyx_L3_error) __pyx_r = ((struct __pyx_obj_6libzim_Item *)__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L7_try_return; /* "libzim.pyx":1002 * """Illustration Metadata Item for this size""" * try: * if size is not None: # <<<<<<<<<<<<<< * return Item.from_item(move(self.c_archive.getIllustrationItem(size))) * return Item.from_item(move(self.c_archive.getIllustrationItem())) */ } /* "libzim.pyx":1004 * if size is not None: * return Item.from_item(move(self.c_archive.getIllustrationItem(size))) * return Item.from_item(move(self.c_archive.getIllustrationItem())) # <<<<<<<<<<<<<< * except RuntimeError as e: * raise KeyError(str(e)) */ __Pyx_XDECREF(((PyObject *)__pyx_r)); try { __pyx_t_7 = __pyx_v_self->c_archive.getIllustrationItem(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 1004, __pyx_L3_error) } __pyx_t_8 = __pyx_f_6libzim_4Item_from_item(cython_std::move(__pyx_t_7)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1004, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_8); if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_6libzim_Item))))) __PYX_ERR(0, 1004, __pyx_L3_error) __pyx_r = ((struct __pyx_obj_6libzim_Item *)__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L7_try_return; /* "libzim.pyx":1001 * def get_illustration_item(self, size: pyint = None) -> Item: * """Illustration Metadata Item for this size""" * try: # <<<<<<<<<<<<<< * if size is not None: * return Item.from_item(move(self.c_archive.getIllustrationItem(size))) */ } __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; /* "libzim.pyx":1005 * return Item.from_item(move(self.c_archive.getIllustrationItem(size))) * return Item.from_item(move(self.c_archive.getIllustrationItem())) * except RuntimeError as e: # <<<<<<<<<<<<<< * raise KeyError(str(e)) * */ __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_RuntimeError); if (__pyx_t_6) { __Pyx_AddTraceback("libzim.Archive.get_illustration_item", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(0, 1005, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GOTREF(__pyx_t_9); __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_v_e = __pyx_t_9; /*try:*/ { /* "libzim.pyx":1006 * return Item.from_item(move(self.c_archive.getIllustrationItem())) * except RuntimeError as e: * raise KeyError(str(e)) # <<<<<<<<<<<<<< * * def __repr__(self) -> str: */ __pyx_t_11 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_e); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1006, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_builtin_KeyError, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1006, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_Raise(__pyx_t_12, 0, 0, 0); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __PYX_ERR(0, 1006, __pyx_L15_error) } /* "libzim.pyx":1005 * return Item.from_item(move(self.c_archive.getIllustrationItem(size))) * return Item.from_item(move(self.c_archive.getIllustrationItem())) * except RuntimeError as e: # <<<<<<<<<<<<<< * raise KeyError(str(e)) * */ /*finally:*/ { __pyx_L15_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17) < 0)) __Pyx_ErrFetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __Pyx_XGOTREF(__pyx_t_20); __pyx_t_6 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename; { __Pyx_DECREF(__pyx_v_e); __pyx_v_e = NULL; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_18); __Pyx_XGIVEREF(__pyx_t_19); __Pyx_XGIVEREF(__pyx_t_20); __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_19, __pyx_t_20); } __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_ErrRestore(__pyx_t_15, __pyx_t_16, __pyx_t_17); __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_lineno = __pyx_t_6; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14; goto __pyx_L5_except_error; } } } goto __pyx_L5_except_error; __pyx_L5_except_error:; /* "libzim.pyx":1001 * def get_illustration_item(self, size: pyint = None) -> Item: * """Illustration Metadata Item for this size""" * try: # <<<<<<<<<<<<<< * if size is not None: * return Item.from_item(move(self.c_archive.getIllustrationItem(size))) */ __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_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; } /* "libzim.pyx":999 * return self.c_archive.hasIllustration() * * def get_illustration_item(self, size: pyint = None) -> Item: # <<<<<<<<<<<<<< * """Illustration Metadata Item for this size""" * try: */ /* function exit code */ __pyx_L1_error:; __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("libzim.Archive.get_illustration_item", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_e); __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1008 * raise KeyError(str(e)) * * def __repr__(self) -> str: # <<<<<<<<<<<<<< * return f"{self.__class__.__name__}(filename={self.filename})" * */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_27__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_27__repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_26__repr__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_26__repr__(struct __pyx_obj_6libzim_Archive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; Py_UCS4 __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__repr__", 0); /* "libzim.pyx":1009 * * def __repr__(self) -> str: * return f"{self.__class__.__name__}(filename={self.filename})" # <<<<<<<<<<<<<< * * reader_module_doc = """libzim reader module */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1009, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = 127; __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1009, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_name_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1009, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_t_5, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1009, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_3; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = 0; __Pyx_INCREF(__pyx_kp_u_filename_2); __pyx_t_2 += 10; __Pyx_GIVEREF(__pyx_kp_u_filename_2); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u_filename_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_filename); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1009, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1009, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) > __pyx_t_3) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5) : __pyx_t_3; __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_kp_u__24); __pyx_t_2 += 1; __Pyx_GIVEREF(__pyx_kp_u__24); PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_kp_u__24); __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_1, 4, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1009, __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; /* "libzim.pyx":1008 * raise KeyError(str(e)) * * def __repr__(self) -> str: # <<<<<<<<<<<<<< * return f"{self.__class__.__name__}(filename={self.filename})" * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("libzim.Archive.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_29__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_29__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_28__reduce_cython__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_28__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Archive *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Archive.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7Archive_31__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ static PyObject *__pyx_pw_6libzim_7Archive_31__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_7Archive_30__setstate_cython__(((struct __pyx_obj_6libzim_Archive *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_7Archive_30__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Archive *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Archive.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1042 * cdef zim.Query c_query * * def set_query(self, query: str): # <<<<<<<<<<<<<< * self.c_query.setQuery(query.encode('UTF-8')) * return self */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_5Query_1set_query(PyObject *__pyx_v_self, PyObject *__pyx_v_query); /*proto*/ static PyObject *__pyx_pw_6libzim_5Query_1set_query(PyObject *__pyx_v_self, PyObject *__pyx_v_query) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_query (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_query), (&PyUnicode_Type), 1, "query", 1))) __PYX_ERR(0, 1042, __pyx_L1_error) __pyx_r = __pyx_pf_6libzim_5Query_set_query(((struct __pyx_obj_6libzim_Query *)__pyx_v_self), ((PyObject*)__pyx_v_query)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_5Query_set_query(struct __pyx_obj_6libzim_Query *__pyx_v_self, PyObject *__pyx_v_query) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; std::string __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_query", 0); /* "libzim.pyx":1043 * * def set_query(self, query: str): * self.c_query.setQuery(query.encode('UTF-8')) # <<<<<<<<<<<<<< * return self * */ if (unlikely(__pyx_v_query == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 1043, __pyx_L1_error) } __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_query); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1043, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1043, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; (void)(__pyx_v_self->c_query.setQuery(__pyx_t_2)); /* "libzim.pyx":1044 * def set_query(self, query: str): * self.c_query.setQuery(query.encode('UTF-8')) * return self # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; /* "libzim.pyx":1042 * cdef zim.Query c_query * * def set_query(self, query: str): # <<<<<<<<<<<<<< * self.c_query.setQuery(query.encode('UTF-8')) * return self */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Query.set_query", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("self.c_query cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_5Query_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_6libzim_5Query_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_5Query_2__reduce_cython__(((struct __pyx_obj_6libzim_Query *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_5Query_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Query *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("self.c_query cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_query cannot be converted to a Python object for pickling") */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("self.c_query cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Query.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("self.c_query cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("self.c_query cannot be converted to a Python object for pickling") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_5Query_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ static PyObject *__pyx_pw_6libzim_5Query_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_5Query_4__setstate_cython__(((struct __pyx_obj_6libzim_Query *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_5Query_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Query *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError("self.c_query cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_query cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("self.c_query cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("self.c_query cannot be converted to a Python object for pickling") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Query.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1053 * * @staticmethod * cdef from_resultset(zim.SearchResultSet _resultset): # <<<<<<<<<<<<<< * cdef SearchResultSet resultset = SearchResultSet() * resultset.c_resultset = move(_resultset) */ static PyObject *__pyx_f_6libzim_15SearchResultSet_from_resultset(wrapper::SearchResultSet __pyx_v__resultset) { struct __pyx_obj_6libzim_SearchResultSet *__pyx_v_resultset = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("from_resultset", 0); /* "libzim.pyx":1054 * @staticmethod * cdef from_resultset(zim.SearchResultSet _resultset): * cdef SearchResultSet resultset = SearchResultSet() # <<<<<<<<<<<<<< * resultset.c_resultset = move(_resultset) * return resultset */ __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6libzim_SearchResultSet)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1054, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_resultset = ((struct __pyx_obj_6libzim_SearchResultSet *)__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":1055 * cdef from_resultset(zim.SearchResultSet _resultset): * cdef SearchResultSet resultset = SearchResultSet() * resultset.c_resultset = move(_resultset) # <<<<<<<<<<<<<< * return resultset * */ __pyx_v_resultset->c_resultset = cython_std::move(__pyx_v__resultset); /* "libzim.pyx":1056 * cdef SearchResultSet resultset = SearchResultSet() * resultset.c_resultset = move(_resultset) * return resultset # <<<<<<<<<<<<<< * * def __iter__(self) -> Iterator[str]: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_resultset)); __pyx_r = ((PyObject *)__pyx_v_resultset); goto __pyx_L0; /* "libzim.pyx":1053 * * @staticmethod * cdef from_resultset(zim.SearchResultSet _resultset): # <<<<<<<<<<<<<< * cdef SearchResultSet resultset = SearchResultSet() * resultset.c_resultset = move(_resultset) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.SearchResultSet.from_resultset", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_resultset); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_6libzim_15SearchResultSet_2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ /* "libzim.pyx":1058 * return resultset * * def __iter__(self) -> Iterator[str]: # <<<<<<<<<<<<<< * """Entry paths found in Archive for Search""" * cdef zim.SearchIterator current = self.c_resultset.begin() */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_15SearchResultSet_1__iter__(PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_6libzim_15SearchResultSet___iter__[] = "Entry paths found in Archive for Search"; #if CYTHON_UPDATE_DESCRIPTOR_DOC struct wrapperbase __pyx_wrapperbase_6libzim_15SearchResultSet___iter__; #endif static PyObject *__pyx_pw_6libzim_15SearchResultSet_1__iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_15SearchResultSet___iter__(((struct __pyx_obj_6libzim_SearchResultSet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_15SearchResultSet___iter__(struct __pyx_obj_6libzim_SearchResultSet *__pyx_v_self) { struct __pyx_obj_6libzim___pyx_scope_struct_2___iter__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iter__", 0); __pyx_cur_scope = (struct __pyx_obj_6libzim___pyx_scope_struct_2___iter__ *)__pyx_tp_new_6libzim___pyx_scope_struct_2___iter__(__pyx_ptype_6libzim___pyx_scope_struct_2___iter__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_6libzim___pyx_scope_struct_2___iter__ *)Py_None); __Pyx_INCREF(Py_None); __PYX_ERR(0, 1058, __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6libzim_15SearchResultSet_2generator2, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_SearchResultSet___iter, __pyx_n_s_libzim); if (unlikely(!gen)) __PYX_ERR(0, 1058, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; } /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("libzim.SearchResultSet.__iter__", __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_6libzim_15SearchResultSet_2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ { struct __pyx_obj_6libzim___pyx_scope_struct_2___iter__ *__pyx_cur_scope = ((struct __pyx_obj_6libzim___pyx_scope_struct_2___iter__ *)__pyx_generator->closure); PyObject *__pyx_r = NULL; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__", 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, 1058, __pyx_L1_error) /* "libzim.pyx":1060 * def __iter__(self) -> Iterator[str]: * """Entry paths found in Archive for Search""" * cdef zim.SearchIterator current = self.c_resultset.begin() # <<<<<<<<<<<<<< * cdef zim.SearchIterator end = self.c_resultset.end() * while current != end: */ __pyx_cur_scope->__pyx_v_current = __pyx_cur_scope->__pyx_v_self->c_resultset.begin(); /* "libzim.pyx":1061 * """Entry paths found in Archive for Search""" * cdef zim.SearchIterator current = self.c_resultset.begin() * cdef zim.SearchIterator end = self.c_resultset.end() # <<<<<<<<<<<<<< * while current != end: * yield current.getPath().decode('UTF-8') */ __pyx_cur_scope->__pyx_v_end = __pyx_cur_scope->__pyx_v_self->c_resultset.end(); /* "libzim.pyx":1062 * cdef zim.SearchIterator current = self.c_resultset.begin() * cdef zim.SearchIterator end = self.c_resultset.end() * while current != end: # <<<<<<<<<<<<<< * yield current.getPath().decode('UTF-8') * preincrement(current) */ while (1) { __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_current != __pyx_cur_scope->__pyx_v_end) != 0); if (!__pyx_t_1) break; /* "libzim.pyx":1063 * cdef zim.SearchIterator end = self.c_resultset.end() * while current != end: * yield current.getPath().decode('UTF-8') # <<<<<<<<<<<<<< * preincrement(current) * */ __pyx_t_2 = __Pyx_decode_cpp_string(__pyx_cur_scope->__pyx_v_current.getPath(), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1063, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, yielding value */ __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1063, __pyx_L1_error) /* "libzim.pyx":1064 * while current != end: * yield current.getPath().decode('UTF-8') * preincrement(current) # <<<<<<<<<<<<<< * * cdef class Search: */ (void)((++__pyx_cur_scope->__pyx_v_current)); } CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); /* "libzim.pyx":1058 * return resultset * * def __iter__(self) -> Iterator[str]: # <<<<<<<<<<<<<< * """Entry paths found in Archive for Search""" * cdef zim.SearchIterator current = self.c_resultset.begin() */ /* function exit code */ PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_r = 0; #if !CYTHON_USE_EXC_INFO_STACK __Pyx_Coroutine_ResetAndClearException(__pyx_generator); #endif __pyx_generator->resume_label = -1; __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_15SearchResultSet_4__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_6libzim_15SearchResultSet_4__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_15SearchResultSet_3__reduce_cython__(((struct __pyx_obj_6libzim_SearchResultSet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_15SearchResultSet_3__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_SearchResultSet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.SearchResultSet.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_15SearchResultSet_6__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ static PyObject *__pyx_pw_6libzim_15SearchResultSet_6__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_15SearchResultSet_5__setstate_cython__(((struct __pyx_obj_6libzim_SearchResultSet *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_15SearchResultSet_5__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_SearchResultSet *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.SearchResultSet.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1073 * # Factory functions - Currently Cython can't use classmethods * @staticmethod * cdef from_search(zim.Search _search): # <<<<<<<<<<<<<< * """Creates a python ReadArticle from a C++ Article (zim::) -> ReadArticle * */ static PyObject *__pyx_f_6libzim_6Search_from_search(wrapper::Search __pyx_v__search) { struct __pyx_obj_6libzim_Search *__pyx_v_search = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("from_search", 0); /* "libzim.pyx":1084 * Item * Casted item""" * cdef Search search = Search() # <<<<<<<<<<<<<< * search.c_search = move(_search) * return search */ __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6libzim_Search)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1084, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_search = ((struct __pyx_obj_6libzim_Search *)__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":1085 * Casted item""" * cdef Search search = Search() * search.c_search = move(_search) # <<<<<<<<<<<<<< * return search * */ __pyx_v_search->c_search = cython_std::move(__pyx_v__search); /* "libzim.pyx":1086 * cdef Search search = Search() * search.c_search = move(_search) * return search # <<<<<<<<<<<<<< * * def getEstimatedMatches(self) -> pyint: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_search)); __pyx_r = ((PyObject *)__pyx_v_search); goto __pyx_L0; /* "libzim.pyx":1073 * # Factory functions - Currently Cython can't use classmethods * @staticmethod * cdef from_search(zim.Search _search): # <<<<<<<<<<<<<< * """Creates a python ReadArticle from a C++ Article (zim::) -> ReadArticle * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Search.from_search", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_search); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1088 * return search * * def getEstimatedMatches(self) -> pyint: # <<<<<<<<<<<<<< * """Estimated number of results in Archive for the search""" * return self.c_search.getEstimatedMatches() */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_6Search_1getEstimatedMatches(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6libzim_6Search_getEstimatedMatches[] = "Estimated number of results in Archive for the search"; static PyObject *__pyx_pw_6libzim_6Search_1getEstimatedMatches(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getEstimatedMatches (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_6Search_getEstimatedMatches(((struct __pyx_obj_6libzim_Search *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_6Search_getEstimatedMatches(struct __pyx_obj_6libzim_Search *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("getEstimatedMatches", 0); /* "libzim.pyx":1090 * def getEstimatedMatches(self) -> pyint: * """Estimated number of results in Archive for the search""" * return self.c_search.getEstimatedMatches() # <<<<<<<<<<<<<< * * def getResults(self, start: pyint, count: pyint) -> SearchResultSet: */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_search.getEstimatedMatches(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 1090, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1090, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":1088 * return search * * def getEstimatedMatches(self) -> pyint: # <<<<<<<<<<<<<< * """Estimated number of results in Archive for the search""" * return self.c_search.getEstimatedMatches() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Search.getEstimatedMatches", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1092 * return self.c_search.getEstimatedMatches() * * def getResults(self, start: pyint, count: pyint) -> SearchResultSet: # <<<<<<<<<<<<<< * """Iterator over Entry paths found in Archive for the search""" * return SearchResultSet.from_resultset(move(self.c_search.getResults(start, count))) */ /* Python wrapper */ static struct __pyx_obj_6libzim_SearchResultSet *__pyx_pw_6libzim_6Search_3getResults(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6libzim_6Search_2getResults[] = "Iterator over Entry paths found in Archive for the search"; static struct __pyx_obj_6libzim_SearchResultSet *__pyx_pw_6libzim_6Search_3getResults(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_start = 0; PyObject *__pyx_v_count = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; struct __pyx_obj_6libzim_SearchResultSet *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getResults (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_start,&__pyx_n_s_count,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); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_count)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("getResults", 1, 2, 2, 1); __PYX_ERR(0, 1092, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getResults") < 0)) __PYX_ERR(0, 1092, __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_start = values[0]; __pyx_v_count = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("getResults", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1092, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim.Search.getResults", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6libzim_6Search_2getResults(((struct __pyx_obj_6libzim_Search *)__pyx_v_self), __pyx_v_start, __pyx_v_count); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_obj_6libzim_SearchResultSet *__pyx_pf_6libzim_6Search_2getResults(struct __pyx_obj_6libzim_Search *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_count) { struct __pyx_obj_6libzim_SearchResultSet *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; wrapper::SearchResultSet __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("getResults", 0); /* "libzim.pyx":1094 * def getResults(self, start: pyint, count: pyint) -> SearchResultSet: * """Iterator over Entry paths found in Archive for the search""" * return SearchResultSet.from_resultset(move(self.c_search.getResults(start, count))) # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_start); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1094, __pyx_L1_error) __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_count); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1094, __pyx_L1_error) try { __pyx_t_3 = __pyx_v_self->c_search.getResults(__pyx_t_1, __pyx_t_2); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 1094, __pyx_L1_error) } __pyx_t_4 = __pyx_f_6libzim_15SearchResultSet_from_resultset(cython_std::move(__pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1094, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6libzim_SearchResultSet))))) __PYX_ERR(0, 1094, __pyx_L1_error) __pyx_r = ((struct __pyx_obj_6libzim_SearchResultSet *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0; /* "libzim.pyx":1092 * return self.c_search.getEstimatedMatches() * * def getResults(self, start: pyint, count: pyint) -> SearchResultSet: # <<<<<<<<<<<<<< * """Iterator over Entry paths found in Archive for the search""" * return SearchResultSet.from_resultset(move(self.c_search.getResults(start, count))) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("libzim.Search.getResults", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("self.c_search cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_6Search_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_6libzim_6Search_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_6Search_4__reduce_cython__(((struct __pyx_obj_6libzim_Search *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_6Search_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Search *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("self.c_search cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_search cannot be converted to a Python object for pickling") */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("self.c_search cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Search.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("self.c_search cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("self.c_search cannot be converted to a Python object for pickling") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_6Search_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ static PyObject *__pyx_pw_6libzim_6Search_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_6Search_6__setstate_cython__(((struct __pyx_obj_6libzim_Search *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_6Search_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Search *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError("self.c_search cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_search cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("self.c_search cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("self.c_search cannot be converted to a Python object for pickling") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Search.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1108 * cdef zim.Searcher c_searcher * * def __cinit__(self, object archive: Archive): # <<<<<<<<<<<<<< * """Constructs an Archive from full zim file path * */ /* Python wrapper */ static int __pyx_pw_6libzim_8Searcher_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6libzim_8Searcher_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_6libzim_Archive *__pyx_v_archive = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_archive,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); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_archive)) != 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, "__cinit__") < 0)) __PYX_ERR(0, 1108, __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_archive = ((struct __pyx_obj_6libzim_Archive *)values[0]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1108, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim.Searcher.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_archive), __pyx_ptype_6libzim_Archive, 1, "archive", 0))) __PYX_ERR(0, 1108, __pyx_L1_error) __pyx_r = __pyx_pf_6libzim_8Searcher___cinit__(((struct __pyx_obj_6libzim_Searcher *)__pyx_v_self), __pyx_v_archive); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6libzim_8Searcher___cinit__(struct __pyx_obj_6libzim_Searcher *__pyx_v_self, struct __pyx_obj_6libzim_Archive *__pyx_v_archive) { int __pyx_r; __Pyx_RefNannyDeclarations wrapper::Searcher __pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); /* "libzim.pyx":1116 * Full path to a zim file""" * * self.c_searcher = move(zim.Searcher(archive.c_archive)) # <<<<<<<<<<<<<< * * def search(self, object query: Query) -> Search: */ try { __pyx_t_1 = wrapper::Searcher(__pyx_v_archive->c_archive); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 1116, __pyx_L1_error) } __pyx_v_self->c_searcher = cython_std::move(__pyx_t_1); /* "libzim.pyx":1108 * cdef zim.Searcher c_searcher * * def __cinit__(self, object archive: Archive): # <<<<<<<<<<<<<< * """Constructs an Archive from full zim file path * */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("libzim.Searcher.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1118 * self.c_searcher = move(zim.Searcher(archive.c_archive)) * * def search(self, object query: Query) -> Search: # <<<<<<<<<<<<<< * """Search object for a query of this Searcher's ZIM Archive""" * return Search.from_search(move(self.c_searcher.search(query.c_query))) */ /* Python wrapper */ static struct __pyx_obj_6libzim_Search *__pyx_pw_6libzim_8Searcher_3search(PyObject *__pyx_v_self, PyObject *__pyx_v_query); /*proto*/ static char __pyx_doc_6libzim_8Searcher_2search[] = "Search object for a query of this Searcher's ZIM Archive"; static struct __pyx_obj_6libzim_Search *__pyx_pw_6libzim_8Searcher_3search(PyObject *__pyx_v_self, PyObject *__pyx_v_query) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; struct __pyx_obj_6libzim_Search *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("search (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_query), __pyx_ptype_6libzim_Query, 1, "query", 0))) __PYX_ERR(0, 1118, __pyx_L1_error) __pyx_r = __pyx_pf_6libzim_8Searcher_2search(((struct __pyx_obj_6libzim_Searcher *)__pyx_v_self), ((struct __pyx_obj_6libzim_Query *)__pyx_v_query)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_obj_6libzim_Search *__pyx_pf_6libzim_8Searcher_2search(struct __pyx_obj_6libzim_Searcher *__pyx_v_self, struct __pyx_obj_6libzim_Query *__pyx_v_query) { struct __pyx_obj_6libzim_Search *__pyx_r = NULL; __Pyx_RefNannyDeclarations wrapper::Search __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("search", 0); /* "libzim.pyx":1120 * def search(self, object query: Query) -> Search: * """Search object for a query of this Searcher's ZIM Archive""" * return Search.from_search(move(self.c_searcher.search(query.c_query))) # <<<<<<<<<<<<<< * * search_module_doc = """libzim search module */ __Pyx_XDECREF(((PyObject *)__pyx_r)); try { __pyx_t_1 = __pyx_v_self->c_searcher.search(__pyx_v_query->c_query); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 1120, __pyx_L1_error) } __pyx_t_2 = __pyx_f_6libzim_6Search_from_search(cython_std::move(__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6libzim_Search))))) __PYX_ERR(0, 1120, __pyx_L1_error) __pyx_r = ((struct __pyx_obj_6libzim_Search *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":1118 * self.c_searcher = move(zim.Searcher(archive.c_archive)) * * def search(self, object query: Query) -> Search: # <<<<<<<<<<<<<< * """Search object for a query of this Searcher's ZIM Archive""" * return Search.from_search(move(self.c_searcher.search(query.c_query))) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.Searcher.search", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_8Searcher_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_6libzim_8Searcher_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_8Searcher_4__reduce_cython__(((struct __pyx_obj_6libzim_Searcher *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_8Searcher_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Searcher *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Searcher.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_8Searcher_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ static PyObject *__pyx_pw_6libzim_8Searcher_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_8Searcher_6__setstate_cython__(((struct __pyx_obj_6libzim_Searcher *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_8Searcher_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_Searcher *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.Searcher.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1154 * * @staticmethod * cdef from_resultset(zim.SuggestionResultSet _resultset): # <<<<<<<<<<<<<< * cdef SuggestionResultSet resultset = SuggestionResultSet() * resultset.c_resultset = move(_resultset) */ static PyObject *__pyx_f_6libzim_19SuggestionResultSet_from_resultset(wrapper::SuggestionResultSet __pyx_v__resultset) { struct __pyx_obj_6libzim_SuggestionResultSet *__pyx_v_resultset = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("from_resultset", 0); /* "libzim.pyx":1155 * @staticmethod * cdef from_resultset(zim.SuggestionResultSet _resultset): * cdef SuggestionResultSet resultset = SuggestionResultSet() # <<<<<<<<<<<<<< * resultset.c_resultset = move(_resultset) * return resultset */ __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6libzim_SuggestionResultSet)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_resultset = ((struct __pyx_obj_6libzim_SuggestionResultSet *)__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":1156 * cdef from_resultset(zim.SuggestionResultSet _resultset): * cdef SuggestionResultSet resultset = SuggestionResultSet() * resultset.c_resultset = move(_resultset) # <<<<<<<<<<<<<< * return resultset * */ __pyx_v_resultset->c_resultset = cython_std::move(__pyx_v__resultset); /* "libzim.pyx":1157 * cdef SuggestionResultSet resultset = SuggestionResultSet() * resultset.c_resultset = move(_resultset) * return resultset # <<<<<<<<<<<<<< * * def __iter__(self) -> Iterator[str]: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_resultset)); __pyx_r = ((PyObject *)__pyx_v_resultset); goto __pyx_L0; /* "libzim.pyx":1154 * * @staticmethod * cdef from_resultset(zim.SuggestionResultSet _resultset): # <<<<<<<<<<<<<< * cdef SuggestionResultSet resultset = SuggestionResultSet() * resultset.c_resultset = move(_resultset) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.SuggestionResultSet.from_resultset", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_resultset); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_6libzim_19SuggestionResultSet_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ /* "libzim.pyx":1159 * return resultset * * def __iter__(self) -> Iterator[str]: # <<<<<<<<<<<<<< * """Entry paths found in Archive for SuggestionSearch""" * cdef zim.SuggestionIterator current = self.c_resultset.begin() */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_19SuggestionResultSet_1__iter__(PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_6libzim_19SuggestionResultSet___iter__[] = "Entry paths found in Archive for SuggestionSearch"; #if CYTHON_UPDATE_DESCRIPTOR_DOC struct wrapperbase __pyx_wrapperbase_6libzim_19SuggestionResultSet___iter__; #endif static PyObject *__pyx_pw_6libzim_19SuggestionResultSet_1__iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_19SuggestionResultSet___iter__(((struct __pyx_obj_6libzim_SuggestionResultSet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_19SuggestionResultSet___iter__(struct __pyx_obj_6libzim_SuggestionResultSet *__pyx_v_self) { struct __pyx_obj_6libzim___pyx_scope_struct_3___iter__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iter__", 0); __pyx_cur_scope = (struct __pyx_obj_6libzim___pyx_scope_struct_3___iter__ *)__pyx_tp_new_6libzim___pyx_scope_struct_3___iter__(__pyx_ptype_6libzim___pyx_scope_struct_3___iter__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_6libzim___pyx_scope_struct_3___iter__ *)Py_None); __Pyx_INCREF(Py_None); __PYX_ERR(0, 1159, __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_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6libzim_19SuggestionResultSet_2generator3, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_SuggestionResultSet___iter, __pyx_n_s_libzim); if (unlikely(!gen)) __PYX_ERR(0, 1159, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; } /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("libzim.SuggestionResultSet.__iter__", __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_6libzim_19SuggestionResultSet_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */ { struct __pyx_obj_6libzim___pyx_scope_struct_3___iter__ *__pyx_cur_scope = ((struct __pyx_obj_6libzim___pyx_scope_struct_3___iter__ *)__pyx_generator->closure); PyObject *__pyx_r = NULL; int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__", 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, 1159, __pyx_L1_error) /* "libzim.pyx":1161 * def __iter__(self) -> Iterator[str]: * """Entry paths found in Archive for SuggestionSearch""" * cdef zim.SuggestionIterator current = self.c_resultset.begin() # <<<<<<<<<<<<<< * cdef zim.SuggestionIterator end = self.c_resultset.end() * while current != end: */ __pyx_cur_scope->__pyx_v_current = __pyx_cur_scope->__pyx_v_self->c_resultset.begin(); /* "libzim.pyx":1162 * """Entry paths found in Archive for SuggestionSearch""" * cdef zim.SuggestionIterator current = self.c_resultset.begin() * cdef zim.SuggestionIterator end = self.c_resultset.end() # <<<<<<<<<<<<<< * while current != end: * yield current.getSuggestionItem().getPath().decode('UTF-8') */ __pyx_cur_scope->__pyx_v_end = __pyx_cur_scope->__pyx_v_self->c_resultset.end(); /* "libzim.pyx":1163 * cdef zim.SuggestionIterator current = self.c_resultset.begin() * cdef zim.SuggestionIterator end = self.c_resultset.end() * while current != end: # <<<<<<<<<<<<<< * yield current.getSuggestionItem().getPath().decode('UTF-8') * preincrement(current) */ while (1) { __pyx_t_1 = ((__pyx_cur_scope->__pyx_v_current != __pyx_cur_scope->__pyx_v_end) != 0); if (!__pyx_t_1) break; /* "libzim.pyx":1164 * cdef zim.SuggestionIterator end = self.c_resultset.end() * while current != end: * yield current.getSuggestionItem().getPath().decode('UTF-8') # <<<<<<<<<<<<<< * preincrement(current) * */ __pyx_t_2 = __Pyx_decode_cpp_string(__pyx_cur_scope->__pyx_v_current.getSuggestionItem().getPath(), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); __Pyx_Coroutine_ResetAndClearException(__pyx_generator); /* return from generator, yielding value */ __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1164, __pyx_L1_error) /* "libzim.pyx":1165 * while current != end: * yield current.getSuggestionItem().getPath().decode('UTF-8') * preincrement(current) # <<<<<<<<<<<<<< * * cdef class SuggestionSearch: */ (void)((++__pyx_cur_scope->__pyx_v_current)); } CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); /* "libzim.pyx":1159 * return resultset * * def __iter__(self) -> Iterator[str]: # <<<<<<<<<<<<<< * """Entry paths found in Archive for SuggestionSearch""" * cdef zim.SuggestionIterator current = self.c_resultset.begin() */ /* function exit code */ PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_r = 0; #if !CYTHON_USE_EXC_INFO_STACK __Pyx_Coroutine_ResetAndClearException(__pyx_generator); #endif __pyx_generator->resume_label = -1; __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_19SuggestionResultSet_4__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_6libzim_19SuggestionResultSet_4__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_19SuggestionResultSet_3__reduce_cython__(((struct __pyx_obj_6libzim_SuggestionResultSet *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_19SuggestionResultSet_3__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_SuggestionResultSet *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.SuggestionResultSet.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_19SuggestionResultSet_6__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ static PyObject *__pyx_pw_6libzim_19SuggestionResultSet_6__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_19SuggestionResultSet_5__setstate_cython__(((struct __pyx_obj_6libzim_SuggestionResultSet *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_19SuggestionResultSet_5__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_SuggestionResultSet *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.SuggestionResultSet.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1173 * # Factory functions - Currently Cython can't use classmethods * @staticmethod * cdef from_search(zim.SuggestionSearch _search): # <<<<<<<<<<<<<< * """Creates a python ReadArticle from a C++ Article (zim::) -> ReadArticle * */ static PyObject *__pyx_f_6libzim_16SuggestionSearch_from_search(wrapper::SuggestionSearch __pyx_v__search) { struct __pyx_obj_6libzim_SuggestionSearch *__pyx_v_search = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("from_search", 0); /* "libzim.pyx":1184 * Item * Casted item""" * cdef SuggestionSearch search = SuggestionSearch() # <<<<<<<<<<<<<< * search.c_search = move(_search) * return search */ __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6libzim_SuggestionSearch)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_search = ((struct __pyx_obj_6libzim_SuggestionSearch *)__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":1185 * Casted item""" * cdef SuggestionSearch search = SuggestionSearch() * search.c_search = move(_search) # <<<<<<<<<<<<<< * return search * */ __pyx_v_search->c_search = cython_std::move(__pyx_v__search); /* "libzim.pyx":1186 * cdef SuggestionSearch search = SuggestionSearch() * search.c_search = move(_search) * return search # <<<<<<<<<<<<<< * * def getEstimatedMatches(self) -> pyint: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_search)); __pyx_r = ((PyObject *)__pyx_v_search); goto __pyx_L0; /* "libzim.pyx":1173 * # Factory functions - Currently Cython can't use classmethods * @staticmethod * cdef from_search(zim.SuggestionSearch _search): # <<<<<<<<<<<<<< * """Creates a python ReadArticle from a C++ Article (zim::) -> ReadArticle * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.SuggestionSearch.from_search", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_search); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1188 * return search * * def getEstimatedMatches(self) -> pyint: # <<<<<<<<<<<<<< * """Estimated number of results in Archive for the suggestion search""" * return self.c_search.getEstimatedMatches() */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_16SuggestionSearch_1getEstimatedMatches(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6libzim_16SuggestionSearch_getEstimatedMatches[] = "Estimated number of results in Archive for the suggestion search"; static PyObject *__pyx_pw_6libzim_16SuggestionSearch_1getEstimatedMatches(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getEstimatedMatches (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_16SuggestionSearch_getEstimatedMatches(((struct __pyx_obj_6libzim_SuggestionSearch *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_16SuggestionSearch_getEstimatedMatches(struct __pyx_obj_6libzim_SuggestionSearch *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("getEstimatedMatches", 0); /* "libzim.pyx":1190 * def getEstimatedMatches(self) -> pyint: * """Estimated number of results in Archive for the suggestion search""" * return self.c_search.getEstimatedMatches() # <<<<<<<<<<<<<< * * def getResults(self, start: pyint, count: pyint) -> SuggestionResultSet: */ __Pyx_XDECREF(__pyx_r); try { __pyx_t_1 = __pyx_v_self->c_search.getEstimatedMatches(); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 1190, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":1188 * return search * * def getEstimatedMatches(self) -> pyint: # <<<<<<<<<<<<<< * """Estimated number of results in Archive for the suggestion search""" * return self.c_search.getEstimatedMatches() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libzim.SuggestionSearch.getEstimatedMatches", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1192 * return self.c_search.getEstimatedMatches() * * def getResults(self, start: pyint, count: pyint) -> SuggestionResultSet: # <<<<<<<<<<<<<< * """Iterator over Entry paths found in Archive for the suggestion search""" * return SuggestionResultSet.from_resultset(move(self.c_search.getResults(start, count))) */ /* Python wrapper */ static struct __pyx_obj_6libzim_SuggestionResultSet *__pyx_pw_6libzim_16SuggestionSearch_3getResults(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6libzim_16SuggestionSearch_2getResults[] = "Iterator over Entry paths found in Archive for the suggestion search"; static struct __pyx_obj_6libzim_SuggestionResultSet *__pyx_pw_6libzim_16SuggestionSearch_3getResults(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_start = 0; PyObject *__pyx_v_count = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; struct __pyx_obj_6libzim_SuggestionResultSet *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getResults (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_start,&__pyx_n_s_count,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); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_count)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("getResults", 1, 2, 2, 1); __PYX_ERR(0, 1192, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getResults") < 0)) __PYX_ERR(0, 1192, __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_start = values[0]; __pyx_v_count = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("getResults", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1192, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim.SuggestionSearch.getResults", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6libzim_16SuggestionSearch_2getResults(((struct __pyx_obj_6libzim_SuggestionSearch *)__pyx_v_self), __pyx_v_start, __pyx_v_count); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_obj_6libzim_SuggestionResultSet *__pyx_pf_6libzim_16SuggestionSearch_2getResults(struct __pyx_obj_6libzim_SuggestionSearch *__pyx_v_self, PyObject *__pyx_v_start, PyObject *__pyx_v_count) { struct __pyx_obj_6libzim_SuggestionResultSet *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; wrapper::SuggestionResultSet __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("getResults", 0); /* "libzim.pyx":1194 * def getResults(self, start: pyint, count: pyint) -> SuggestionResultSet: * """Iterator over Entry paths found in Archive for the suggestion search""" * return SuggestionResultSet.from_resultset(move(self.c_search.getResults(start, count))) # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_start); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1194, __pyx_L1_error) __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_count); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1194, __pyx_L1_error) try { __pyx_t_3 = __pyx_v_self->c_search.getResults(__pyx_t_1, __pyx_t_2); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 1194, __pyx_L1_error) } __pyx_t_4 = __pyx_f_6libzim_19SuggestionResultSet_from_resultset(cython_std::move(__pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6libzim_SuggestionResultSet))))) __PYX_ERR(0, 1194, __pyx_L1_error) __pyx_r = ((struct __pyx_obj_6libzim_SuggestionResultSet *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0; /* "libzim.pyx":1192 * return self.c_search.getEstimatedMatches() * * def getResults(self, start: pyint, count: pyint) -> SuggestionResultSet: # <<<<<<<<<<<<<< * """Iterator over Entry paths found in Archive for the suggestion search""" * return SuggestionResultSet.from_resultset(move(self.c_search.getResults(start, count))) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("libzim.SuggestionSearch.getResults", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("self.c_search cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_16SuggestionSearch_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_6libzim_16SuggestionSearch_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_16SuggestionSearch_4__reduce_cython__(((struct __pyx_obj_6libzim_SuggestionSearch *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_16SuggestionSearch_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_SuggestionSearch *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("self.c_search cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_search cannot be converted to a Python object for pickling") */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("self.c_search cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.SuggestionSearch.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("self.c_search cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("self.c_search cannot be converted to a Python object for pickling") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_16SuggestionSearch_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ static PyObject *__pyx_pw_6libzim_16SuggestionSearch_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_16SuggestionSearch_6__setstate_cython__(((struct __pyx_obj_6libzim_SuggestionSearch *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_16SuggestionSearch_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_SuggestionSearch *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError("self.c_search cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_search cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("self.c_search cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("self.c_search cannot be converted to a Python object for pickling") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.SuggestionSearch.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1208 * cdef zim.SuggestionSearcher c_searcher * * def __cinit__(self, object archive: Archive): # <<<<<<<<<<<<<< * """Constructs an Archive from full zim file path * */ /* Python wrapper */ static int __pyx_pw_6libzim_18SuggestionSearcher_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_6libzim_18SuggestionSearcher_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_6libzim_Archive *__pyx_v_archive = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_archive,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); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_archive)) != 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, "__cinit__") < 0)) __PYX_ERR(0, 1208, __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_archive = ((struct __pyx_obj_6libzim_Archive *)values[0]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1208, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim.SuggestionSearcher.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_archive), __pyx_ptype_6libzim_Archive, 1, "archive", 0))) __PYX_ERR(0, 1208, __pyx_L1_error) __pyx_r = __pyx_pf_6libzim_18SuggestionSearcher___cinit__(((struct __pyx_obj_6libzim_SuggestionSearcher *)__pyx_v_self), __pyx_v_archive); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_6libzim_18SuggestionSearcher___cinit__(struct __pyx_obj_6libzim_SuggestionSearcher *__pyx_v_self, struct __pyx_obj_6libzim_Archive *__pyx_v_archive) { int __pyx_r; __Pyx_RefNannyDeclarations wrapper::SuggestionSearcher __pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); /* "libzim.pyx":1216 * Full path to a zim file""" * * self.c_searcher = move(zim.SuggestionSearcher(archive.c_archive)) # <<<<<<<<<<<<<< * * def suggest(self, query: str) -> SuggestionSearch: */ try { __pyx_t_1 = wrapper::SuggestionSearcher(__pyx_v_archive->c_archive); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 1216, __pyx_L1_error) } __pyx_v_self->c_searcher = cython_std::move(__pyx_t_1); /* "libzim.pyx":1208 * cdef zim.SuggestionSearcher c_searcher * * def __cinit__(self, object archive: Archive): # <<<<<<<<<<<<<< * """Constructs an Archive from full zim file path * */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("libzim.SuggestionSearcher.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1218 * self.c_searcher = move(zim.SuggestionSearcher(archive.c_archive)) * * def suggest(self, query: str) -> SuggestionSearch: # <<<<<<<<<<<<<< * """SuggestionSearch object for a query of this SuggestionSearcher's ZIM Archive""" * return SuggestionSearch.from_search(move(self.c_searcher.suggest(query.encode('UTF-8')))) */ /* Python wrapper */ static struct __pyx_obj_6libzim_SuggestionSearch *__pyx_pw_6libzim_18SuggestionSearcher_3suggest(PyObject *__pyx_v_self, PyObject *__pyx_v_query); /*proto*/ static char __pyx_doc_6libzim_18SuggestionSearcher_2suggest[] = "SuggestionSearch object for a query of this SuggestionSearcher's ZIM Archive"; static struct __pyx_obj_6libzim_SuggestionSearch *__pyx_pw_6libzim_18SuggestionSearcher_3suggest(PyObject *__pyx_v_self, PyObject *__pyx_v_query) { int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; struct __pyx_obj_6libzim_SuggestionSearch *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("suggest (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_query), (&PyUnicode_Type), 1, "query", 1))) __PYX_ERR(0, 1218, __pyx_L1_error) __pyx_r = __pyx_pf_6libzim_18SuggestionSearcher_2suggest(((struct __pyx_obj_6libzim_SuggestionSearcher *)__pyx_v_self), ((PyObject*)__pyx_v_query)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_obj_6libzim_SuggestionSearch *__pyx_pf_6libzim_18SuggestionSearcher_2suggest(struct __pyx_obj_6libzim_SuggestionSearcher *__pyx_v_self, PyObject *__pyx_v_query) { struct __pyx_obj_6libzim_SuggestionSearch *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; std::string __pyx_t_2; wrapper::SuggestionSearch __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("suggest", 0); /* "libzim.pyx":1220 * def suggest(self, query: str) -> SuggestionSearch: * """SuggestionSearch object for a query of this SuggestionSearcher's ZIM Archive""" * return SuggestionSearch.from_search(move(self.c_searcher.suggest(query.encode('UTF-8')))) # <<<<<<<<<<<<<< * * suggestion_module_doc = """libzim suggestion module */ __Pyx_XDECREF(((PyObject *)__pyx_r)); if (unlikely(__pyx_v_query == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 1220, __pyx_L1_error) } __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_query); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1220, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; try { __pyx_t_3 = __pyx_v_self->c_searcher.suggest(__pyx_t_2); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 1220, __pyx_L1_error) } __pyx_t_1 = __pyx_f_6libzim_16SuggestionSearch_from_search(cython_std::move(__pyx_t_3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6libzim_SuggestionSearch))))) __PYX_ERR(0, 1220, __pyx_L1_error) __pyx_r = ((struct __pyx_obj_6libzim_SuggestionSearch *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "libzim.pyx":1218 * self.c_searcher = move(zim.SuggestionSearcher(archive.c_archive)) * * def suggest(self, query: str) -> SuggestionSearch: # <<<<<<<<<<<<<< * """SuggestionSearch object for a query of this SuggestionSearcher's ZIM Archive""" * return SuggestionSearch.from_search(move(self.c_searcher.suggest(query.encode('UTF-8')))) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.SuggestionSearcher.suggest", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_18SuggestionSearcher_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_6libzim_18SuggestionSearcher_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_18SuggestionSearcher_4__reduce_cython__(((struct __pyx_obj_6libzim_SuggestionSearcher *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_18SuggestionSearcher_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_SuggestionSearcher *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __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, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.SuggestionSearcher.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_18SuggestionSearcher_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ static PyObject *__pyx_pw_6libzim_18SuggestionSearcher_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_18SuggestionSearcher_6__setstate_cython__(((struct __pyx_obj_6libzim_SuggestionSearcher *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_18SuggestionSearcher_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6libzim_SuggestionSearcher *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __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, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libzim.SuggestionSearcher.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1253 * * * def print_versions(out: Union[sys.stdout, sys.stderr] = sys.stdout): # <<<<<<<<<<<<<< * """print libzim and its dependencies list with their versions""" * for library, version in get_versions().items(): */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_3print_versions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6libzim_2print_versions[] = "print libzim and its dependencies list with their versions"; static PyMethodDef __pyx_mdef_6libzim_3print_versions = {"print_versions", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6libzim_3print_versions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6libzim_2print_versions}; static PyObject *__pyx_pw_6libzim_3print_versions(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_out = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("print_versions (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_out,0}; PyObject* values[1] = {0}; values[0] = __pyx_k__49; 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); CYTHON_FALLTHROUGH; 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 = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_out); if (value) { values[0] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "print_versions") < 0)) __PYX_ERR(0, 1253, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_out = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("print_versions", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1253, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim.print_versions", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6libzim_2print_versions(__pyx_self, __pyx_v_out); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_2print_versions(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_out) { PyObject *__pyx_v_library = NULL; PyObject *__pyx_v_version = NULL; PyObject *__pyx_v_prefix = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations 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; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_t_9; Py_ssize_t __pyx_t_10; Py_UCS4 __pyx_t_11; PyObject *__pyx_t_12 = NULL; PyObject *__pyx_t_13 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("print_versions", 0); /* "libzim.pyx":1255 * def print_versions(out: Union[sys.stdout, sys.stderr] = sys.stdout): * """print libzim and its dependencies list with their versions""" * for library, version in get_versions().items(): # <<<<<<<<<<<<<< * prefix = "" if library == "libzim" else "+ " * print(f"{prefix}{library} {version}", file=out or sys.stdout) */ __pyx_t_2 = 0; __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_get_versions); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1255, __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); } } __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(__pyx_t_5 == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); __PYX_ERR(0, 1255, __pyx_L1_error) } __pyx_t_6 = __Pyx_dict_iterator(__pyx_t_5, 0, __pyx_n_s_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = __pyx_t_6; __pyx_t_6 = 0; while (1) { __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_6, &__pyx_t_5, NULL, __pyx_t_4); if (unlikely(__pyx_t_8 == 0)) break; if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 1255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_5); __Pyx_XDECREF_SET(__pyx_v_library, __pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF_SET(__pyx_v_version, __pyx_t_5); __pyx_t_5 = 0; /* "libzim.pyx":1256 * """print libzim and its dependencies list with their versions""" * for library, version in get_versions().items(): * prefix = "" if library == "libzim" else "+ " # <<<<<<<<<<<<<< * print(f"{prefix}{library} {version}", file=out or sys.stdout) * */ __pyx_t_9 = (__Pyx_PyUnicode_Equals(__pyx_v_library, __pyx_n_u_libzim, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1256, __pyx_L1_error) if (__pyx_t_9) { __Pyx_INCREF(__pyx_kp_u_); __pyx_t_5 = __pyx_kp_u_; } else { __Pyx_INCREF(__pyx_kp_u__50); __pyx_t_5 = __pyx_kp_u__50; } __Pyx_XDECREF_SET(__pyx_v_prefix, ((PyObject*)__pyx_t_5)); __pyx_t_5 = 0; /* "libzim.pyx":1257 * for library, version in get_versions().items(): * prefix = "" if library == "libzim" else "+ " * print(f"{prefix}{library} {version}", file=out or sys.stdout) # <<<<<<<<<<<<<< * * */ __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_10 = 0; __pyx_t_11 = 127; __pyx_t_6 = __Pyx_PyUnicode_Unicode(__pyx_v_prefix); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_11; __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_library, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_11; __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); __pyx_t_6 = 0; __Pyx_INCREF(__pyx_kp_u__51); __pyx_t_10 += 1; __Pyx_GIVEREF(__pyx_kp_u__51); PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__51); __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_v_version, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_11 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_11) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_11; __pyx_t_10 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 4, __pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1257, __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, 1257, __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_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_out); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1257, __pyx_L1_error) if (!__pyx_t_9) { } else { __Pyx_INCREF(__pyx_v_out); __pyx_t_7 = __pyx_v_out; goto __pyx_L5_bool_binop_done; } __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_sys); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_stdout); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_INCREF(__pyx_t_13); __pyx_t_7 = __pyx_t_13; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_L5_bool_binop_done:; if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_file, __pyx_t_7) < 0) __PYX_ERR(0, 1257, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __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_1); __pyx_t_1 = 0; /* "libzim.pyx":1253 * * * def print_versions(out: Union[sys.stdout, sys.stderr] = sys.stdout): # <<<<<<<<<<<<<< * """print libzim and its dependencies list with their versions""" * for library, version in get_versions().items(): */ /* 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_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); __Pyx_AddTraceback("libzim.print_versions", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_library); __Pyx_XDECREF(__pyx_v_version); __Pyx_XDECREF(__pyx_v_prefix); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1260 * * * def get_versions() -> OrderedDict[str, str]: # <<<<<<<<<<<<<< * """ library: version mapping. Always includes `libzim`""" * versions = zim.getVersions() */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_5get_versions(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6libzim_4get_versions[] = " library: version mapping. Always includes `libzim`"; static PyMethodDef __pyx_mdef_6libzim_5get_versions = {"get_versions", (PyCFunction)__pyx_pw_6libzim_5get_versions, METH_NOARGS, __pyx_doc_6libzim_4get_versions}; static PyObject *__pyx_pw_6libzim_5get_versions(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_versions (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_4get_versions(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_4get_versions(CYTHON_UNUSED PyObject *__pyx_self) { std::vector > __pyx_v_versions; PyObject *__pyx_8genexpr2__pyx_v_library = NULL; PyObject *__pyx_8genexpr2__pyx_v_version = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; std::vector > ::iterator __pyx_t_4; std::pair __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)(PyObject *); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_versions", 0); /* "libzim.pyx":1262 * def get_versions() -> OrderedDict[str, str]: * """ library: version mapping. Always includes `libzim`""" * versions = zim.getVersions() # <<<<<<<<<<<<<< * return OrderedDict({ * library.decode("UTF-8"): version.decode("UTF-8") */ __pyx_v_versions = zim::getVersions(); /* "libzim.pyx":1263 * """ library: version mapping. Always includes `libzim`""" * versions = zim.getVersions() * return OrderedDict({ # <<<<<<<<<<<<<< * library.decode("UTF-8"): version.decode("UTF-8") * for library, version in versions */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_OrderedDict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); { /* enter inner scope */ __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1263, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_3); /* "libzim.pyx":1265 * return OrderedDict({ * library.decode("UTF-8"): version.decode("UTF-8") * for library, version in versions # <<<<<<<<<<<<<< * }) * */ __pyx_t_4 = __pyx_v_versions.begin(); for (;;) { if (!(__pyx_t_4 != __pyx_v_versions.end())) break; __pyx_t_5 = *__pyx_t_4; ++__pyx_t_4; __pyx_t_6 = __pyx_convert_pair_to_py_std_3a__3a_string____std_3a__3a_string(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1265, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_6); if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { PyObject* sequence = __pyx_t_6; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 1265, __pyx_L5_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_7 = PyList_GET_ITEM(sequence, 0); __pyx_t_8 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(__pyx_t_8); #else __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1265, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1265, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_8); #endif __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else { Py_ssize_t index = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1265, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext; index = 0; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(__pyx_t_7); index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L8_unpacking_failed; __Pyx_GOTREF(__pyx_t_8); if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 2) < 0) __PYX_ERR(0, 1265, __pyx_L5_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L9_unpacking_done; __pyx_L8_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, 1265, __pyx_L5_error) __pyx_L9_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_library, __pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_version, __pyx_t_8); __pyx_t_8 = 0; /* "libzim.pyx":1264 * versions = zim.getVersions() * return OrderedDict({ * library.decode("UTF-8"): version.decode("UTF-8") # <<<<<<<<<<<<<< * for library, version in versions * }) */ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr2__pyx_v_library, __pyx_n_s_decode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1264, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_8); __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); } } __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_7, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_kp_u_UTF_8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1264, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr2__pyx_v_version, __pyx_n_s_decode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1264, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_9 = NULL; 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_8 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_kp_u_UTF_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_kp_u_UTF_8); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1264, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(PyDict_SetItem(__pyx_t_3, (PyObject*)__pyx_t_6, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 1264, __pyx_L5_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; /* "libzim.pyx":1265 * return OrderedDict({ * library.decode("UTF-8"): version.decode("UTF-8") * for library, version in versions # <<<<<<<<<<<<<< * }) * */ } __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_library); __pyx_8genexpr2__pyx_v_library = 0; __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_version); __pyx_8genexpr2__pyx_v_version = 0; goto __pyx_L10_exit_scope; __pyx_L5_error:; __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_library); __pyx_8genexpr2__pyx_v_library = 0; __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_version); __pyx_8genexpr2__pyx_v_version = 0; goto __pyx_L1_error; __pyx_L10_exit_scope:; } /* exit inner scope */ __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(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); } } __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_8, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1263, __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; /* "libzim.pyx":1260 * * * def get_versions() -> OrderedDict[str, str]: # <<<<<<<<<<<<<< * """ library: version mapping. Always includes `libzim`""" * versions = zim.getVersions() */ /* 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_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("libzim.get_versions", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_library); __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_version); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1268 * }) * * def get_libzim_version() -> str: # <<<<<<<<<<<<<< * """libzim version string""" * return get_versions()["libzim"] */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_7get_libzim_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_6libzim_6get_libzim_version[] = "libzim version string"; static PyMethodDef __pyx_mdef_6libzim_7get_libzim_version = {"get_libzim_version", (PyCFunction)__pyx_pw_6libzim_7get_libzim_version, METH_NOARGS, __pyx_doc_6libzim_6get_libzim_version}; static PyObject *__pyx_pw_6libzim_7get_libzim_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_libzim_version (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_6get_libzim_version(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_6get_libzim_version(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_libzim_version", 0); /* "libzim.pyx":1270 * def get_libzim_version() -> str: * """libzim version string""" * return get_versions()["libzim"] # <<<<<<<<<<<<<< * * version_public_objects = [ */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_get_versions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1270, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __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); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1270, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_libzim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1270, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 1270, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "libzim.pyx":1268 * }) * * def get_libzim_version() -> str: # <<<<<<<<<<<<<< * """libzim version string""" * return get_versions()["libzim"] */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("libzim.get_libzim_version", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1284 * # Create our module. Easy, just return the created module * @staticmethod * def create_module(spec): # <<<<<<<<<<<<<< * return { * 'libzim.writer': writer, */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_12ModuleLoader_1create_module(PyObject *__pyx_self, PyObject *__pyx_v_spec); /*proto*/ static PyMethodDef __pyx_mdef_6libzim_12ModuleLoader_1create_module = {"create_module", (PyCFunction)__pyx_pw_6libzim_12ModuleLoader_1create_module, METH_O, 0}; static PyObject *__pyx_pw_6libzim_12ModuleLoader_1create_module(PyObject *__pyx_self, PyObject *__pyx_v_spec) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("create_module (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_12ModuleLoader_create_module(__pyx_self, ((PyObject *)__pyx_v_spec)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_12ModuleLoader_create_module(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_spec) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("create_module", 0); /* "libzim.pyx":1285 * @staticmethod * def create_module(spec): * return { # <<<<<<<<<<<<<< * 'libzim.writer': writer, * 'libzim.reader': reader, */ __Pyx_XDECREF(__pyx_r); /* "libzim.pyx":1286 * def create_module(spec): * return { * 'libzim.writer': writer, # <<<<<<<<<<<<<< * 'libzim.reader': reader, * 'libzim.search': search, */ __pyx_t_1 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1286, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_writer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1286, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_libzim_writer, __pyx_t_2) < 0) __PYX_ERR(0, 1286, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":1287 * return { * 'libzim.writer': writer, * 'libzim.reader': reader, # <<<<<<<<<<<<<< * 'libzim.search': search, * 'libzim.suggestion': suggestion, */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_libzim_reader, __pyx_t_2) < 0) __PYX_ERR(0, 1286, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":1288 * 'libzim.writer': writer, * 'libzim.reader': reader, * 'libzim.search': search, # <<<<<<<<<<<<<< * 'libzim.suggestion': suggestion, * 'libzim.version': version */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_search); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_libzim_search, __pyx_t_2) < 0) __PYX_ERR(0, 1286, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":1289 * 'libzim.reader': reader, * 'libzim.search': search, * 'libzim.suggestion': suggestion, # <<<<<<<<<<<<<< * 'libzim.version': version * }.get(spec.name, None) */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_suggestion); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1289, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_libzim_suggestion, __pyx_t_2) < 0) __PYX_ERR(0, 1286, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":1290 * 'libzim.search': search, * 'libzim.suggestion': suggestion, * 'libzim.version': version # <<<<<<<<<<<<<< * }.get(spec.name, None) * */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_version); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_kp_u_libzim_version, __pyx_t_2) < 0) __PYX_ERR(0, 1286, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":1291 * 'libzim.suggestion': suggestion, * 'libzim.version': version * }.get(spec.name, None) # <<<<<<<<<<<<<< * * @staticmethod */ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_spec, __pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_t_1, __pyx_t_2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1291, __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; /* "libzim.pyx":1284 * # Create our module. Easy, just return the created module * @staticmethod * def create_module(spec): # <<<<<<<<<<<<<< * return { * 'libzim.writer': writer, */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("libzim.ModuleLoader.create_module", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1294 * * @staticmethod * def exec_module(module): # <<<<<<<<<<<<<< * # Nothing to execute for our already existing module. * # But we need to define exec_module to tell python not use the legacy import system. */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_12ModuleLoader_3exec_module(PyObject *__pyx_self, PyObject *__pyx_v_module); /*proto*/ static PyMethodDef __pyx_mdef_6libzim_12ModuleLoader_3exec_module = {"exec_module", (PyCFunction)__pyx_pw_6libzim_12ModuleLoader_3exec_module, METH_O, 0}; static PyObject *__pyx_pw_6libzim_12ModuleLoader_3exec_module(PyObject *__pyx_self, PyObject *__pyx_v_module) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("exec_module (wrapper)", 0); __pyx_r = __pyx_pf_6libzim_12ModuleLoader_2exec_module(__pyx_self, ((PyObject *)__pyx_v_module)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_12ModuleLoader_2exec_module(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_module) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("exec_module", 0); /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libzim.pyx":1300 * * class ModuleFinder(importlib.abc.MetaPathFinder): * def find_spec(self, fullname, path, target=None): # <<<<<<<<<<<<<< * if fullname.startswith("libzim."): * return importlib.machinery.ModuleSpec(fullname, ModuleLoader) */ /* Python wrapper */ static PyObject *__pyx_pw_6libzim_12ModuleFinder_1find_spec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_6libzim_12ModuleFinder_1find_spec = {"find_spec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6libzim_12ModuleFinder_1find_spec, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_6libzim_12ModuleFinder_1find_spec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED PyObject *__pyx_v_self = 0; PyObject *__pyx_v_fullname = 0; CYTHON_UNUSED PyObject *__pyx_v_path = 0; CYTHON_UNUSED PyObject *__pyx_v_target = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("find_spec (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_fullname,&__pyx_n_s_path,&__pyx_n_s_target,0}; PyObject* values[4] = {0,0,0,0}; values[3] = ((PyObject *)((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 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fullname)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("find_spec", 0, 3, 4, 1); __PYX_ERR(0, 1300, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("find_spec", 0, 3, 4, 2); __PYX_ERR(0, 1300, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_target); if (value) { values[3] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "find_spec") < 0)) __PYX_ERR(0, 1300, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 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; default: goto __pyx_L5_argtuple_error; } } __pyx_v_self = values[0]; __pyx_v_fullname = values[1]; __pyx_v_path = values[2]; __pyx_v_target = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("find_spec", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1300, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libzim.ModuleFinder.find_spec", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_6libzim_12ModuleFinder_find_spec(__pyx_self, __pyx_v_self, __pyx_v_fullname, __pyx_v_path, __pyx_v_target); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_6libzim_12ModuleFinder_find_spec(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_fullname, CYTHON_UNUSED PyObject *__pyx_v_path, CYTHON_UNUSED PyObject *__pyx_v_target) { 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; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("find_spec", 0); /* "libzim.pyx":1301 * class ModuleFinder(importlib.abc.MetaPathFinder): * def find_spec(self, fullname, path, target=None): * if fullname.startswith("libzim."): # <<<<<<<<<<<<<< * return importlib.machinery.ModuleSpec(fullname, ModuleLoader) * # This is not our problem, let import mechanism continue */ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_fullname, __pyx_n_s_startswith); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1301, __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); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_kp_u_libzim_2) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_libzim_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __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(0, 1301, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_4) { /* "libzim.pyx":1302 * def find_spec(self, fullname, path, target=None): * if fullname.startswith("libzim."): * return importlib.machinery.ModuleSpec(fullname, ModuleLoader) # <<<<<<<<<<<<<< * # This is not our problem, let import mechanism continue * return None */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_importlib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_machinery); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ModuleSpec); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ModuleLoader); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __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_v_fullname, __pyx_t_3}; __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(0, 1302, __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; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_fullname, __pyx_t_3}; __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(0, 1302, __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; } else #endif { __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1302, __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_v_fullname); __Pyx_GIVEREF(__pyx_v_fullname); PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_fullname); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1302, __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; /* "libzim.pyx":1301 * class ModuleFinder(importlib.abc.MetaPathFinder): * def find_spec(self, fullname, path, target=None): * if fullname.startswith("libzim."): # <<<<<<<<<<<<<< * return importlib.machinery.ModuleSpec(fullname, ModuleLoader) * # This is not our problem, let import mechanism continue */ } /* "libzim.pyx":1304 * return importlib.machinery.ModuleSpec(fullname, ModuleLoader) * # This is not our problem, let import mechanism continue * return None # <<<<<<<<<<<<<< * * # register finder for our submodules */ __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; /* "libzim.pyx":1300 * * class ModuleFinder(importlib.abc.MetaPathFinder): * def find_spec(self, fullname, path, target=None): # <<<<<<<<<<<<<< * if fullname.startswith("libzim."): * return importlib.machinery.ModuleSpec(fullname, ModuleLoader) */ /* 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_7); __Pyx_AddTraceback("libzim.ModuleFinder.find_spec", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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(const 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(1, 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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(const 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(1, 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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(const 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(1, 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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(const 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(1, 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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(1, 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; } /* "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 = 0 * cdef const 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 const *__pyx_v_data; std::string __pyx_r; __Pyx_RefNannyDeclarations char const *__pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_std__in_string", 0); /* "string.from_py":14 * @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 = 0 # <<<<<<<<<<<<<< * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) * return string(data, length) */ __pyx_v_length = 0; /* "string.from_py":15 * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: * cdef Py_ssize_t length = 0 * cdef const 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 == ((char const *)NULL))) __PYX_ERR(1, 15, __pyx_L1_error) __pyx_v_data = __pyx_t_1; /* "string.from_py":16 * cdef Py_ssize_t length = 0 * cdef const 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 = 0 * cdef const 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_pretend_to_initialize(&__pyx_r); __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "set.to_py":129 * * @cname("__pyx_convert_set_to_py_unsigned_int") * cdef object __pyx_convert_set_to_py_unsigned_int(const cpp_set[X]& s): # <<<<<<<<<<<<<< * o = set() * cdef cpp_set[X].const_iterator iter = s.begin() */ static PyObject *__pyx_convert_set_to_py_unsigned_int(std::set const &__pyx_v_s) { PyObject *__pyx_v_o = NULL; std::set ::const_iterator __pyx_v_iter; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_convert_set_to_py_unsigned_int", 0); /* "set.to_py":130 * @cname("__pyx_convert_set_to_py_unsigned_int") * cdef object __pyx_convert_set_to_py_unsigned_int(const cpp_set[X]& s): * o = set() # <<<<<<<<<<<<<< * cdef cpp_set[X].const_iterator iter = s.begin() * while iter != s.end(): */ __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_o = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "set.to_py":131 * cdef object __pyx_convert_set_to_py_unsigned_int(const cpp_set[X]& s): * o = set() * cdef cpp_set[X].const_iterator iter = s.begin() # <<<<<<<<<<<<<< * while iter != s.end(): * o.add(cython.operator.dereference(iter)) */ __pyx_v_iter = __pyx_v_s.begin(); /* "set.to_py":132 * o = set() * cdef cpp_set[X].const_iterator iter = s.begin() * while iter != s.end(): # <<<<<<<<<<<<<< * o.add(cython.operator.dereference(iter)) * cython.operator.preincrement(iter) */ while (1) { __pyx_t_2 = ((__pyx_v_iter != __pyx_v_s.end()) != 0); if (!__pyx_t_2) break; /* "set.to_py":133 * cdef cpp_set[X].const_iterator iter = s.begin() * while iter != s.end(): * o.add(cython.operator.dereference(iter)) # <<<<<<<<<<<<<< * cython.operator.preincrement(iter) * return o */ __pyx_t_1 = __Pyx_PyInt_From_unsigned_int((*__pyx_v_iter)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 133, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PySet_Add(__pyx_v_o, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 133, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "set.to_py":134 * while iter != s.end(): * o.add(cython.operator.dereference(iter)) * cython.operator.preincrement(iter) # <<<<<<<<<<<<<< * return o * */ (void)((++__pyx_v_iter)); } /* "set.to_py":135 * o.add(cython.operator.dereference(iter)) * cython.operator.preincrement(iter) * return o # <<<<<<<<<<<<<< * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_o); __pyx_r = __pyx_v_o; goto __pyx_L0; /* "set.to_py":129 * * @cname("__pyx_convert_set_to_py_unsigned_int") * cdef object __pyx_convert_set_to_py_unsigned_int(const cpp_set[X]& s): # <<<<<<<<<<<<<< * o = set() * cdef cpp_set[X].const_iterator iter = s.begin() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("set.to_py.__pyx_convert_set_to_py_unsigned_int", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_o); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "pair.to_py":158 * * @cname("__pyx_convert_pair_to_py_std_3a__3a_string____std_3a__3a_string") * cdef object __pyx_convert_pair_to_py_std_3a__3a_string____std_3a__3a_string(const pair[X,Y]& p): # <<<<<<<<<<<<<< * return p.first, p.second * */ static PyObject *__pyx_convert_pair_to_py_std_3a__3a_string____std_3a__3a_string(std::pair const &__pyx_v_p) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_convert_pair_to_py_std_3a__3a_string____std_3a__3a_string", 0); /* "pair.to_py":159 * @cname("__pyx_convert_pair_to_py_std_3a__3a_string____std_3a__3a_string") * cdef object __pyx_convert_pair_to_py_std_3a__3a_string____std_3a__3a_string(const pair[X,Y]& p): * return p.first, p.second # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_p.first); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_p.second); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 159, __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_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; /* "pair.to_py":158 * * @cname("__pyx_convert_pair_to_py_std_3a__3a_string____std_3a__3a_string") * cdef object __pyx_convert_pair_to_py_std_3a__3a_string____std_3a__3a_string(const pair[X,Y]& p): # <<<<<<<<<<<<<< * return p.first, p.second * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("pair.to_py.__pyx_convert_pair_to_py_std_3a__3a_string____std_3a__3a_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_6libzim_WritingBlob(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_6libzim_WritingBlob *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_6libzim_WritingBlob *)o); new((void*)&(p->c_blob)) wrapper::Blob(); p->ref_content = ((PyObject*)Py_None); Py_INCREF(Py_None); if (unlikely(__pyx_pw_6libzim_11WritingBlob_1__cinit__(o, a, k) < 0)) goto bad; return o; bad: Py_DECREF(o); o = 0; return NULL; } static void __pyx_tp_dealloc_6libzim_WritingBlob(PyObject *o) { struct __pyx_obj_6libzim_WritingBlob *p = (struct __pyx_obj_6libzim_WritingBlob *)o; #if CYTHON_USE_TP_FINALIZE if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif __Pyx_call_destructor(p->c_blob); Py_CLEAR(p->ref_content); (*Py_TYPE(o)->tp_free)(o); } static PyMethodDef __pyx_methods_6libzim_WritingBlob[] = { {"size", (PyCFunction)__pyx_pw_6libzim_11WritingBlob_3size, METH_NOARGS, 0}, {"__reduce_cython__", (PyCFunction)__pyx_pw_6libzim_11WritingBlob_5__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw_6libzim_11WritingBlob_7__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; static PyTypeObject __pyx_type_6libzim_WritingBlob = { PyVarObject_HEAD_INIT(0, 0) "libzim.WritingBlob", /*tp_name*/ sizeof(struct __pyx_obj_6libzim_WritingBlob), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6libzim_WritingBlob, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030800b4 0, /*tp_vectorcall_offset*/ #endif 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_6libzim_WritingBlob, /*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_6libzim_WritingBlob, /*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 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 0, /*tp_pypy_flags*/ #endif }; static PyObject *__pyx_tp_new_6libzim__Creator(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_6libzim__Creator *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_6libzim__Creator *)o); new((void*)&(p->c_creator)) zim::writer::Creator(); p->_filename = Py_None; Py_INCREF(Py_None); p->_started = Py_None; Py_INCREF(Py_None); if (unlikely(__pyx_pw_6libzim_8_Creator_1__cinit__(o, a, k) < 0)) goto bad; return o; bad: Py_DECREF(o); o = 0; return NULL; } static void __pyx_tp_dealloc_6libzim__Creator(PyObject *o) { struct __pyx_obj_6libzim__Creator *p = (struct __pyx_obj_6libzim__Creator *)o; #if CYTHON_USE_TP_FINALIZE if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif PyObject_GC_UnTrack(o); __Pyx_call_destructor(p->c_creator); Py_CLEAR(p->_filename); Py_CLEAR(p->_started); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_6libzim__Creator(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_6libzim__Creator *p = (struct __pyx_obj_6libzim__Creator *)o; if (p->_filename) { e = (*v)(p->_filename, a); if (e) return e; } if (p->_started) { e = (*v)(p->_started, a); if (e) return e; } return 0; } static int __pyx_tp_clear_6libzim__Creator(PyObject *o) { PyObject* tmp; struct __pyx_obj_6libzim__Creator *p = (struct __pyx_obj_6libzim__Creator *)o; tmp = ((PyObject*)p->_filename); p->_filename = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->_started); p->_started = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyObject *__pyx_getprop_6libzim_8_Creator_filename(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_8_Creator_8filename_1__get__(o); } static PyMethodDef __pyx_methods_6libzim__Creator[] = { {"config_verbose", (PyCFunction)__pyx_pw_6libzim_8_Creator_5config_verbose, METH_O, __pyx_doc_6libzim_8_Creator_4config_verbose}, {"config_compression", (PyCFunction)__pyx_pw_6libzim_8_Creator_7config_compression, METH_O, __pyx_doc_6libzim_8_Creator_6config_compression}, {"config_clustersize", (PyCFunction)__pyx_pw_6libzim_8_Creator_9config_clustersize, METH_O, __pyx_doc_6libzim_8_Creator_8config_clustersize}, {"config_indexing", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6libzim_8_Creator_11config_indexing, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6libzim_8_Creator_10config_indexing}, {"config_nbworkers", (PyCFunction)__pyx_pw_6libzim_8_Creator_13config_nbworkers, METH_O, __pyx_doc_6libzim_8_Creator_12config_nbworkers}, {"set_mainpath", (PyCFunction)__pyx_pw_6libzim_8_Creator_15set_mainpath, METH_O, __pyx_doc_6libzim_8_Creator_14set_mainpath}, {"add_illustration", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6libzim_8_Creator_17add_illustration, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6libzim_8_Creator_16add_illustration}, {"add_item", (PyCFunction)__pyx_pw_6libzim_8_Creator_19add_item, METH_O, __pyx_doc_6libzim_8_Creator_18add_item}, {"add_metadata", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6libzim_8_Creator_21add_metadata, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6libzim_8_Creator_20add_metadata}, {"add_redirection", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6libzim_8_Creator_23add_redirection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6libzim_8_Creator_22add_redirection}, {"__enter__", (PyCFunction)__pyx_pw_6libzim_8_Creator_25__enter__, METH_NOARGS, 0}, {"__exit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6libzim_8_Creator_27__exit__, METH_VARARGS|METH_KEYWORDS, 0}, {"__reduce_cython__", (PyCFunction)__pyx_pw_6libzim_8_Creator_29__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw_6libzim_8_Creator_31__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; static struct PyGetSetDef __pyx_getsets_6libzim__Creator[] = { {(char *)"filename", __pyx_getprop_6libzim_8_Creator_filename, 0, (char *)0, 0}, {0, 0, 0, 0, 0} }; static PyTypeObject __pyx_type_6libzim__Creator = { PyVarObject_HEAD_INIT(0, 0) "libzim._Creator", /*tp_name*/ sizeof(struct __pyx_obj_6libzim__Creator), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6libzim__Creator, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030800b4 0, /*tp_vectorcall_offset*/ #endif 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*/ "ZIM Creator\n\n Attributes\n ----------\n *c_creator : zim.ZimCreator\n a pointer to the C++ Creator object\n _filename: pathlib.Path\n path to create the ZIM file at\n _started : bool\n flag if the creator has started", /*tp_doc*/ __pyx_tp_traverse_6libzim__Creator, /*tp_traverse*/ __pyx_tp_clear_6libzim__Creator, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_6libzim__Creator, /*tp_methods*/ 0, /*tp_members*/ __pyx_getsets_6libzim__Creator, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pw_6libzim_8_Creator_3__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_6libzim__Creator, /*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 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 0, /*tp_pypy_flags*/ #endif }; static struct __pyx_vtabstruct_6libzim_ReadingBlob __pyx_vtable_6libzim_ReadingBlob; static PyObject *__pyx_tp_new_6libzim_ReadingBlob(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_6libzim_ReadingBlob *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_6libzim_ReadingBlob *)o); p->__pyx_vtab = __pyx_vtabptr_6libzim_ReadingBlob; new((void*)&(p->c_blob)) wrapper::Blob(); return o; } static void __pyx_tp_dealloc_6libzim_ReadingBlob(PyObject *o) { struct __pyx_obj_6libzim_ReadingBlob *p = (struct __pyx_obj_6libzim_ReadingBlob *)o; #if CYTHON_USE_TP_FINALIZE if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && 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); __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); __pyx_pw_6libzim_11ReadingBlob_1__dealloc__(o); __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } __Pyx_call_destructor(p->c_blob); (*Py_TYPE(o)->tp_free)(o); } static PyMethodDef __pyx_methods_6libzim_ReadingBlob[] = { {"__reduce_cython__", (PyCFunction)__pyx_pw_6libzim_11ReadingBlob_7__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw_6libzim_11ReadingBlob_9__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; static PyBufferProcs __pyx_tp_as_buffer_ReadingBlob = { #if PY_MAJOR_VERSION < 3 0, /*bf_getreadbuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getwritebuffer*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getsegcount*/ #endif #if PY_MAJOR_VERSION < 3 0, /*bf_getcharbuffer*/ #endif __pyx_pw_6libzim_11ReadingBlob_3__getbuffer__, /*bf_getbuffer*/ __pyx_pw_6libzim_11ReadingBlob_5__releasebuffer__, /*bf_releasebuffer*/ }; static PyTypeObject __pyx_type_6libzim_ReadingBlob = { PyVarObject_HEAD_INIT(0, 0) "libzim.ReadingBlob", /*tp_name*/ sizeof(struct __pyx_obj_6libzim_ReadingBlob), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6libzim_ReadingBlob, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030800b4 0, /*tp_vectorcall_offset*/ #endif 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*/ &__pyx_tp_as_buffer_ReadingBlob, /*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_6libzim_ReadingBlob, /*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_6libzim_ReadingBlob, /*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 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 0, /*tp_pypy_flags*/ #endif }; static struct __pyx_vtabstruct_6libzim_Entry __pyx_vtable_6libzim_Entry; static PyObject *__pyx_tp_new_6libzim_Entry(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_6libzim_Entry *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_6libzim_Entry *)o); p->__pyx_vtab = __pyx_vtabptr_6libzim_Entry; new((void*)&(p->c_entry)) wrapper::Entry(); return o; } static void __pyx_tp_dealloc_6libzim_Entry(PyObject *o) { struct __pyx_obj_6libzim_Entry *p = (struct __pyx_obj_6libzim_Entry *)o; #if CYTHON_USE_TP_FINALIZE if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif __Pyx_call_destructor(p->c_entry); (*Py_TYPE(o)->tp_free)(o); } static PyObject *__pyx_getprop_6libzim_5Entry_title(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_5Entry_5title_1__get__(o); } static PyObject *__pyx_getprop_6libzim_5Entry_path(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_5Entry_4path_1__get__(o); } static PyObject *__pyx_getprop_6libzim_5Entry__index(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_5Entry_6_index_1__get__(o); } static PyObject *__pyx_getprop_6libzim_5Entry_is_redirect(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_5Entry_11is_redirect_1__get__(o); } static PyMethodDef __pyx_methods_6libzim_Entry[] = { {"get_redirect_entry", (PyCFunction)__pyx_pw_6libzim_5Entry_1get_redirect_entry, METH_NOARGS, __pyx_doc_6libzim_5Entry_get_redirect_entry}, {"get_item", (PyCFunction)__pyx_pw_6libzim_5Entry_3get_item, METH_NOARGS, 0}, {"__reduce_cython__", (PyCFunction)__pyx_pw_6libzim_5Entry_7__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw_6libzim_5Entry_9__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; static struct PyGetSetDef __pyx_getsets_6libzim_Entry[] = { {(char *)"title", __pyx_getprop_6libzim_5Entry_title, 0, (char *)0, 0}, {(char *)"path", __pyx_getprop_6libzim_5Entry_path, 0, (char *)0, 0}, {(char *)"_index", __pyx_getprop_6libzim_5Entry__index, 0, (char *)"Internal index in Archive", 0}, {(char *)"is_redirect", __pyx_getprop_6libzim_5Entry_is_redirect, 0, (char *)"Whether entry is a redirect", 0}, {0, 0, 0, 0, 0} }; static PyTypeObject __pyx_type_6libzim_Entry = { PyVarObject_HEAD_INIT(0, 0) "libzim.Entry", /*tp_name*/ sizeof(struct __pyx_obj_6libzim_Entry), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6libzim_Entry, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030800b4 0, /*tp_vectorcall_offset*/ #endif 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 __pyx_pw_6libzim_5Entry_5__repr__, /*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*/ "Entry in a ZIM archive\n\n Attributes\n ----------\n *c_entry : Entry (zim::)\n a pointer to the C++ entry object", /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_6libzim_Entry, /*tp_methods*/ 0, /*tp_members*/ __pyx_getsets_6libzim_Entry, /*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_6libzim_Entry, /*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 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 0, /*tp_pypy_flags*/ #endif }; static struct __pyx_vtabstruct_6libzim_Item __pyx_vtable_6libzim_Item; static PyObject *__pyx_tp_new_6libzim_Item(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_6libzim_Item *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_6libzim_Item *)o); p->__pyx_vtab = __pyx_vtabptr_6libzim_Item; new((void*)&(p->c_item)) wrapper::Item(); p->_blob = ((struct __pyx_obj_6libzim_ReadingBlob *)Py_None); Py_INCREF(Py_None); return o; } static void __pyx_tp_dealloc_6libzim_Item(PyObject *o) { struct __pyx_obj_6libzim_Item *p = (struct __pyx_obj_6libzim_Item *)o; #if CYTHON_USE_TP_FINALIZE if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif PyObject_GC_UnTrack(o); __Pyx_call_destructor(p->c_item); Py_CLEAR(p->_blob); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_6libzim_Item(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_6libzim_Item *p = (struct __pyx_obj_6libzim_Item *)o; if (p->_blob) { e = (*v)(((PyObject *)p->_blob), a); if (e) return e; } return 0; } static int __pyx_tp_clear_6libzim_Item(PyObject *o) { PyObject* tmp; struct __pyx_obj_6libzim_Item *p = (struct __pyx_obj_6libzim_Item *)o; tmp = ((PyObject*)p->_blob); p->_blob = ((struct __pyx_obj_6libzim_ReadingBlob *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyObject *__pyx_getprop_6libzim_4Item_title(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_4Item_5title_1__get__(o); } static PyObject *__pyx_getprop_6libzim_4Item_path(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_4Item_4path_1__get__(o); } static PyObject *__pyx_getprop_6libzim_4Item_content(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_4Item_7content_1__get__(o); } static PyObject *__pyx_getprop_6libzim_4Item_mimetype(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_4Item_8mimetype_1__get__(o); } static PyObject *__pyx_getprop_6libzim_4Item__index(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_4Item_6_index_1__get__(o); } static PyObject *__pyx_getprop_6libzim_4Item_size(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_4Item_4size_1__get__(o); } static PyMethodDef __pyx_methods_6libzim_Item[] = { {"__reduce_cython__", (PyCFunction)__pyx_pw_6libzim_4Item_3__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw_6libzim_4Item_5__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; static struct PyGetSetDef __pyx_getsets_6libzim_Item[] = { {(char *)"title", __pyx_getprop_6libzim_4Item_title, 0, (char *)0, 0}, {(char *)"path", __pyx_getprop_6libzim_4Item_path, 0, (char *)0, 0}, {(char *)"content", __pyx_getprop_6libzim_4Item_content, 0, (char *)0, 0}, {(char *)"mimetype", __pyx_getprop_6libzim_4Item_mimetype, 0, (char *)0, 0}, {(char *)"_index", __pyx_getprop_6libzim_4Item__index, 0, (char *)"Internal index in Archive", 0}, {(char *)"size", __pyx_getprop_6libzim_4Item_size, 0, (char *)0, 0}, {0, 0, 0, 0, 0} }; static PyTypeObject __pyx_type_6libzim_Item = { PyVarObject_HEAD_INIT(0, 0) "libzim.Item", /*tp_name*/ sizeof(struct __pyx_obj_6libzim_Item), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6libzim_Item, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030800b4 0, /*tp_vectorcall_offset*/ #endif 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 __pyx_pw_6libzim_4Item_1__repr__, /*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*/ "Item in a ZIM archive\n\n Attributes\n ----------\n *c_entry : Entry (zim::)\n a pointer to the C++ entry object", /*tp_doc*/ __pyx_tp_traverse_6libzim_Item, /*tp_traverse*/ __pyx_tp_clear_6libzim_Item, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_6libzim_Item, /*tp_methods*/ 0, /*tp_members*/ __pyx_getsets_6libzim_Item, /*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_6libzim_Item, /*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 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 0, /*tp_pypy_flags*/ #endif }; static PyObject *__pyx_tp_new_6libzim_Archive(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_6libzim_Archive *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_6libzim_Archive *)o); new((void*)&(p->c_archive)) wrapper::Archive(); p->_filename = Py_None; Py_INCREF(Py_None); if (unlikely(__pyx_pw_6libzim_7Archive_1__cinit__(o, a, k) < 0)) goto bad; return o; bad: Py_DECREF(o); o = 0; return NULL; } static void __pyx_tp_dealloc_6libzim_Archive(PyObject *o) { struct __pyx_obj_6libzim_Archive *p = (struct __pyx_obj_6libzim_Archive *)o; #if CYTHON_USE_TP_FINALIZE if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif PyObject_GC_UnTrack(o); __Pyx_call_destructor(p->c_archive); Py_CLEAR(p->_filename); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_6libzim_Archive(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_6libzim_Archive *p = (struct __pyx_obj_6libzim_Archive *)o; if (p->_filename) { e = (*v)(p->_filename, a); if (e) return e; } return 0; } static int __pyx_tp_clear_6libzim_Archive(PyObject *o) { PyObject* tmp; struct __pyx_obj_6libzim_Archive *p = (struct __pyx_obj_6libzim_Archive *)o; tmp = ((PyObject*)p->_filename); p->_filename = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyObject *__pyx_tp_richcompare_6libzim_Archive(PyObject *o1, PyObject *o2, int op) { switch (op) { case Py_EQ: { return __pyx_pw_6libzim_7Archive_3__eq__(o1, o2); } case Py_NE: { PyObject *ret; ret = __pyx_pw_6libzim_7Archive_3__eq__(o1, o2); if (likely(ret && ret != Py_NotImplemented)) { int b = __Pyx_PyObject_IsTrue(ret); Py_DECREF(ret); if (unlikely(b < 0)) return NULL; ret = (b) ? Py_False : Py_True; Py_INCREF(ret); } return ret; } default: { return __Pyx_NewRef(Py_NotImplemented); } } } static PyObject *__pyx_getprop_6libzim_7Archive_filename(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_7Archive_8filename_1__get__(o); } static PyObject *__pyx_getprop_6libzim_7Archive_filesize(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_7Archive_8filesize_1__get__(o); } static PyObject *__pyx_getprop_6libzim_7Archive_metadata_keys(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_7Archive_13metadata_keys_1__get__(o); } static PyObject *__pyx_getprop_6libzim_7Archive_has_main_entry(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_7Archive_14has_main_entry_1__get__(o); } static PyObject *__pyx_getprop_6libzim_7Archive_main_entry(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_7Archive_10main_entry_1__get__(o); } static PyObject *__pyx_getprop_6libzim_7Archive_uuid(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_7Archive_4uuid_1__get__(o); } static PyObject *__pyx_getprop_6libzim_7Archive_has_new_namespace_scheme(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_7Archive_24has_new_namespace_scheme_1__get__(o); } static PyObject *__pyx_getprop_6libzim_7Archive_is_multipart(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_7Archive_12is_multipart_1__get__(o); } static PyObject *__pyx_getprop_6libzim_7Archive_has_fulltext_index(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_7Archive_18has_fulltext_index_1__get__(o); } static PyObject *__pyx_getprop_6libzim_7Archive_has_title_index(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_7Archive_15has_title_index_1__get__(o); } static PyObject *__pyx_getprop_6libzim_7Archive_has_checksum(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_7Archive_12has_checksum_1__get__(o); } static PyObject *__pyx_getprop_6libzim_7Archive_checksum(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_7Archive_8checksum_1__get__(o); } static PyObject *__pyx_getprop_6libzim_7Archive_entry_count(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_7Archive_11entry_count_1__get__(o); } static PyObject *__pyx_getprop_6libzim_7Archive_all_entry_count(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_7Archive_15all_entry_count_1__get__(o); } static PyObject *__pyx_getprop_6libzim_7Archive_article_count(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_7Archive_13article_count_1__get__(o); } static PyObject *__pyx_getprop_6libzim_7Archive_media_count(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_6libzim_7Archive_11media_count_1__get__(o); } static PyMethodDef __pyx_methods_6libzim_Archive[] = { {"has_entry_by_path", (PyCFunction)__pyx_pw_6libzim_7Archive_5has_entry_by_path, METH_O, __pyx_doc_6libzim_7Archive_4has_entry_by_path}, {"get_entry_by_path", (PyCFunction)__pyx_pw_6libzim_7Archive_7get_entry_by_path, METH_O, __pyx_doc_6libzim_7Archive_6get_entry_by_path}, {"has_entry_by_title", (PyCFunction)__pyx_pw_6libzim_7Archive_9has_entry_by_title, METH_O, __pyx_doc_6libzim_7Archive_8has_entry_by_title}, {"get_entry_by_title", (PyCFunction)__pyx_pw_6libzim_7Archive_11get_entry_by_title, METH_O, __pyx_doc_6libzim_7Archive_10get_entry_by_title}, {"get_metadata_item", (PyCFunction)__pyx_pw_6libzim_7Archive_13get_metadata_item, METH_O, __pyx_doc_6libzim_7Archive_12get_metadata_item}, {"get_metadata", (PyCFunction)__pyx_pw_6libzim_7Archive_15get_metadata, METH_O, __pyx_doc_6libzim_7Archive_14get_metadata}, {"_get_entry_by_id", (PyCFunction)__pyx_pw_6libzim_7Archive_17_get_entry_by_id, METH_O, __pyx_doc_6libzim_7Archive_16_get_entry_by_id}, {"check", (PyCFunction)__pyx_pw_6libzim_7Archive_19check, METH_NOARGS, __pyx_doc_6libzim_7Archive_18check}, {"get_illustration_sizes", (PyCFunction)__pyx_pw_6libzim_7Archive_21get_illustration_sizes, METH_NOARGS, __pyx_doc_6libzim_7Archive_20get_illustration_sizes}, {"has_illustration", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6libzim_7Archive_23has_illustration, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6libzim_7Archive_22has_illustration}, {"get_illustration_item", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6libzim_7Archive_25get_illustration_item, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6libzim_7Archive_24get_illustration_item}, {"__reduce_cython__", (PyCFunction)__pyx_pw_6libzim_7Archive_29__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw_6libzim_7Archive_31__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; static struct PyGetSetDef __pyx_getsets_6libzim_Archive[] = { {(char *)"filename", __pyx_getprop_6libzim_7Archive_filename, 0, (char *)0, 0}, {(char *)"filesize", __pyx_getprop_6libzim_7Archive_filesize, 0, (char *)"Total size of ZIM file (or files if split", 0}, {(char *)"metadata_keys", __pyx_getprop_6libzim_7Archive_metadata_keys, 0, (char *)"List of Metadata keys present in this archive", 0}, {(char *)"has_main_entry", __pyx_getprop_6libzim_7Archive_has_main_entry, 0, (char *)"Whether Archive has a Main Entry set", 0}, {(char *)"main_entry", __pyx_getprop_6libzim_7Archive_main_entry, 0, (char *)"Main Entry of the Archive", 0}, {(char *)"uuid", __pyx_getprop_6libzim_7Archive_uuid, 0, (char *)"Archive UUID", 0}, {(char *)"has_new_namespace_scheme", __pyx_getprop_6libzim_7Archive_has_new_namespace_scheme, 0, (char *)"Whether Archive is using new \342\200\234namespaceless\342\200\235 namespace scheme", 0}, {(char *)"is_multipart", __pyx_getprop_6libzim_7Archive_is_multipart, 0, (char *)"Whether Archive is multipart (split over multiple files)", 0}, {(char *)"has_fulltext_index", __pyx_getprop_6libzim_7Archive_has_fulltext_index, 0, (char *)"Whether Archive includes a full-text index", 0}, {(char *)"has_title_index", __pyx_getprop_6libzim_7Archive_has_title_index, 0, (char *)"Whether Archive includes a Title index", 0}, {(char *)"has_checksum", __pyx_getprop_6libzim_7Archive_has_checksum, 0, (char *)"Whether Archive includes a checksum of its content", 0}, {(char *)"checksum", __pyx_getprop_6libzim_7Archive_checksum, 0, (char *)"Archive's checksum", 0}, {(char *)"entry_count", __pyx_getprop_6libzim_7Archive_entry_count, 0, (char *)"Number of user entries in Archive\n\n If Archive doesn't support \342\200\234user entries\342\200\235\n then this returns `all_entry_count`", 0}, {(char *)"all_entry_count", __pyx_getprop_6libzim_7Archive_all_entry_count, 0, (char *)"Number of entries in Archive.\n\n Total number of entries in the archive, including internal entries\n created by libzim itself, metadata, indexes, etc.", 0}, {(char *)"article_count", __pyx_getprop_6libzim_7Archive_article_count, 0, (char *)"Number of \342\200\234articles\342\200\235 in the Archive\n\n If Archive has_new_namespace_scheme then this is the\n number of Entry with \342\200\234FRONT_ARTICLE\342\200\235 Hint.\n\n Otherwise, this is the number or entries in \342\200\234A\342\200\235 namespace.\n\n Note: a few ZIM created during transition might have new scheme but no\n listing, resulting in this returning all entries.", 0}, {(char *)"media_count", __pyx_getprop_6libzim_7Archive_media_count, 0, (char *)"Number of media in the Archive\n\n This definition of \"media\" is based on the mimetype.", 0}, {0, 0, 0, 0, 0} }; static PyTypeObject __pyx_type_6libzim_Archive = { PyVarObject_HEAD_INIT(0, 0) "libzim.Archive", /*tp_name*/ sizeof(struct __pyx_obj_6libzim_Archive), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6libzim_Archive, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030800b4 0, /*tp_vectorcall_offset*/ #endif 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 __pyx_pw_6libzim_7Archive_27__repr__, /*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*/ "ZIM Archive Reader\n\n Attributes\n ----------\n *c_archive : Archive\n a pointer to a C++ Archive object\n _filename : pathlib.Path\n the file name of the Archive Reader object", /*tp_doc*/ __pyx_tp_traverse_6libzim_Archive, /*tp_traverse*/ __pyx_tp_clear_6libzim_Archive, /*tp_clear*/ __pyx_tp_richcompare_6libzim_Archive, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_6libzim_Archive, /*tp_methods*/ 0, /*tp_members*/ __pyx_getsets_6libzim_Archive, /*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_6libzim_Archive, /*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 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 0, /*tp_pypy_flags*/ #endif }; static PyObject *__pyx_tp_new_6libzim_Query(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_6libzim_Query *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_6libzim_Query *)o); new((void*)&(p->c_query)) zim::Query(); return o; } static void __pyx_tp_dealloc_6libzim_Query(PyObject *o) { struct __pyx_obj_6libzim_Query *p = (struct __pyx_obj_6libzim_Query *)o; #if CYTHON_USE_TP_FINALIZE if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif __Pyx_call_destructor(p->c_query); (*Py_TYPE(o)->tp_free)(o); } static PyMethodDef __pyx_methods_6libzim_Query[] = { {"set_query", (PyCFunction)__pyx_pw_6libzim_5Query_1set_query, METH_O, 0}, {"__reduce_cython__", (PyCFunction)__pyx_pw_6libzim_5Query_3__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw_6libzim_5Query_5__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; static PyTypeObject __pyx_type_6libzim_Query = { PyVarObject_HEAD_INIT(0, 0) "libzim.Query", /*tp_name*/ sizeof(struct __pyx_obj_6libzim_Query), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6libzim_Query, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030800b4 0, /*tp_vectorcall_offset*/ #endif 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*/ "ZIM agnostic Query-builder to use with a Searcher", /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_6libzim_Query, /*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_6libzim_Query, /*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 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 0, /*tp_pypy_flags*/ #endif }; static struct __pyx_vtabstruct_6libzim_SearchResultSet __pyx_vtable_6libzim_SearchResultSet; static PyObject *__pyx_tp_new_6libzim_SearchResultSet(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_6libzim_SearchResultSet *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_6libzim_SearchResultSet *)o); p->__pyx_vtab = __pyx_vtabptr_6libzim_SearchResultSet; new((void*)&(p->c_resultset)) wrapper::SearchResultSet(); return o; } static void __pyx_tp_dealloc_6libzim_SearchResultSet(PyObject *o) { struct __pyx_obj_6libzim_SearchResultSet *p = (struct __pyx_obj_6libzim_SearchResultSet *)o; #if CYTHON_USE_TP_FINALIZE if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif __Pyx_call_destructor(p->c_resultset); (*Py_TYPE(o)->tp_free)(o); } static PyMethodDef __pyx_methods_6libzim_SearchResultSet[] = { {"__reduce_cython__", (PyCFunction)__pyx_pw_6libzim_15SearchResultSet_4__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw_6libzim_15SearchResultSet_6__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; static PyTypeObject __pyx_type_6libzim_SearchResultSet = { PyVarObject_HEAD_INIT(0, 0) "libzim.SearchResultSet", /*tp_name*/ sizeof(struct __pyx_obj_6libzim_SearchResultSet), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6libzim_SearchResultSet, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030800b4 0, /*tp_vectorcall_offset*/ #endif 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*/ "Iterator over a Search result: entry paths", /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ __pyx_pw_6libzim_15SearchResultSet_1__iter__, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_6libzim_SearchResultSet, /*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_6libzim_SearchResultSet, /*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 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 0, /*tp_pypy_flags*/ #endif }; static struct __pyx_vtabstruct_6libzim_Search __pyx_vtable_6libzim_Search; static PyObject *__pyx_tp_new_6libzim_Search(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_6libzim_Search *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_6libzim_Search *)o); p->__pyx_vtab = __pyx_vtabptr_6libzim_Search; new((void*)&(p->c_search)) wrapper::Search(); return o; } static void __pyx_tp_dealloc_6libzim_Search(PyObject *o) { struct __pyx_obj_6libzim_Search *p = (struct __pyx_obj_6libzim_Search *)o; #if CYTHON_USE_TP_FINALIZE if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif __Pyx_call_destructor(p->c_search); (*Py_TYPE(o)->tp_free)(o); } static PyMethodDef __pyx_methods_6libzim_Search[] = { {"getEstimatedMatches", (PyCFunction)__pyx_pw_6libzim_6Search_1getEstimatedMatches, METH_NOARGS, __pyx_doc_6libzim_6Search_getEstimatedMatches}, {"getResults", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6libzim_6Search_3getResults, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6libzim_6Search_2getResults}, {"__reduce_cython__", (PyCFunction)__pyx_pw_6libzim_6Search_5__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw_6libzim_6Search_7__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; static PyTypeObject __pyx_type_6libzim_Search = { PyVarObject_HEAD_INIT(0, 0) "libzim.Search", /*tp_name*/ sizeof(struct __pyx_obj_6libzim_Search), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6libzim_Search, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030800b4 0, /*tp_vectorcall_offset*/ #endif 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*/ "Search request over a ZIM Archive", /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_6libzim_Search, /*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_6libzim_Search, /*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 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 0, /*tp_pypy_flags*/ #endif }; static PyObject *__pyx_tp_new_6libzim_Searcher(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_6libzim_Searcher *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_6libzim_Searcher *)o); new((void*)&(p->c_searcher)) wrapper::Searcher(); if (unlikely(__pyx_pw_6libzim_8Searcher_1__cinit__(o, a, k) < 0)) goto bad; return o; bad: Py_DECREF(o); o = 0; return NULL; } static void __pyx_tp_dealloc_6libzim_Searcher(PyObject *o) { struct __pyx_obj_6libzim_Searcher *p = (struct __pyx_obj_6libzim_Searcher *)o; #if CYTHON_USE_TP_FINALIZE if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif __Pyx_call_destructor(p->c_searcher); (*Py_TYPE(o)->tp_free)(o); } static PyMethodDef __pyx_methods_6libzim_Searcher[] = { {"search", (PyCFunction)__pyx_pw_6libzim_8Searcher_3search, METH_O, __pyx_doc_6libzim_8Searcher_2search}, {"__reduce_cython__", (PyCFunction)__pyx_pw_6libzim_8Searcher_5__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw_6libzim_8Searcher_7__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; static PyTypeObject __pyx_type_6libzim_Searcher = { PyVarObject_HEAD_INIT(0, 0) "libzim.Searcher", /*tp_name*/ sizeof(struct __pyx_obj_6libzim_Searcher), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6libzim_Searcher, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030800b4 0, /*tp_vectorcall_offset*/ #endif 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*/ "ZIM Archive Searcher\n\n Attributes\n ----------\n *c_archive : Searcher\n a pointer to a C++ Searcher object", /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_6libzim_Searcher, /*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_6libzim_Searcher, /*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 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 0, /*tp_pypy_flags*/ #endif }; static struct __pyx_vtabstruct_6libzim_SuggestionResultSet __pyx_vtable_6libzim_SuggestionResultSet; static PyObject *__pyx_tp_new_6libzim_SuggestionResultSet(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_6libzim_SuggestionResultSet *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_6libzim_SuggestionResultSet *)o); p->__pyx_vtab = __pyx_vtabptr_6libzim_SuggestionResultSet; new((void*)&(p->c_resultset)) wrapper::SuggestionResultSet(); return o; } static void __pyx_tp_dealloc_6libzim_SuggestionResultSet(PyObject *o) { struct __pyx_obj_6libzim_SuggestionResultSet *p = (struct __pyx_obj_6libzim_SuggestionResultSet *)o; #if CYTHON_USE_TP_FINALIZE if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif __Pyx_call_destructor(p->c_resultset); (*Py_TYPE(o)->tp_free)(o); } static PyMethodDef __pyx_methods_6libzim_SuggestionResultSet[] = { {"__reduce_cython__", (PyCFunction)__pyx_pw_6libzim_19SuggestionResultSet_4__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw_6libzim_19SuggestionResultSet_6__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; static PyTypeObject __pyx_type_6libzim_SuggestionResultSet = { PyVarObject_HEAD_INIT(0, 0) "libzim.SuggestionResultSet", /*tp_name*/ sizeof(struct __pyx_obj_6libzim_SuggestionResultSet), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6libzim_SuggestionResultSet, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030800b4 0, /*tp_vectorcall_offset*/ #endif 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*/ "Iterator over a SuggestionSearch result: entry paths", /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ __pyx_pw_6libzim_19SuggestionResultSet_1__iter__, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_6libzim_SuggestionResultSet, /*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_6libzim_SuggestionResultSet, /*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 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 0, /*tp_pypy_flags*/ #endif }; static struct __pyx_vtabstruct_6libzim_SuggestionSearch __pyx_vtable_6libzim_SuggestionSearch; static PyObject *__pyx_tp_new_6libzim_SuggestionSearch(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_6libzim_SuggestionSearch *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_6libzim_SuggestionSearch *)o); p->__pyx_vtab = __pyx_vtabptr_6libzim_SuggestionSearch; new((void*)&(p->c_search)) wrapper::SuggestionSearch(); return o; } static void __pyx_tp_dealloc_6libzim_SuggestionSearch(PyObject *o) { struct __pyx_obj_6libzim_SuggestionSearch *p = (struct __pyx_obj_6libzim_SuggestionSearch *)o; #if CYTHON_USE_TP_FINALIZE if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif __Pyx_call_destructor(p->c_search); (*Py_TYPE(o)->tp_free)(o); } static PyMethodDef __pyx_methods_6libzim_SuggestionSearch[] = { {"getEstimatedMatches", (PyCFunction)__pyx_pw_6libzim_16SuggestionSearch_1getEstimatedMatches, METH_NOARGS, __pyx_doc_6libzim_16SuggestionSearch_getEstimatedMatches}, {"getResults", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6libzim_16SuggestionSearch_3getResults, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6libzim_16SuggestionSearch_2getResults}, {"__reduce_cython__", (PyCFunction)__pyx_pw_6libzim_16SuggestionSearch_5__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw_6libzim_16SuggestionSearch_7__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; static PyTypeObject __pyx_type_6libzim_SuggestionSearch = { PyVarObject_HEAD_INIT(0, 0) "libzim.SuggestionSearch", /*tp_name*/ sizeof(struct __pyx_obj_6libzim_SuggestionSearch), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6libzim_SuggestionSearch, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030800b4 0, /*tp_vectorcall_offset*/ #endif 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_6libzim_SuggestionSearch, /*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_6libzim_SuggestionSearch, /*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 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 0, /*tp_pypy_flags*/ #endif }; static PyObject *__pyx_tp_new_6libzim_SuggestionSearcher(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_6libzim_SuggestionSearcher *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_6libzim_SuggestionSearcher *)o); new((void*)&(p->c_searcher)) wrapper::SuggestionSearcher(); if (unlikely(__pyx_pw_6libzim_18SuggestionSearcher_1__cinit__(o, a, k) < 0)) goto bad; return o; bad: Py_DECREF(o); o = 0; return NULL; } static void __pyx_tp_dealloc_6libzim_SuggestionSearcher(PyObject *o) { struct __pyx_obj_6libzim_SuggestionSearcher *p = (struct __pyx_obj_6libzim_SuggestionSearcher *)o; #if CYTHON_USE_TP_FINALIZE if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif __Pyx_call_destructor(p->c_searcher); (*Py_TYPE(o)->tp_free)(o); } static PyMethodDef __pyx_methods_6libzim_SuggestionSearcher[] = { {"suggest", (PyCFunction)__pyx_pw_6libzim_18SuggestionSearcher_3suggest, METH_O, __pyx_doc_6libzim_18SuggestionSearcher_2suggest}, {"__reduce_cython__", (PyCFunction)__pyx_pw_6libzim_18SuggestionSearcher_5__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw_6libzim_18SuggestionSearcher_7__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; static PyTypeObject __pyx_type_6libzim_SuggestionSearcher = { PyVarObject_HEAD_INIT(0, 0) "libzim.SuggestionSearcher", /*tp_name*/ sizeof(struct __pyx_obj_6libzim_SuggestionSearcher), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6libzim_SuggestionSearcher, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030800b4 0, /*tp_vectorcall_offset*/ #endif 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*/ "ZIM Archive SuggestionSearcher\n\n Attributes\n ----------\n *c_archive : Searcher\n a pointer to a C++ Searcher object", /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_6libzim_SuggestionSearcher, /*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_6libzim_SuggestionSearcher, /*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 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 0, /*tp_pypy_flags*/ #endif }; static struct __pyx_obj_6libzim___pyx_scope_struct__gen_blob *__pyx_freelist_6libzim___pyx_scope_struct__gen_blob[8]; static int __pyx_freecount_6libzim___pyx_scope_struct__gen_blob = 0; static PyObject *__pyx_tp_new_6libzim___pyx_scope_struct__gen_blob(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6libzim___pyx_scope_struct__gen_blob > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6libzim___pyx_scope_struct__gen_blob)))) { o = (PyObject*)__pyx_freelist_6libzim___pyx_scope_struct__gen_blob[--__pyx_freecount_6libzim___pyx_scope_struct__gen_blob]; memset(o, 0, sizeof(struct __pyx_obj_6libzim___pyx_scope_struct__gen_blob)); (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_6libzim___pyx_scope_struct__gen_blob(PyObject *o) { struct __pyx_obj_6libzim___pyx_scope_struct__gen_blob *p = (struct __pyx_obj_6libzim___pyx_scope_struct__gen_blob *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6libzim___pyx_scope_struct__gen_blob < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6libzim___pyx_scope_struct__gen_blob)))) { __pyx_freelist_6libzim___pyx_scope_struct__gen_blob[__pyx_freecount_6libzim___pyx_scope_struct__gen_blob++] = ((struct __pyx_obj_6libzim___pyx_scope_struct__gen_blob *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } static int __pyx_tp_traverse_6libzim___pyx_scope_struct__gen_blob(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_6libzim___pyx_scope_struct__gen_blob *p = (struct __pyx_obj_6libzim___pyx_scope_struct__gen_blob *)o; if (p->__pyx_v_self) { e = (*v)(p->__pyx_v_self, a); if (e) return e; } return 0; } static PyTypeObject __pyx_type_6libzim___pyx_scope_struct__gen_blob = { PyVarObject_HEAD_INIT(0, 0) "libzim.__pyx_scope_struct__gen_blob", /*tp_name*/ sizeof(struct __pyx_obj_6libzim___pyx_scope_struct__gen_blob), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6libzim___pyx_scope_struct__gen_blob, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030800b4 0, /*tp_vectorcall_offset*/ #endif 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_6libzim___pyx_scope_struct__gen_blob, /*tp_traverse*/ 0, /*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_6libzim___pyx_scope_struct__gen_blob, /*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 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 0, /*tp_pypy_flags*/ #endif }; static struct __pyx_obj_6libzim___pyx_scope_struct_1_gen_blob *__pyx_freelist_6libzim___pyx_scope_struct_1_gen_blob[8]; static int __pyx_freecount_6libzim___pyx_scope_struct_1_gen_blob = 0; static PyObject *__pyx_tp_new_6libzim___pyx_scope_struct_1_gen_blob(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6libzim___pyx_scope_struct_1_gen_blob > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6libzim___pyx_scope_struct_1_gen_blob)))) { o = (PyObject*)__pyx_freelist_6libzim___pyx_scope_struct_1_gen_blob[--__pyx_freecount_6libzim___pyx_scope_struct_1_gen_blob]; memset(o, 0, sizeof(struct __pyx_obj_6libzim___pyx_scope_struct_1_gen_blob)); (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_6libzim___pyx_scope_struct_1_gen_blob(PyObject *o) { struct __pyx_obj_6libzim___pyx_scope_struct_1_gen_blob *p = (struct __pyx_obj_6libzim___pyx_scope_struct_1_gen_blob *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_fh); Py_CLEAR(p->__pyx_v_res); Py_CLEAR(p->__pyx_v_self); Py_CLEAR(p->__pyx_t_0); Py_CLEAR(p->__pyx_t_1); Py_CLEAR(p->__pyx_t_2); Py_CLEAR(p->__pyx_t_3); if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6libzim___pyx_scope_struct_1_gen_blob < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6libzim___pyx_scope_struct_1_gen_blob)))) { __pyx_freelist_6libzim___pyx_scope_struct_1_gen_blob[__pyx_freecount_6libzim___pyx_scope_struct_1_gen_blob++] = ((struct __pyx_obj_6libzim___pyx_scope_struct_1_gen_blob *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } static int __pyx_tp_traverse_6libzim___pyx_scope_struct_1_gen_blob(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_6libzim___pyx_scope_struct_1_gen_blob *p = (struct __pyx_obj_6libzim___pyx_scope_struct_1_gen_blob *)o; if (p->__pyx_v_fh) { e = (*v)(p->__pyx_v_fh, a); if (e) return e; } if (p->__pyx_v_res) { e = (*v)(p->__pyx_v_res, a); if (e) return e; } if (p->__pyx_v_self) { e = (*v)(p->__pyx_v_self, a); if (e) return e; } if (p->__pyx_t_0) { e = (*v)(p->__pyx_t_0, a); if (e) return e; } if (p->__pyx_t_1) { e = (*v)(p->__pyx_t_1, a); if (e) return e; } if (p->__pyx_t_2) { e = (*v)(p->__pyx_t_2, a); if (e) return e; } if (p->__pyx_t_3) { e = (*v)(p->__pyx_t_3, a); if (e) return e; } return 0; } static PyTypeObject __pyx_type_6libzim___pyx_scope_struct_1_gen_blob = { PyVarObject_HEAD_INIT(0, 0) "libzim.__pyx_scope_struct_1_gen_blob", /*tp_name*/ sizeof(struct __pyx_obj_6libzim___pyx_scope_struct_1_gen_blob), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6libzim___pyx_scope_struct_1_gen_blob, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030800b4 0, /*tp_vectorcall_offset*/ #endif 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_6libzim___pyx_scope_struct_1_gen_blob, /*tp_traverse*/ 0, /*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_6libzim___pyx_scope_struct_1_gen_blob, /*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 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 0, /*tp_pypy_flags*/ #endif }; static struct __pyx_obj_6libzim___pyx_scope_struct_2___iter__ *__pyx_freelist_6libzim___pyx_scope_struct_2___iter__[8]; static int __pyx_freecount_6libzim___pyx_scope_struct_2___iter__ = 0; static PyObject *__pyx_tp_new_6libzim___pyx_scope_struct_2___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_6libzim___pyx_scope_struct_2___iter__ *p; PyObject *o; if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6libzim___pyx_scope_struct_2___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6libzim___pyx_scope_struct_2___iter__)))) { o = (PyObject*)__pyx_freelist_6libzim___pyx_scope_struct_2___iter__[--__pyx_freecount_6libzim___pyx_scope_struct_2___iter__]; memset(o, 0, sizeof(struct __pyx_obj_6libzim___pyx_scope_struct_2___iter__)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } p = ((struct __pyx_obj_6libzim___pyx_scope_struct_2___iter__ *)o); new((void*)&(p->__pyx_v_current)) zim::SearchIterator(); new((void*)&(p->__pyx_v_end)) zim::SearchIterator(); return o; } static void __pyx_tp_dealloc_6libzim___pyx_scope_struct_2___iter__(PyObject *o) { struct __pyx_obj_6libzim___pyx_scope_struct_2___iter__ *p = (struct __pyx_obj_6libzim___pyx_scope_struct_2___iter__ *)o; PyObject_GC_UnTrack(o); __Pyx_call_destructor(p->__pyx_v_current); __Pyx_call_destructor(p->__pyx_v_end); Py_CLEAR(p->__pyx_v_self); if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6libzim___pyx_scope_struct_2___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6libzim___pyx_scope_struct_2___iter__)))) { __pyx_freelist_6libzim___pyx_scope_struct_2___iter__[__pyx_freecount_6libzim___pyx_scope_struct_2___iter__++] = ((struct __pyx_obj_6libzim___pyx_scope_struct_2___iter__ *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } static int __pyx_tp_traverse_6libzim___pyx_scope_struct_2___iter__(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_6libzim___pyx_scope_struct_2___iter__ *p = (struct __pyx_obj_6libzim___pyx_scope_struct_2___iter__ *)o; if (p->__pyx_v_self) { e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; } return 0; } static PyTypeObject __pyx_type_6libzim___pyx_scope_struct_2___iter__ = { PyVarObject_HEAD_INIT(0, 0) "libzim.__pyx_scope_struct_2___iter__", /*tp_name*/ sizeof(struct __pyx_obj_6libzim___pyx_scope_struct_2___iter__), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6libzim___pyx_scope_struct_2___iter__, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030800b4 0, /*tp_vectorcall_offset*/ #endif 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_6libzim___pyx_scope_struct_2___iter__, /*tp_traverse*/ 0, /*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_6libzim___pyx_scope_struct_2___iter__, /*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 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 0, /*tp_pypy_flags*/ #endif }; static struct __pyx_obj_6libzim___pyx_scope_struct_3___iter__ *__pyx_freelist_6libzim___pyx_scope_struct_3___iter__[8]; static int __pyx_freecount_6libzim___pyx_scope_struct_3___iter__ = 0; static PyObject *__pyx_tp_new_6libzim___pyx_scope_struct_3___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_6libzim___pyx_scope_struct_3___iter__ *p; PyObject *o; if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6libzim___pyx_scope_struct_3___iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6libzim___pyx_scope_struct_3___iter__)))) { o = (PyObject*)__pyx_freelist_6libzim___pyx_scope_struct_3___iter__[--__pyx_freecount_6libzim___pyx_scope_struct_3___iter__]; memset(o, 0, sizeof(struct __pyx_obj_6libzim___pyx_scope_struct_3___iter__)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } p = ((struct __pyx_obj_6libzim___pyx_scope_struct_3___iter__ *)o); new((void*)&(p->__pyx_v_current)) wrapper::SuggestionIterator(); new((void*)&(p->__pyx_v_end)) wrapper::SuggestionIterator(); return o; } static void __pyx_tp_dealloc_6libzim___pyx_scope_struct_3___iter__(PyObject *o) { struct __pyx_obj_6libzim___pyx_scope_struct_3___iter__ *p = (struct __pyx_obj_6libzim___pyx_scope_struct_3___iter__ *)o; PyObject_GC_UnTrack(o); __Pyx_call_destructor(p->__pyx_v_current); __Pyx_call_destructor(p->__pyx_v_end); Py_CLEAR(p->__pyx_v_self); if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6libzim___pyx_scope_struct_3___iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6libzim___pyx_scope_struct_3___iter__)))) { __pyx_freelist_6libzim___pyx_scope_struct_3___iter__[__pyx_freecount_6libzim___pyx_scope_struct_3___iter__++] = ((struct __pyx_obj_6libzim___pyx_scope_struct_3___iter__ *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } static int __pyx_tp_traverse_6libzim___pyx_scope_struct_3___iter__(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_6libzim___pyx_scope_struct_3___iter__ *p = (struct __pyx_obj_6libzim___pyx_scope_struct_3___iter__ *)o; if (p->__pyx_v_self) { e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e; } return 0; } static PyTypeObject __pyx_type_6libzim___pyx_scope_struct_3___iter__ = { PyVarObject_HEAD_INIT(0, 0) "libzim.__pyx_scope_struct_3___iter__", /*tp_name*/ sizeof(struct __pyx_obj_6libzim___pyx_scope_struct_3___iter__), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_6libzim___pyx_scope_struct_3___iter__, /*tp_dealloc*/ #if PY_VERSION_HEX < 0x030800b4 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030800b4 0, /*tp_vectorcall_offset*/ #endif 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_6libzim___pyx_scope_struct_3___iter__, /*tp_traverse*/ 0, /*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_6libzim___pyx_scope_struct_3___iter__, /*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 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, /*tp_vectorcall*/ #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 0, /*tp_pypy_flags*/ #endif }; static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 #if CYTHON_PEP489_MULTI_PHASE_INIT static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ static int __pyx_pymod_exec_libzim(PyObject* module); /*proto*/ static PyModuleDef_Slot __pyx_moduledef_slots[] = { {Py_mod_create, (void*)__pyx_pymod_create}, {Py_mod_exec, (void*)__pyx_pymod_exec_libzim}, {0, NULL} }; #endif static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, "libzim", __pyx_k_openZIM_s_file_format_library_bi, /* m_doc */ #if CYTHON_PEP489_MULTI_PHASE_INIT 0, /* m_size */ #else -1, /* m_size */ #endif __pyx_methods /* m_methods */, #if CYTHON_PEP489_MULTI_PHASE_INIT __pyx_moduledef_slots, /* m_slots */ #else NULL, /* m_reload */ #endif NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif #ifndef CYTHON_SMALL_CODE #if defined(__clang__) #define CYTHON_SMALL_CODE #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) #define CYTHON_SMALL_CODE __attribute__((cold)) #else #define CYTHON_SMALL_CODE #endif #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_b_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 0, 0}, {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, {&__pyx_n_s_Archive, __pyx_k_Archive, sizeof(__pyx_k_Archive), 0, 0, 1, 1}, {&__pyx_n_s_BaseWritingItem, __pyx_k_BaseWritingItem, sizeof(__pyx_k_BaseWritingItem), 0, 0, 1, 1}, {&__pyx_n_s_BaseWritingItem___init, __pyx_k_BaseWritingItem___init, sizeof(__pyx_k_BaseWritingItem___init), 0, 0, 1, 1}, {&__pyx_n_s_BaseWritingItem___repr, __pyx_k_BaseWritingItem___repr, sizeof(__pyx_k_BaseWritingItem___repr), 0, 0, 1, 1}, {&__pyx_n_s_BaseWritingItem_get_contentprovi, __pyx_k_BaseWritingItem_get_contentprovi, sizeof(__pyx_k_BaseWritingItem_get_contentprovi), 0, 0, 1, 1}, {&__pyx_n_s_BaseWritingItem_get_hints, __pyx_k_BaseWritingItem_get_hints, sizeof(__pyx_k_BaseWritingItem_get_hints), 0, 0, 1, 1}, {&__pyx_n_s_BaseWritingItem_get_mimetype, __pyx_k_BaseWritingItem_get_mimetype, sizeof(__pyx_k_BaseWritingItem_get_mimetype), 0, 0, 1, 1}, {&__pyx_n_s_BaseWritingItem_get_path, __pyx_k_BaseWritingItem_get_path, sizeof(__pyx_k_BaseWritingItem_get_path), 0, 0, 1, 1}, {&__pyx_n_s_BaseWritingItem_get_title, __pyx_k_BaseWritingItem_get_title, sizeof(__pyx_k_BaseWritingItem_get_title), 0, 0, 1, 1}, {&__pyx_n_u_Blob, __pyx_k_Blob, sizeof(__pyx_k_Blob), 0, 1, 0, 1}, {&__pyx_kp_u_Blob_has_views, __pyx_k_Blob_has_views, sizeof(__pyx_k_Blob_has_views), 0, 1, 0, 0}, {&__pyx_kp_u_Blob_is_none, __pyx_k_Blob_is_none, sizeof(__pyx_k_Blob_is_none), 0, 1, 0, 0}, {&__pyx_n_s_BufferError, __pyx_k_BufferError, sizeof(__pyx_k_BufferError), 0, 0, 1, 1}, {&__pyx_n_s_COMPRESS, __pyx_k_COMPRESS, sizeof(__pyx_k_COMPRESS), 0, 0, 1, 1}, {&__pyx_kp_u_Cannot_create_writable_memoryvie, __pyx_k_Cannot_create_writable_memoryvie, sizeof(__pyx_k_Cannot_create_writable_memoryvie), 0, 1, 0, 0}, {&__pyx_n_s_Compression, __pyx_k_Compression, sizeof(__pyx_k_Compression), 0, 0, 1, 1}, {&__pyx_kp_s_Compression_algorithms_available, __pyx_k_Compression_algorithms_available, sizeof(__pyx_k_Compression_algorithms_available), 0, 0, 1, 0}, {&__pyx_n_s_ContentProvider, __pyx_k_ContentProvider, sizeof(__pyx_k_ContentProvider), 0, 0, 1, 1}, {&__pyx_n_s_ContentProvider___init, __pyx_k_ContentProvider___init, sizeof(__pyx_k_ContentProvider___init), 0, 0, 1, 1}, {&__pyx_n_s_ContentProvider_feed, __pyx_k_ContentProvider_feed, sizeof(__pyx_k_ContentProvider_feed), 0, 0, 1, 1}, {&__pyx_kp_s_ContentProvider_for_a_file_using, __pyx_k_ContentProvider_for_a_file_using, sizeof(__pyx_k_ContentProvider_for_a_file_using), 0, 0, 1, 0}, {&__pyx_kp_s_ContentProvider_for_a_single_enc, __pyx_k_ContentProvider_for_a_single_enc, sizeof(__pyx_k_ContentProvider_for_a_single_enc), 0, 0, 1, 0}, {&__pyx_n_s_ContentProvider_gen_blob, __pyx_k_ContentProvider_gen_blob, sizeof(__pyx_k_ContentProvider_gen_blob), 0, 0, 1, 1}, {&__pyx_n_s_ContentProvider_get_size, __pyx_k_ContentProvider_get_size, sizeof(__pyx_k_ContentProvider_get_size), 0, 0, 1, 1}, {&__pyx_kp_u_ContentProvider_is_None, __pyx_k_ContentProvider_is_None, sizeof(__pyx_k_ContentProvider_is_None), 0, 1, 0, 0}, {&__pyx_n_s_Creator, __pyx_k_Creator, sizeof(__pyx_k_Creator), 0, 0, 1, 1}, {&__pyx_n_s_Creator_2, __pyx_k_Creator_2, sizeof(__pyx_k_Creator_2), 0, 0, 1, 1}, {&__pyx_n_s_Creator___repr, __pyx_k_Creator___repr, sizeof(__pyx_k_Creator___repr), 0, 0, 1, 1}, {&__pyx_n_s_Creator_add_metadata, __pyx_k_Creator_add_metadata, sizeof(__pyx_k_Creator_add_metadata), 0, 0, 1, 1}, {&__pyx_n_s_Creator_config_compression, __pyx_k_Creator_config_compression, sizeof(__pyx_k_Creator_config_compression), 0, 0, 1, 1}, {&__pyx_kp_u_Creator_filename, __pyx_k_Creator_filename, sizeof(__pyx_k_Creator_filename), 0, 1, 0, 0}, {&__pyx_kp_u_Creator_not_started, __pyx_k_Creator_not_started, sizeof(__pyx_k_Creator_not_started), 0, 1, 0, 0}, {&__pyx_kp_u_Creator_started, __pyx_k_Creator_started, sizeof(__pyx_k_Creator_started), 0, 1, 0, 0}, {&__pyx_n_u_Date, __pyx_k_Date, sizeof(__pyx_k_Date), 0, 1, 0, 1}, {&__pyx_n_s_Dict, __pyx_k_Dict, sizeof(__pyx_k_Dict), 0, 0, 1, 1}, {&__pyx_n_s_Entry, __pyx_k_Entry, sizeof(__pyx_k_Entry), 0, 0, 1, 1}, {&__pyx_n_s_Enum, __pyx_k_Enum, sizeof(__pyx_k_Enum), 0, 0, 1, 1}, {&__pyx_n_s_FRONT_ARTICLE, __pyx_k_FRONT_ARTICLE, sizeof(__pyx_k_FRONT_ARTICLE), 0, 0, 1, 1}, {&__pyx_n_s_FileProvider, __pyx_k_FileProvider, sizeof(__pyx_k_FileProvider), 0, 0, 1, 1}, {&__pyx_n_s_FileProvider___init, __pyx_k_FileProvider___init, sizeof(__pyx_k_FileProvider___init), 0, 0, 1, 1}, {&__pyx_n_s_FileProvider_gen_blob, __pyx_k_FileProvider_gen_blob, sizeof(__pyx_k_FileProvider_gen_blob), 0, 0, 1, 1}, {&__pyx_n_s_FileProvider_get_size, __pyx_k_FileProvider_get_size, sizeof(__pyx_k_FileProvider_get_size), 0, 0, 1, 1}, {&__pyx_n_s_Generator, __pyx_k_Generator, sizeof(__pyx_k_Generator), 0, 0, 1, 1}, {&__pyx_n_s_Hint, __pyx_k_Hint, sizeof(__pyx_k_Hint), 0, 0, 1, 1}, {&__pyx_n_s_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 0, 1, 1}, {&__pyx_n_s_IndexData, __pyx_k_IndexData, sizeof(__pyx_k_IndexData), 0, 0, 1, 1}, {&__pyx_n_s_IndexData_get_content, __pyx_k_IndexData_get_content, sizeof(__pyx_k_IndexData_get_content), 0, 0, 1, 1}, {&__pyx_n_s_IndexData_get_geoposition, __pyx_k_IndexData_get_geoposition, sizeof(__pyx_k_IndexData_get_geoposition), 0, 0, 1, 1}, {&__pyx_n_s_IndexData_get_keywords, __pyx_k_IndexData_get_keywords, sizeof(__pyx_k_IndexData_get_keywords), 0, 0, 1, 1}, {&__pyx_n_s_IndexData_get_title, __pyx_k_IndexData_get_title, sizeof(__pyx_k_IndexData_get_title), 0, 0, 1, 1}, {&__pyx_n_s_IndexData_get_wordcount, __pyx_k_IndexData_get_wordcount, sizeof(__pyx_k_IndexData_get_wordcount), 0, 0, 1, 1}, {&__pyx_n_s_IndexData_has_indexdata, __pyx_k_IndexData_has_indexdata, sizeof(__pyx_k_IndexData_has_indexdata), 0, 0, 1, 1}, {&__pyx_kp_s_IndexData_stub_to_override_Retu, __pyx_k_IndexData_stub_to_override_Retu, sizeof(__pyx_k_IndexData_stub_to_override_Retu), 0, 0, 1, 0}, {&__pyx_n_s_Item, __pyx_k_Item, sizeof(__pyx_k_Item), 0, 0, 1, 1}, {&__pyx_n_u_Item, __pyx_k_Item, sizeof(__pyx_k_Item), 0, 1, 0, 1}, {&__pyx_kp_s_Item_stub_to_override_Pass_a_sub, __pyx_k_Item_stub_to_override_Pass_a_sub, sizeof(__pyx_k_Item_stub_to_override_Pass_a_sub), 0, 0, 1, 0}, {&__pyx_n_s_Iterator, __pyx_k_Iterator, sizeof(__pyx_k_Iterator), 0, 0, 1, 1}, {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1}, {&__pyx_n_s_List, __pyx_k_List, sizeof(__pyx_k_List), 0, 0, 1, 1}, {&__pyx_n_s_Loader, __pyx_k_Loader, sizeof(__pyx_k_Loader), 0, 0, 1, 1}, {&__pyx_n_s_MetaPathFinder, __pyx_k_MetaPathFinder, sizeof(__pyx_k_MetaPathFinder), 0, 0, 1, 1}, {&__pyx_n_s_ModuleFinder, __pyx_k_ModuleFinder, sizeof(__pyx_k_ModuleFinder), 0, 0, 1, 1}, {&__pyx_n_s_ModuleFinder_find_spec, __pyx_k_ModuleFinder_find_spec, sizeof(__pyx_k_ModuleFinder_find_spec), 0, 0, 1, 1}, {&__pyx_n_s_ModuleLoader, __pyx_k_ModuleLoader, sizeof(__pyx_k_ModuleLoader), 0, 0, 1, 1}, {&__pyx_n_s_ModuleLoader_create_module, __pyx_k_ModuleLoader_create_module, sizeof(__pyx_k_ModuleLoader_create_module), 0, 0, 1, 1}, {&__pyx_n_s_ModuleLoader_exec_module, __pyx_k_ModuleLoader_exec_module, sizeof(__pyx_k_ModuleLoader_exec_module), 0, 0, 1, 1}, {&__pyx_n_s_ModuleSpec, __pyx_k_ModuleSpec, sizeof(__pyx_k_ModuleSpec), 0, 0, 1, 1}, {&__pyx_n_s_ModuleType, __pyx_k_ModuleType, sizeof(__pyx_k_ModuleType), 0, 0, 1, 1}, {&__pyx_kp_u_None, __pyx_k_None, sizeof(__pyx_k_None), 0, 1, 0, 0}, {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1}, {&__pyx_n_s_Optional, __pyx_k_Optional, sizeof(__pyx_k_Optional), 0, 0, 1, 1}, {&__pyx_n_s_OrderedDict, __pyx_k_OrderedDict, sizeof(__pyx_k_OrderedDict), 0, 0, 1, 1}, {&__pyx_n_s_Path, __pyx_k_Path, sizeof(__pyx_k_Path), 0, 0, 1, 1}, {&__pyx_n_s_Query, __pyx_k_Query, sizeof(__pyx_k_Query), 0, 0, 1, 1}, {&__pyx_n_s_ReadingBlob, __pyx_k_ReadingBlob, sizeof(__pyx_k_ReadingBlob), 0, 0, 1, 1}, {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s_Search, __pyx_k_Search, sizeof(__pyx_k_Search), 0, 0, 1, 1}, {&__pyx_n_s_SearchResultSet, __pyx_k_SearchResultSet, sizeof(__pyx_k_SearchResultSet), 0, 0, 1, 1}, {&__pyx_n_s_SearchResultSet___iter, __pyx_k_SearchResultSet___iter, sizeof(__pyx_k_SearchResultSet___iter), 0, 0, 1, 1}, {&__pyx_n_s_Searcher, __pyx_k_Searcher, sizeof(__pyx_k_Searcher), 0, 0, 1, 1}, {&__pyx_n_s_Set, __pyx_k_Set, sizeof(__pyx_k_Set), 0, 0, 1, 1}, {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1}, {&__pyx_n_s_StringProvider, __pyx_k_StringProvider, sizeof(__pyx_k_StringProvider), 0, 0, 1, 1}, {&__pyx_n_s_StringProvider___init, __pyx_k_StringProvider___init, sizeof(__pyx_k_StringProvider___init), 0, 0, 1, 1}, {&__pyx_n_s_StringProvider_gen_blob, __pyx_k_StringProvider_gen_blob, sizeof(__pyx_k_StringProvider_gen_blob), 0, 0, 1, 1}, {&__pyx_n_s_StringProvider_get_size, __pyx_k_StringProvider_get_size, sizeof(__pyx_k_StringProvider_get_size), 0, 0, 1, 1}, {&__pyx_n_s_SuggestionResultSet, __pyx_k_SuggestionResultSet, sizeof(__pyx_k_SuggestionResultSet), 0, 0, 1, 1}, {&__pyx_n_s_SuggestionResultSet___iter, __pyx_k_SuggestionResultSet___iter, sizeof(__pyx_k_SuggestionResultSet___iter), 0, 0, 1, 1}, {&__pyx_n_s_SuggestionSearch, __pyx_k_SuggestionSearch, sizeof(__pyx_k_SuggestionSearch), 0, 0, 1, 1}, {&__pyx_n_s_SuggestionSearcher, __pyx_k_SuggestionSearcher, sizeof(__pyx_k_SuggestionSearcher), 0, 0, 1, 1}, {&__pyx_n_s_Tuple, __pyx_k_Tuple, sizeof(__pyx_k_Tuple), 0, 0, 1, 1}, {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, {&__pyx_kp_u_UTF_8, __pyx_k_UTF_8, sizeof(__pyx_k_UTF_8), 0, 1, 0, 0}, {&__pyx_n_s_UUID, __pyx_k_UUID, sizeof(__pyx_k_UUID), 0, 0, 1, 1}, {&__pyx_kp_u_Unable_to_write_ZIM_file_at, __pyx_k_Unable_to_write_ZIM_file_at, sizeof(__pyx_k_Unable_to_write_ZIM_file_at), 0, 1, 0, 0}, {&__pyx_n_s_Union, __pyx_k_Union, sizeof(__pyx_k_Union), 0, 0, 1, 1}, {&__pyx_n_s_W_OK, __pyx_k_W_OK, sizeof(__pyx_k_W_OK), 0, 0, 1, 1}, {&__pyx_n_s_WritingBlob, __pyx_k_WritingBlob, sizeof(__pyx_k_WritingBlob), 0, 0, 1, 1}, {&__pyx_n_u_WritingBlob, __pyx_k_WritingBlob, sizeof(__pyx_k_WritingBlob), 0, 1, 0, 1}, {&__pyx_kp_u_Y_m_d, __pyx_k_Y_m_d, sizeof(__pyx_k_Y_m_d), 0, 1, 0, 0}, {&__pyx_kp_u__24, __pyx_k__24, sizeof(__pyx_k__24), 0, 1, 0, 0}, {&__pyx_kp_u__50, __pyx_k__50, sizeof(__pyx_k__50), 0, 1, 0, 0}, {&__pyx_kp_u__51, __pyx_k__51, sizeof(__pyx_k__51), 0, 1, 0, 0}, {&__pyx_n_s_abc, __pyx_k_abc, sizeof(__pyx_k_abc), 0, 0, 1, 1}, {&__pyx_n_s_access, __pyx_k_access, sizeof(__pyx_k_access), 0, 0, 1, 1}, {&__pyx_n_s_add_metadata, __pyx_k_add_metadata, sizeof(__pyx_k_add_metadata), 0, 0, 1, 1}, {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1}, {&__pyx_n_s_all_2, __pyx_k_all_2, sizeof(__pyx_k_all_2), 0, 0, 1, 1}, {&__pyx_n_s_archive, __pyx_k_archive, sizeof(__pyx_k_archive), 0, 0, 1, 1}, {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, {&__pyx_n_s_blob, __pyx_k_blob, sizeof(__pyx_k_blob), 0, 0, 1, 1}, {&__pyx_n_u_bool, __pyx_k_bool, sizeof(__pyx_k_bool), 0, 1, 0, 1}, {&__pyx_n_s_bsize, __pyx_k_bsize, sizeof(__pyx_k_bsize), 0, 0, 1, 1}, {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 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_compression, __pyx_k_compression, sizeof(__pyx_k_compression), 0, 0, 1, 1}, {&__pyx_n_s_config_compression, __pyx_k_config_compression, sizeof(__pyx_k_config_compression), 0, 0, 1, 1}, {&__pyx_n_s_content, __pyx_k_content, sizeof(__pyx_k_content), 0, 0, 1, 1}, {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1}, {&__pyx_n_s_create_module, __pyx_k_create_module, sizeof(__pyx_k_create_module), 0, 0, 1, 1}, {&__pyx_n_s_date, __pyx_k_date, sizeof(__pyx_k_date), 0, 0, 1, 1}, {&__pyx_n_s_datetime, __pyx_k_datetime, sizeof(__pyx_k_datetime), 0, 0, 1, 1}, {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1}, {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, {&__pyx_n_s_doc_2, __pyx_k_doc_2, sizeof(__pyx_k_doc_2), 0, 0, 1, 1}, {&__pyx_n_s_effective_ids, __pyx_k_effective_ids, sizeof(__pyx_k_effective_ids), 0, 0, 1, 1}, {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1}, {&__pyx_n_s_enum, __pyx_k_enum, sizeof(__pyx_k_enum), 0, 0, 1, 1}, {&__pyx_n_s_exc_tb, __pyx_k_exc_tb, sizeof(__pyx_k_exc_tb), 0, 0, 1, 1}, {&__pyx_n_s_exc_type, __pyx_k_exc_type, sizeof(__pyx_k_exc_type), 0, 0, 1, 1}, {&__pyx_n_s_exc_val, __pyx_k_exc_val, sizeof(__pyx_k_exc_val), 0, 0, 1, 1}, {&__pyx_n_s_exec_module, __pyx_k_exec_module, sizeof(__pyx_k_exec_module), 0, 0, 1, 1}, {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1}, {&__pyx_n_s_expanduser, __pyx_k_expanduser, sizeof(__pyx_k_expanduser), 0, 0, 1, 1}, {&__pyx_n_s_feed, __pyx_k_feed, sizeof(__pyx_k_feed), 0, 0, 1, 1}, {&__pyx_n_s_fh, __pyx_k_fh, sizeof(__pyx_k_fh), 0, 0, 1, 1}, {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1}, {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1}, {&__pyx_kp_u_filename_2, __pyx_k_filename_2, sizeof(__pyx_k_filename_2), 0, 1, 0, 0}, {&__pyx_n_s_filepath, __pyx_k_filepath, sizeof(__pyx_k_filepath), 0, 0, 1, 1}, {&__pyx_n_s_find_spec, __pyx_k_find_spec, sizeof(__pyx_k_find_spec), 0, 0, 1, 1}, {&__pyx_n_s_format_exc, __pyx_k_format_exc, sizeof(__pyx_k_format_exc), 0, 0, 1, 1}, {&__pyx_n_s_fullname, __pyx_k_fullname, sizeof(__pyx_k_fullname), 0, 0, 1, 1}, {&__pyx_n_s_gen_blob, __pyx_k_gen_blob, sizeof(__pyx_k_gen_blob), 0, 0, 1, 1}, {&__pyx_kp_u_gen_blob_ro_feed_must_be_impleme, __pyx_k_gen_blob_ro_feed_must_be_impleme, sizeof(__pyx_k_gen_blob_ro_feed_must_be_impleme), 0, 1, 0, 0}, {&__pyx_n_s_generator, __pyx_k_generator, sizeof(__pyx_k_generator), 0, 0, 1, 1}, {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, {&__pyx_n_s_get_content, __pyx_k_get_content, sizeof(__pyx_k_get_content), 0, 0, 1, 1}, {&__pyx_kp_u_get_content_must_be_implemented, __pyx_k_get_content_must_be_implemented, sizeof(__pyx_k_get_content_must_be_implemented), 0, 1, 0, 0}, {&__pyx_n_s_get_contentprovider, __pyx_k_get_contentprovider, sizeof(__pyx_k_get_contentprovider), 0, 0, 1, 1}, {&__pyx_kp_u_get_contentprovider_must_be_impl, __pyx_k_get_contentprovider_must_be_impl, sizeof(__pyx_k_get_contentprovider_must_be_impl), 0, 1, 0, 0}, {&__pyx_n_s_get_geoposition, __pyx_k_get_geoposition, sizeof(__pyx_k_get_geoposition), 0, 0, 1, 1}, {&__pyx_n_s_get_hints, __pyx_k_get_hints, sizeof(__pyx_k_get_hints), 0, 0, 1, 1}, {&__pyx_kp_u_get_hints_must_be_implemented, __pyx_k_get_hints_must_be_implemented, sizeof(__pyx_k_get_hints_must_be_implemented), 0, 1, 0, 0}, {&__pyx_n_s_get_keywords, __pyx_k_get_keywords, sizeof(__pyx_k_get_keywords), 0, 0, 1, 1}, {&__pyx_kp_u_get_keywords_must_be_implemented, __pyx_k_get_keywords_must_be_implemented, sizeof(__pyx_k_get_keywords_must_be_implemented), 0, 1, 0, 0}, {&__pyx_n_s_get_libzim_version, __pyx_k_get_libzim_version, sizeof(__pyx_k_get_libzim_version), 0, 0, 1, 1}, {&__pyx_n_s_get_mimetype, __pyx_k_get_mimetype, sizeof(__pyx_k_get_mimetype), 0, 0, 1, 1}, {&__pyx_kp_u_get_mimetype_must_be_implemented, __pyx_k_get_mimetype_must_be_implemented, sizeof(__pyx_k_get_mimetype_must_be_implemented), 0, 1, 0, 0}, {&__pyx_n_s_get_path, __pyx_k_get_path, sizeof(__pyx_k_get_path), 0, 0, 1, 1}, {&__pyx_kp_u_get_path_must_be_implemented, __pyx_k_get_path_must_be_implemented, sizeof(__pyx_k_get_path_must_be_implemented), 0, 1, 0, 0}, {&__pyx_n_s_get_size, __pyx_k_get_size, sizeof(__pyx_k_get_size), 0, 0, 1, 1}, {&__pyx_kp_u_get_size_must_be_implemented, __pyx_k_get_size_must_be_implemented, sizeof(__pyx_k_get_size_must_be_implemented), 0, 1, 0, 0}, {&__pyx_n_s_get_title, __pyx_k_get_title, sizeof(__pyx_k_get_title), 0, 0, 1, 1}, {&__pyx_kp_u_get_title_must_be_implemented, __pyx_k_get_title_must_be_implemented, sizeof(__pyx_k_get_title_must_be_implemented), 0, 1, 0, 0}, {&__pyx_n_s_get_versions, __pyx_k_get_versions, sizeof(__pyx_k_get_versions), 0, 0, 1, 1}, {&__pyx_n_s_get_wordcount, __pyx_k_get_wordcount, sizeof(__pyx_k_get_wordcount), 0, 0, 1, 1}, {&__pyx_kp_u_get_wordcount_must_be_implemente, __pyx_k_get_wordcount_must_be_implemente, sizeof(__pyx_k_get_wordcount_must_be_implemente), 0, 1, 0, 0}, {&__pyx_n_s_getsize, __pyx_k_getsize, sizeof(__pyx_k_getsize), 0, 0, 1, 1}, {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, {&__pyx_n_s_has_indexdata, __pyx_k_has_indexdata, sizeof(__pyx_k_has_indexdata), 0, 0, 1, 1}, {&__pyx_n_s_hex, __pyx_k_hex, sizeof(__pyx_k_hex), 0, 0, 1, 1}, {&__pyx_n_s_hints, __pyx_k_hints, sizeof(__pyx_k_hints), 0, 0, 1, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_importlib, __pyx_k_importlib, sizeof(__pyx_k_importlib), 0, 0, 1, 1}, {&__pyx_n_s_importlib_abc, __pyx_k_importlib_abc, sizeof(__pyx_k_importlib_abc), 0, 0, 1, 1}, {&__pyx_n_s_indexing, __pyx_k_indexing, sizeof(__pyx_k_indexing), 0, 0, 1, 1}, {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, {&__pyx_n_s_insert, __pyx_k_insert, sizeof(__pyx_k_insert), 0, 0, 1, 1}, {&__pyx_n_u_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 1, 0, 1}, {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1}, {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1}, {&__pyx_n_s_language, __pyx_k_language, sizeof(__pyx_k_language), 0, 0, 1, 1}, {&__pyx_n_s_library, __pyx_k_library, sizeof(__pyx_k_library), 0, 0, 1, 1}, {&__pyx_n_s_libzim, __pyx_k_libzim, sizeof(__pyx_k_libzim), 0, 0, 1, 1}, {&__pyx_n_u_libzim, __pyx_k_libzim, sizeof(__pyx_k_libzim), 0, 1, 0, 1}, {&__pyx_kp_u_libzim_2, __pyx_k_libzim_2, sizeof(__pyx_k_libzim_2), 0, 1, 0, 0}, {&__pyx_kp_s_libzim_libzim_pyx, __pyx_k_libzim_libzim_pyx, sizeof(__pyx_k_libzim_libzim_pyx), 0, 0, 1, 0}, {&__pyx_kp_u_libzim_reader, __pyx_k_libzim_reader, sizeof(__pyx_k_libzim_reader), 0, 1, 0, 0}, {&__pyx_kp_u_libzim_reader_module_Archive_to, __pyx_k_libzim_reader_module_Archive_to, sizeof(__pyx_k_libzim_reader_module_Archive_to), 0, 1, 0, 0}, {&__pyx_kp_u_libzim_search, __pyx_k_libzim_search, sizeof(__pyx_k_libzim_search), 0, 1, 0, 0}, {&__pyx_kp_u_libzim_search_module_Query_to_pr, __pyx_k_libzim_search_module_Query_to_pr, sizeof(__pyx_k_libzim_search_module_Query_to_pr), 0, 1, 0, 0}, {&__pyx_kp_u_libzim_suggestion, __pyx_k_libzim_suggestion, sizeof(__pyx_k_libzim_suggestion), 0, 1, 0, 0}, {&__pyx_kp_u_libzim_suggestion_module_Suggest, __pyx_k_libzim_suggestion_module_Suggest, sizeof(__pyx_k_libzim_suggestion_module_Suggest), 0, 1, 0, 0}, {&__pyx_kp_u_libzim_version, __pyx_k_libzim_version, sizeof(__pyx_k_libzim_version), 0, 1, 0, 0}, {&__pyx_kp_u_libzim_version_module_Get_versio, __pyx_k_libzim_version_module_Get_versio, sizeof(__pyx_k_libzim_version_module_Get_versio), 0, 1, 0, 0}, {&__pyx_kp_u_libzim_writer, __pyx_k_libzim_writer, sizeof(__pyx_k_libzim_writer), 0, 1, 0, 0}, {&__pyx_kp_u_libzim_writer_module_Creator_to, __pyx_k_libzim_writer_module_Creator_to, sizeof(__pyx_k_libzim_writer_module_Creator_to), 0, 1, 0, 0}, {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1}, {&__pyx_n_s_machinery, __pyx_k_machinery, sizeof(__pyx_k_machinery), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_members, __pyx_k_members, sizeof(__pyx_k_members), 0, 0, 1, 1}, {&__pyx_n_s_memoryview, __pyx_k_memoryview, sizeof(__pyx_k_memoryview), 0, 0, 1, 1}, {&__pyx_n_s_meta_path, __pyx_k_meta_path, sizeof(__pyx_k_meta_path), 0, 0, 1, 1}, {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, {&__pyx_n_s_mimetype, __pyx_k_mimetype, sizeof(__pyx_k_mimetype), 0, 0, 1, 1}, {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, {&__pyx_n_s_module_2, __pyx_k_module_2, sizeof(__pyx_k_module_2), 0, 0, 1, 1}, {&__pyx_n_s_modules, __pyx_k_modules, sizeof(__pyx_k_modules), 0, 0, 1, 1}, {&__pyx_n_s_mro, __pyx_k_mro, sizeof(__pyx_k_mro), 0, 0, 1, 1}, {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, {&__pyx_n_s_none, __pyx_k_none, sizeof(__pyx_k_none), 0, 0, 1, 1}, {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1}, {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1}, {&__pyx_n_s_out, __pyx_k_out, sizeof(__pyx_k_out), 0, 0, 1, 1}, {&__pyx_n_s_parent, __pyx_k_parent, sizeof(__pyx_k_parent), 0, 0, 1, 1}, {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1}, {&__pyx_kp_u_path_2, __pyx_k_path_2, sizeof(__pyx_k_path_2), 0, 1, 0, 0}, {&__pyx_n_s_path_3, __pyx_k_path_3, sizeof(__pyx_k_path_3), 0, 0, 1, 1}, {&__pyx_n_s_pathlib, __pyx_k_pathlib, sizeof(__pyx_k_pathlib), 0, 0, 1, 1}, {&__pyx_n_s_prefix, __pyx_k_prefix, sizeof(__pyx_k_prefix), 0, 0, 1, 1}, {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, {&__pyx_n_s_print_versions, __pyx_k_print_versions, sizeof(__pyx_k_print_versions), 0, 0, 1, 1}, {&__pyx_n_s_pybool, __pyx_k_pybool, sizeof(__pyx_k_pybool), 0, 0, 1, 1}, {&__pyx_n_s_pyint, __pyx_k_pyint, sizeof(__pyx_k_pyint), 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_u_rb, __pyx_k_rb, sizeof(__pyx_k_rb), 0, 1, 0, 1}, {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1}, {&__pyx_n_s_reader, __pyx_k_reader, sizeof(__pyx_k_reader), 0, 0, 1, 1}, {&__pyx_n_u_reader, __pyx_k_reader, sizeof(__pyx_k_reader), 0, 1, 0, 1}, {&__pyx_kp_u_reader_2, __pyx_k_reader_2, sizeof(__pyx_k_reader_2), 0, 1, 0, 0}, {&__pyx_n_s_reader_module_doc, __pyx_k_reader_module_doc, sizeof(__pyx_k_reader_module_doc), 0, 0, 1, 1}, {&__pyx_n_s_reader_module_name, __pyx_k_reader_module_name, sizeof(__pyx_k_reader_module_name), 0, 0, 1, 1}, {&__pyx_n_s_reader_public_objects, __pyx_k_reader_public_objects, sizeof(__pyx_k_reader_public_objects), 0, 0, 1, 1}, {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, {&__pyx_n_s_repr, __pyx_k_repr, sizeof(__pyx_k_repr), 0, 0, 1, 1}, {&__pyx_n_s_res, __pyx_k_res, sizeof(__pyx_k_res), 0, 0, 1, 1}, {&__pyx_n_s_resolve, __pyx_k_resolve, sizeof(__pyx_k_resolve), 0, 0, 1, 1}, {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1}, {&__pyx_n_s_search, __pyx_k_search, sizeof(__pyx_k_search), 0, 0, 1, 1}, {&__pyx_n_u_search, __pyx_k_search, sizeof(__pyx_k_search), 0, 1, 0, 1}, {&__pyx_kp_u_search_2, __pyx_k_search_2, sizeof(__pyx_k_search_2), 0, 1, 0, 0}, {&__pyx_n_s_search_module_doc, __pyx_k_search_module_doc, sizeof(__pyx_k_search_module_doc), 0, 0, 1, 1}, {&__pyx_n_s_search_module_name, __pyx_k_search_module_name, sizeof(__pyx_k_search_module_name), 0, 0, 1, 1}, {&__pyx_n_s_search_public_objects, __pyx_k_search_public_objects, sizeof(__pyx_k_search_public_objects), 0, 0, 1, 1}, {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, {&__pyx_kp_s_self_c_blob_cannot_be_converted, __pyx_k_self_c_blob_cannot_be_converted, sizeof(__pyx_k_self_c_blob_cannot_be_converted), 0, 0, 1, 0}, {&__pyx_kp_s_self_c_entry_cannot_be_converted, __pyx_k_self_c_entry_cannot_be_converted, sizeof(__pyx_k_self_c_entry_cannot_be_converted), 0, 0, 1, 0}, {&__pyx_kp_s_self_c_item_cannot_be_converted, __pyx_k_self_c_item_cannot_be_converted, sizeof(__pyx_k_self_c_item_cannot_be_converted), 0, 0, 1, 0}, {&__pyx_kp_s_self_c_query_cannot_be_converted, __pyx_k_self_c_query_cannot_be_converted, sizeof(__pyx_k_self_c_query_cannot_be_converted), 0, 0, 1, 0}, {&__pyx_kp_s_self_c_resultset_cannot_be_conve, __pyx_k_self_c_resultset_cannot_be_conve, sizeof(__pyx_k_self_c_resultset_cannot_be_conve), 0, 0, 1, 0}, {&__pyx_kp_s_self_c_search_cannot_be_converte, __pyx_k_self_c_search_cannot_be_converte, sizeof(__pyx_k_self_c_search_cannot_be_converte), 0, 0, 1, 0}, {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1}, {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1}, {&__pyx_n_s_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 0, 1, 1}, {&__pyx_n_s_stdout, __pyx_k_stdout, sizeof(__pyx_k_stdout), 0, 0, 1, 1}, {&__pyx_n_s_strftime, __pyx_k_strftime, sizeof(__pyx_k_strftime), 0, 0, 1, 1}, {&__pyx_n_s_suggestion, __pyx_k_suggestion, sizeof(__pyx_k_suggestion), 0, 0, 1, 1}, {&__pyx_n_u_suggestion, __pyx_k_suggestion, sizeof(__pyx_k_suggestion), 0, 1, 0, 1}, {&__pyx_kp_u_suggestion_2, __pyx_k_suggestion_2, sizeof(__pyx_k_suggestion_2), 0, 1, 0, 0}, {&__pyx_n_s_suggestion_module_doc, __pyx_k_suggestion_module_doc, sizeof(__pyx_k_suggestion_module_doc), 0, 0, 1, 1}, {&__pyx_n_s_suggestion_module_name, __pyx_k_suggestion_module_name, sizeof(__pyx_k_suggestion_module_name), 0, 0, 1, 1}, {&__pyx_n_s_suggestion_public_objects, __pyx_k_suggestion_public_objects, sizeof(__pyx_k_suggestion_public_objects), 0, 0, 1, 1}, {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1}, {&__pyx_n_s_supports_effective_ids, __pyx_k_supports_effective_ids, sizeof(__pyx_k_supports_effective_ids), 0, 0, 1, 1}, {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, {&__pyx_n_s_target, __pyx_k_target, sizeof(__pyx_k_target), 0, 0, 1, 1}, {&__pyx_n_s_targetPath, __pyx_k_targetPath, sizeof(__pyx_k_targetPath), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__pyx_kp_u_text_plain_charset_UTF_8, __pyx_k_text_plain_charset_UTF_8, sizeof(__pyx_k_text_plain_charset_UTF_8), 0, 1, 0, 0}, {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1}, {&__pyx_n_s_title, __pyx_k_title, sizeof(__pyx_k_title), 0, 0, 1, 1}, {&__pyx_kp_u_title_2, __pyx_k_title_2, sizeof(__pyx_k_title_2), 0, 1, 0, 0}, {&__pyx_n_s_traceback, __pyx_k_traceback, sizeof(__pyx_k_traceback), 0, 0, 1, 1}, {&__pyx_n_s_types, __pyx_k_types, sizeof(__pyx_k_types), 0, 0, 1, 1}, {&__pyx_n_s_typing, __pyx_k_typing, sizeof(__pyx_k_typing), 0, 0, 1, 1}, {&__pyx_n_u_unicode, __pyx_k_unicode, sizeof(__pyx_k_unicode), 0, 1, 0, 1}, {&__pyx_kp_u_url, __pyx_k_url, sizeof(__pyx_k_url), 0, 1, 0, 0}, {&__pyx_n_s_uuid, __pyx_k_uuid, sizeof(__pyx_k_uuid), 0, 0, 1, 1}, {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1}, {&__pyx_n_u_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 1, 0, 1}, {&__pyx_kp_u_version_2, __pyx_k_version_2, sizeof(__pyx_k_version_2), 0, 1, 0, 0}, {&__pyx_n_s_version_module_doc, __pyx_k_version_module_doc, sizeof(__pyx_k_version_module_doc), 0, 0, 1, 1}, {&__pyx_n_s_version_module_name, __pyx_k_version_module_name, sizeof(__pyx_k_version_module_name), 0, 0, 1, 1}, {&__pyx_n_s_version_public_objects, __pyx_k_version_public_objects, sizeof(__pyx_k_version_public_objects), 0, 0, 1, 1}, {&__pyx_n_s_versions, __pyx_k_versions, sizeof(__pyx_k_versions), 0, 0, 1, 1}, {&__pyx_n_s_writer, __pyx_k_writer, sizeof(__pyx_k_writer), 0, 0, 1, 1}, {&__pyx_n_u_writer, __pyx_k_writer, sizeof(__pyx_k_writer), 0, 1, 0, 1}, {&__pyx_kp_u_writer_2, __pyx_k_writer_2, sizeof(__pyx_k_writer_2), 0, 1, 0, 0}, {&__pyx_n_s_writer_module_doc, __pyx_k_writer_module_doc, sizeof(__pyx_k_writer_module_doc), 0, 0, 1, 1}, {&__pyx_n_s_writer_module_name, __pyx_k_writer_module_name, sizeof(__pyx_k_writer_module_name), 0, 0, 1, 1}, {&__pyx_n_s_writer_public_objects, __pyx_k_writer_public_objects, sizeof(__pyx_k_writer_public_objects), 0, 0, 1, 1}, {&__pyx_n_s_zstd, __pyx_k_zstd, sizeof(__pyx_k_zstd), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 1283, __pyx_L1_error) __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 111, __pyx_L1_error) __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) __PYX_ERR(0, 263, __pyx_L1_error) __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 422, __pyx_L1_error) __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 436, __pyx_L1_error) __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 450, __pyx_L1_error) __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(0, 473, __pyx_L1_error) __pyx_builtin_BufferError = __Pyx_GetBuiltinName(__pyx_n_s_BufferError); if (!__pyx_builtin_BufferError) __PYX_ERR(0, 638, __pyx_L1_error) __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 840, __pyx_L1_error) __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 1257, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "libzim.pyx":111 * blob = call_method(obj, method) * if blob is None: * raise RuntimeError("Blob is none") # <<<<<<<<<<<<<< * return move(blob.c_blob) * except Exception as e: */ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Blob_is_none); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); /* "libzim.pyx":123 * contentProvider = call_method(obj, method) * if not contentProvider: * raise RuntimeError("ContentProvider is None") # <<<<<<<<<<<<<< * return new zim.ContentProviderWrapper(contentProvider) * except Exception as e: */ __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_ContentProvider_is_None); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5); /* "libzim.pyx":277 * """Set creator verbosity (inside libzim). Default is off""" * if self._started: * raise RuntimeError("Creator started") # <<<<<<<<<<<<<< * self.c_creator.configVerbose(verbose) * return self */ __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Creator_started); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 277, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); /* "libzim.pyx":352 * If the ZimCreator was already finalized""" * if not self._started: * raise RuntimeError("Creator not started") # <<<<<<<<<<<<<< * * # Make a shared pointer to ZimArticleWrapper from the ZimArticle object */ __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Creator_not_started); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); /* "libzim.pyx":422 * def get_size(self) -> pyint: * """Size of get_data's result in bytes""" * raise NotImplementedError("get_size must be implemented.") # <<<<<<<<<<<<<< * * def feed(self) -> WritingBlob: */ __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_u_get_size_must_be_implemented); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 422, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); /* "libzim.pyx":437 * self._blob = next(self.generator) * except StopIteration: * self._blob = WritingBlob("") # <<<<<<<<<<<<<< * * return self._blob */ __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_u_); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); /* "libzim.pyx":443 * def gen_blob(self) -> Generator[WritingBlob, None, None]: * """Generator yielding blobs for the content of the article""" * raise NotImplementedError("gen_blob (ro feed) must be implemented") # <<<<<<<<<<<<<< * * */ __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_u_gen_blob_ro_feed_must_be_impleme); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 443, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); /* "libzim.pyx":473 * def gen_blob(self) -> Generator[WritingBlob, None, None]: * bsize = 1048576 # 1MiB chunk * with open(self.filepath, "rb") as fh: # <<<<<<<<<<<<<< * res = fh.read(bsize) * while res: */ __pyx_tuple__15 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); /* "libzim.pyx":491 * def get_title(self) -> str: * """Title to index. Might be the same as Item.get_title or not""" * raise NotImplementedError("get_title must be implemented.") # <<<<<<<<<<<<<< * * def get_content(self) -> str: */ __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_u_get_title_must_be_implemented); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__16); __Pyx_GIVEREF(__pyx_tuple__16); /* "libzim.pyx":495 * def get_content(self) -> str: * """Content to index. Might be the same as Item.get_title or not""" * raise NotImplementedError("get_content must be implemented.") # <<<<<<<<<<<<<< * * def get_keywords(self) -> str: */ __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_u_get_content_must_be_implemented); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); /* "libzim.pyx":501 * * Must be a string containing keywords separated by a space""" * raise NotImplementedError("get_keywords must be implemented.") # <<<<<<<<<<<<<< * * def get_wordcount(self) -> int: */ __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_u_get_keywords_must_be_implemented); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 501, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__18); __Pyx_GIVEREF(__pyx_tuple__18); /* "libzim.pyx":505 * def get_wordcount(self) -> int: * """Number of word in content""" * raise NotImplementedError("get_wordcount must be implemented.") # <<<<<<<<<<<<<< * * def get_geoposition(self) -> Optional[Tuple[float, float]]: */ __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_u_get_wordcount_must_be_implemente); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 505, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__19); __Pyx_GIVEREF(__pyx_tuple__19); /* "libzim.pyx":525 * def get_path(self) -> str: * """Full path of item""" * raise NotImplementedError("get_path must be implemented.") # <<<<<<<<<<<<<< * * def get_title(self) -> str: */ __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_u_get_path_must_be_implemented); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 525, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__20); __Pyx_GIVEREF(__pyx_tuple__20); /* "libzim.pyx":533 * def get_mimetype(self) -> str: * """MIME-type of the item's content.""" * raise NotImplementedError("get_mimetype must be implemented.") # <<<<<<<<<<<<<< * * def get_contentprovider(self) -> ContentProvider: */ __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_u_get_mimetype_must_be_implemented); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 533, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); /* "libzim.pyx":537 * def get_contentprovider(self) -> ContentProvider: * """ContentProvider containing the complete content of the item""" * raise NotImplementedError("get_contentprovider must be implemented.") # <<<<<<<<<<<<<< * * def get_hints(self) -> Dict[Hint, pyint]: */ __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_u_get_contentprovider_must_be_impl); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__22); __Pyx_GIVEREF(__pyx_tuple__22); /* "libzim.pyx":541 * def get_hints(self) -> Dict[Hint, pyint]: * """Dict of Hint: value informing Creator how to handle this item""" * raise NotImplementedError("get_hints must be implemented.") # <<<<<<<<<<<<<< * * def __repr__(self) -> str: */ __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_u_get_hints_must_be_implemented); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__23); __Pyx_GIVEREF(__pyx_tuple__23); /* "libzim.pyx":634 * def __dealloc__(self): * if self.view_count: * raise RuntimeError("Blob has views") # <<<<<<<<<<<<<< * * def __getbuffer__(self, Py_buffer *buffer, int flags): */ __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_u_Blob_has_views); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__25); __Pyx_GIVEREF(__pyx_tuple__25); /* "libzim.pyx":638 * def __getbuffer__(self, Py_buffer *buffer, int flags): * if flags&PyBUF_WRITABLE: * raise BufferError("Cannot create writable memoryview on readonly data") # <<<<<<<<<<<<<< * buffer.obj = self * buffer.buf = self.c_blob.data() */ __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_u_Cannot_create_writable_memoryvie); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 638, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__26); __Pyx_GIVEREF(__pyx_tuple__26); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("self.c_blob cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_blob cannot be converted to a Python object for pickling") */ __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_self_c_blob_cannot_be_converted); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__27); __Pyx_GIVEREF(__pyx_tuple__27); /* "(tree fragment)":4 * raise TypeError("self.c_blob cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_blob cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_self_c_blob_cannot_be_converted); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__28); __Pyx_GIVEREF(__pyx_tuple__28); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("self.c_entry cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_entry cannot be converted to a Python object for pickling") */ __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_self_c_entry_cannot_be_converted); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__29); __Pyx_GIVEREF(__pyx_tuple__29); /* "(tree fragment)":4 * raise TypeError("self.c_entry cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_entry cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_self_c_entry_cannot_be_converted); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__30); __Pyx_GIVEREF(__pyx_tuple__30); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("self.c_item cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_item cannot be converted to a Python object for pickling") */ __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_self_c_item_cannot_be_converted); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__31); __Pyx_GIVEREF(__pyx_tuple__31); /* "(tree fragment)":4 * raise TypeError("self.c_item cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_item cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_self_c_item_cannot_be_converted); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__32); __Pyx_GIVEREF(__pyx_tuple__32); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__33); __Pyx_GIVEREF(__pyx_tuple__33); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__34); __Pyx_GIVEREF(__pyx_tuple__34); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("self.c_query cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_query cannot be converted to a Python object for pickling") */ __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_self_c_query_cannot_be_converted); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__35); __Pyx_GIVEREF(__pyx_tuple__35); /* "(tree fragment)":4 * raise TypeError("self.c_query cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_query cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_self_c_query_cannot_be_converted); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__36); __Pyx_GIVEREF(__pyx_tuple__36); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") */ __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s_self_c_resultset_cannot_be_conve); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__37); __Pyx_GIVEREF(__pyx_tuple__37); /* "(tree fragment)":4 * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s_self_c_resultset_cannot_be_conve); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__38); __Pyx_GIVEREF(__pyx_tuple__38); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("self.c_search cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_search cannot be converted to a Python object for pickling") */ __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_s_self_c_search_cannot_be_converte); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__39); __Pyx_GIVEREF(__pyx_tuple__39); /* "(tree fragment)":4 * raise TypeError("self.c_search cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_search cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ __pyx_tuple__40 = PyTuple_Pack(1, __pyx_kp_s_self_c_search_cannot_be_converte); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__40); __Pyx_GIVEREF(__pyx_tuple__40); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ __pyx_tuple__41 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__41); __Pyx_GIVEREF(__pyx_tuple__41); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__42); __Pyx_GIVEREF(__pyx_tuple__42); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") */ __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_s_self_c_resultset_cannot_be_conve); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__43); __Pyx_GIVEREF(__pyx_tuple__43); /* "(tree fragment)":4 * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_resultset cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_self_c_resultset_cannot_be_conve); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__44); __Pyx_GIVEREF(__pyx_tuple__44); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("self.c_search cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_search cannot be converted to a Python object for pickling") */ __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_self_c_search_cannot_be_converte); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__45); __Pyx_GIVEREF(__pyx_tuple__45); /* "(tree fragment)":4 * raise TypeError("self.c_search cannot be converted to a Python object for pickling") * def __setstate_cython__(self, __pyx_state): * raise TypeError("self.c_search cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<< */ __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_s_self_c_search_cannot_be_converte); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__46); __Pyx_GIVEREF(__pyx_tuple__46); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ __pyx_tuple__47 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(1, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__47); __Pyx_GIVEREF(__pyx_tuple__47); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ __pyx_tuple__48 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(1, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__48); __Pyx_GIVEREF(__pyx_tuple__48); /* "libzim.pyx":62 * pyint = type(1) * * def create_module(name, doc, members): # <<<<<<<<<<<<<< * """Create/define a module for name and docstring, populated by members""" * module = ModuleType(name, doc) */ __pyx_tuple__52 = PyTuple_Pack(6, __pyx_n_s_name, __pyx_n_s_doc, __pyx_n_s_members, __pyx_n_s_module, __pyx_n_s_all_2, __pyx_n_s_obj); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__52); __Pyx_GIVEREF(__pyx_tuple__52); __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_create_module, 62, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 62, __pyx_L1_error) /* "libzim.pyx":417 * class ContentProvider: * __module__ = writer_module_name * def __init__(self): # <<<<<<<<<<<<<< * self.generator = None * */ __pyx_tuple__54 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 417, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__54); __Pyx_GIVEREF(__pyx_tuple__54); __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_init, 417, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 417, __pyx_L1_error) /* "libzim.pyx":420 * self.generator = None * * def get_size(self) -> pyint: # <<<<<<<<<<<<<< * """Size of get_data's result in bytes""" * raise NotImplementedError("get_size must be implemented.") */ __pyx_tuple__56 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 420, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__56); __Pyx_GIVEREF(__pyx_tuple__56); __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_get_size, 420, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 420, __pyx_L1_error) /* "libzim.pyx":424 * raise NotImplementedError("get_size must be implemented.") * * def feed(self) -> WritingBlob: # <<<<<<<<<<<<<< * """Blob(s) containing the complete content of the article. * Must return an empty blob to tell writer no more content has to be written. */ __pyx_tuple__58 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__58); __Pyx_GIVEREF(__pyx_tuple__58); __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_feed, 424, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 424, __pyx_L1_error) /* "libzim.pyx":441 * return self._blob * * def gen_blob(self) -> Generator[WritingBlob, None, None]: # <<<<<<<<<<<<<< * """Generator yielding blobs for the content of the article""" * raise NotImplementedError("gen_blob (ro feed) must be implemented") */ __pyx_tuple__60 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__60); __Pyx_GIVEREF(__pyx_tuple__60); __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_gen_blob, 441, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 441, __pyx_L1_error) /* "libzim.pyx":449 * """ContentProvider for a single encoded-or-not UTF-8 string""" * __module__ = writer_module_name * def __init__(self, content: Union[str, bytes]): # <<<<<<<<<<<<<< * super().__init__() * self.content = content.encode("UTF-8") if isinstance(content, str) else content */ __pyx_tuple__62 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_content); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__62); __Pyx_GIVEREF(__pyx_tuple__62); __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_init, 449, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 449, __pyx_L1_error) /* "libzim.pyx":453 * self.content = content.encode("UTF-8") if isinstance(content, str) else content * * def get_size(self) -> pyint: # <<<<<<<<<<<<<< * return len(self.content) * */ __pyx_tuple__64 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__64); __Pyx_GIVEREF(__pyx_tuple__64); __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_get_size, 453, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 453, __pyx_L1_error) /* "libzim.pyx":456 * return len(self.content) * * def gen_blob(self) -> Generator[WritingBlob, None, None]: # <<<<<<<<<<<<<< * yield WritingBlob(self.content) * */ __pyx_tuple__66 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__66); __Pyx_GIVEREF(__pyx_tuple__66); __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_gen_blob, 456, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 456, __pyx_L1_error) /* "libzim.pyx":463 * """ContentProvider for a file using its local path""" * __module__ = writer_module_name * def __init__(self, filepath: Union[pathlib.Path, str]): # <<<<<<<<<<<<<< * super().__init__() * self.filepath = filepath */ __pyx_tuple__67 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_filepath); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 463, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__67); __Pyx_GIVEREF(__pyx_tuple__67); __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_init, 463, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(0, 463, __pyx_L1_error) /* "libzim.pyx":468 * self.size = os.path.getsize(self.filepath) * * def get_size(self) -> pyint: # <<<<<<<<<<<<<< * return self.size * */ __pyx_tuple__69 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(0, 468, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__69); __Pyx_GIVEREF(__pyx_tuple__69); __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_get_size, 468, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(0, 468, __pyx_L1_error) /* "libzim.pyx":471 * return self.size * * def gen_blob(self) -> Generator[WritingBlob, None, None]: # <<<<<<<<<<<<<< * bsize = 1048576 # 1MiB chunk * with open(self.filepath, "rb") as fh: */ __pyx_tuple__71 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_bsize, __pyx_n_s_fh, __pyx_n_s_res); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(0, 471, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__71); __Pyx_GIVEREF(__pyx_tuple__71); __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_gen_blob, 471, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 471, __pyx_L1_error) /* "libzim.pyx":485 * __module__ = writer_module_name * * def has_indexdata(self) -> bool: # <<<<<<<<<<<<<< * """Return true if the IndexData actually contains data""" * return False */ __pyx_tuple__72 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 485, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__72); __Pyx_GIVEREF(__pyx_tuple__72); __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_has_indexdata, 485, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 485, __pyx_L1_error) /* "libzim.pyx":489 * return False * * def get_title(self) -> str: # <<<<<<<<<<<<<< * """Title to index. Might be the same as Item.get_title or not""" * raise NotImplementedError("get_title must be implemented.") */ __pyx_tuple__74 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 489, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__74); __Pyx_GIVEREF(__pyx_tuple__74); __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_get_title, 489, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 489, __pyx_L1_error) /* "libzim.pyx":493 * raise NotImplementedError("get_title must be implemented.") * * def get_content(self) -> str: # <<<<<<<<<<<<<< * """Content to index. Might be the same as Item.get_title or not""" * raise NotImplementedError("get_content must be implemented.") */ __pyx_tuple__76 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__76); __Pyx_GIVEREF(__pyx_tuple__76); __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_get_content, 493, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(0, 493, __pyx_L1_error) /* "libzim.pyx":497 * raise NotImplementedError("get_content must be implemented.") * * def get_keywords(self) -> str: # <<<<<<<<<<<<<< * """Keywords used to index the item. * */ __pyx_tuple__78 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(0, 497, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__78); __Pyx_GIVEREF(__pyx_tuple__78); __pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_get_keywords, 497, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(0, 497, __pyx_L1_error) /* "libzim.pyx":503 * raise NotImplementedError("get_keywords must be implemented.") * * def get_wordcount(self) -> int: # <<<<<<<<<<<<<< * """Number of word in content""" * raise NotImplementedError("get_wordcount must be implemented.") */ __pyx_tuple__80 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(0, 503, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__80); __Pyx_GIVEREF(__pyx_tuple__80); __pyx_codeobj__81 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__80, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_get_wordcount, 503, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__81)) __PYX_ERR(0, 503, __pyx_L1_error) /* "libzim.pyx":507 * raise NotImplementedError("get_wordcount must be implemented.") * * def get_geoposition(self) -> Optional[Tuple[float, float]]: # <<<<<<<<<<<<<< * """GeoPosition used to index the item. * */ __pyx_tuple__82 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__82); __Pyx_GIVEREF(__pyx_tuple__82); __pyx_codeobj__83 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__82, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_get_geoposition, 507, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__83)) __PYX_ERR(0, 507, __pyx_L1_error) /* "libzim.pyx":520 * __module__ = writer_module_name * * def __init__(self): # <<<<<<<<<<<<<< * self._blob = None * */ __pyx_tuple__84 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(0, 520, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__84); __Pyx_GIVEREF(__pyx_tuple__84); __pyx_codeobj__85 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__84, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_init, 520, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__85)) __PYX_ERR(0, 520, __pyx_L1_error) /* "libzim.pyx":523 * self._blob = None * * def get_path(self) -> str: # <<<<<<<<<<<<<< * """Full path of item""" * raise NotImplementedError("get_path must be implemented.") */ __pyx_tuple__86 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__86); __Pyx_GIVEREF(__pyx_tuple__86); __pyx_codeobj__87 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__86, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_get_path, 523, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__87)) __PYX_ERR(0, 523, __pyx_L1_error) /* "libzim.pyx":527 * raise NotImplementedError("get_path must be implemented.") * * def get_title(self) -> str: # <<<<<<<<<<<<<< * """Item title. Might be indexed and used in suggestions""" * raise NotImplementedError("get_title must be implemented.") */ __pyx_tuple__88 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 527, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__88); __Pyx_GIVEREF(__pyx_tuple__88); __pyx_codeobj__89 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__88, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_get_title, 527, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__89)) __PYX_ERR(0, 527, __pyx_L1_error) /* "libzim.pyx":531 * raise NotImplementedError("get_title must be implemented.") * * def get_mimetype(self) -> str: # <<<<<<<<<<<<<< * """MIME-type of the item's content.""" * raise NotImplementedError("get_mimetype must be implemented.") */ __pyx_tuple__90 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__90)) __PYX_ERR(0, 531, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__90); __Pyx_GIVEREF(__pyx_tuple__90); __pyx_codeobj__91 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__90, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_get_mimetype, 531, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__91)) __PYX_ERR(0, 531, __pyx_L1_error) /* "libzim.pyx":535 * raise NotImplementedError("get_mimetype must be implemented.") * * def get_contentprovider(self) -> ContentProvider: # <<<<<<<<<<<<<< * """ContentProvider containing the complete content of the item""" * raise NotImplementedError("get_contentprovider must be implemented.") */ __pyx_tuple__92 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(0, 535, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__92); __Pyx_GIVEREF(__pyx_tuple__92); __pyx_codeobj__93 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__92, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_get_contentprovider, 535, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__93)) __PYX_ERR(0, 535, __pyx_L1_error) /* "libzim.pyx":539 * raise NotImplementedError("get_contentprovider must be implemented.") * * def get_hints(self) -> Dict[Hint, pyint]: # <<<<<<<<<<<<<< * """Dict of Hint: value informing Creator how to handle this item""" * raise NotImplementedError("get_hints must be implemented.") */ __pyx_tuple__94 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__94); __Pyx_GIVEREF(__pyx_tuple__94); __pyx_codeobj__95 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__94, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_get_hints, 539, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__95)) __PYX_ERR(0, 539, __pyx_L1_error) /* "libzim.pyx":543 * raise NotImplementedError("get_hints must be implemented.") * * def __repr__(self) -> str: # <<<<<<<<<<<<<< * return ( * f"{self.__class__.__name__}(path={self.get_path()}, " */ __pyx_tuple__96 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__96); __Pyx_GIVEREF(__pyx_tuple__96); __pyx_codeobj__97 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__96, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_repr, 543, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__97)) __PYX_ERR(0, 543, __pyx_L1_error) /* "libzim.pyx":552 * class Creator(_Creator): * __module__ = writer_module_name * def config_compression(self, compression: Compression): # <<<<<<<<<<<<<< * if not isinstance(compression, Compression): * compression = getattr(Compression, compression.lower()) */ __pyx_tuple__98 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_compression); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__98); __Pyx_GIVEREF(__pyx_tuple__98); __pyx_codeobj__99 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__98, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_config_compression, 552, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__99)) __PYX_ERR(0, 552, __pyx_L1_error) /* "libzim.pyx":557 * return super().config_compression(compression) * * def add_metadata( # <<<<<<<<<<<<<< * self, name: str, content: Union[str, bytes, datetime.date, datetime.datetime], * mimetype: str = "text/plain;charset=UTF-8" */ __pyx_tuple__100 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_name, __pyx_n_s_content, __pyx_n_s_mimetype); if (unlikely(!__pyx_tuple__100)) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__100); __Pyx_GIVEREF(__pyx_tuple__100); __pyx_codeobj__101 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__100, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_add_metadata, 557, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__101)) __PYX_ERR(0, 557, __pyx_L1_error) __pyx_tuple__102 = PyTuple_Pack(1, ((PyObject*)__pyx_kp_u_text_plain_charset_UTF_8)); if (unlikely(!__pyx_tuple__102)) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__102); __Pyx_GIVEREF(__pyx_tuple__102); /* "libzim.pyx":567 * super().add_metadata(name=name, content=content, mimetype=mimetype) * * def __repr__(self) -> str: # <<<<<<<<<<<<<< * return f"Creator(filename={self.filename})" * */ __pyx_tuple__103 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(0, 567, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__103); __Pyx_GIVEREF(__pyx_tuple__103); __pyx_codeobj__104 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__103, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_repr, 567, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__104)) __PYX_ERR(0, 567, __pyx_L1_error) /* "libzim.pyx":1253 * * * def print_versions(out: Union[sys.stdout, sys.stderr] = sys.stdout): # <<<<<<<<<<<<<< * """print libzim and its dependencies list with their versions""" * for library, version in get_versions().items(): */ __pyx_tuple__105 = PyTuple_Pack(4, __pyx_n_s_out, __pyx_n_s_library, __pyx_n_s_version, __pyx_n_s_prefix); if (unlikely(!__pyx_tuple__105)) __PYX_ERR(0, 1253, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__105); __Pyx_GIVEREF(__pyx_tuple__105); __pyx_codeobj__106 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__105, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_print_versions, 1253, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__106)) __PYX_ERR(0, 1253, __pyx_L1_error) /* "libzim.pyx":1260 * * * def get_versions() -> OrderedDict[str, str]: # <<<<<<<<<<<<<< * """ library: version mapping. Always includes `libzim`""" * versions = zim.getVersions() */ __pyx_tuple__107 = PyTuple_Pack(3, __pyx_n_s_versions, __pyx_n_s_library, __pyx_n_s_version); if (unlikely(!__pyx_tuple__107)) __PYX_ERR(0, 1260, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__107); __Pyx_GIVEREF(__pyx_tuple__107); __pyx_codeobj__108 = (PyObject*)__Pyx_PyCode_New(0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__107, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_get_versions, 1260, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__108)) __PYX_ERR(0, 1260, __pyx_L1_error) /* "libzim.pyx":1268 * }) * * def get_libzim_version() -> str: # <<<<<<<<<<<<<< * """libzim version string""" * return get_versions()["libzim"] */ __pyx_codeobj__109 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_get_libzim_version, 1268, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__109)) __PYX_ERR(0, 1268, __pyx_L1_error) /* "libzim.pyx":1284 * # Create our module. Easy, just return the created module * @staticmethod * def create_module(spec): # <<<<<<<<<<<<<< * return { * 'libzim.writer': writer, */ __pyx_tuple__110 = PyTuple_Pack(1, __pyx_n_s_spec); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(0, 1284, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__110); __Pyx_GIVEREF(__pyx_tuple__110); __pyx_codeobj__111 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__110, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_create_module, 1284, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__111)) __PYX_ERR(0, 1284, __pyx_L1_error) /* "libzim.pyx":1294 * * @staticmethod * def exec_module(module): # <<<<<<<<<<<<<< * # Nothing to execute for our already existing module. * # But we need to define exec_module to tell python not use the legacy import system. */ __pyx_tuple__112 = PyTuple_Pack(1, __pyx_n_s_module); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(0, 1294, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__112); __Pyx_GIVEREF(__pyx_tuple__112); __pyx_codeobj__113 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__112, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_exec_module, 1294, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__113)) __PYX_ERR(0, 1294, __pyx_L1_error) /* "libzim.pyx":1300 * * class ModuleFinder(importlib.abc.MetaPathFinder): * def find_spec(self, fullname, path, target=None): # <<<<<<<<<<<<<< * if fullname.startswith("libzim."): * return importlib.machinery.ModuleSpec(fullname, ModuleLoader) */ __pyx_tuple__114 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_fullname, __pyx_n_s_path, __pyx_n_s_target); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(0, 1300, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__114); __Pyx_GIVEREF(__pyx_tuple__114); __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__114, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_libzim_libzim_pyx, __pyx_n_s_find_spec, 1300, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) __PYX_ERR(0, 1300, __pyx_L1_error) __pyx_tuple__116 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__116)) __PYX_ERR(0, 1300, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__116); __Pyx_GIVEREF(__pyx_tuple__116); __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type; 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) return 0; __pyx_L1_error:; return -1; } static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ static int __Pyx_modinit_global_init_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); /*--- Global init code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_variable_export_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); /*--- Variable export code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_function_export_code(void) { __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); /*--- Function export code ---*/ if (__Pyx_ExportFunction("obj_has_attribute", (void (*)(void))obj_has_attribute, "bool (PyObject *, std::string)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("string_cy_call_fct", (void (*)(void))string_cy_call_fct, "std::string (PyObject *, std::string, std::string *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("blob_cy_call_fct", (void (*)(void))blob_cy_call_fct, "wrapper::Blob (PyObject *, std::string, std::string *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("contentprovider_cy_call_fct", (void (*)(void))contentprovider_cy_call_fct, "zim::writer::ContentProvider *(PyObject *, std::string, std::string *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("indexdata_cy_call_fct", (void (*)(void))indexdata_cy_call_fct, "zim::writer::IndexData *(PyObject *, std::string, std::string *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("bool_cy_call_fct", (void (*)(void))bool_cy_call_fct, "bool (PyObject *, std::string, std::string *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("uint64_cy_call_fct", (void (*)(void))uint64_cy_call_fct, "uint64_t (PyObject *, std::string, std::string *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("uint32_cy_call_fct", (void (*)(void))uint32_cy_call_fct, "uint32_t (PyObject *, std::string, std::string *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("geoposition_cy_call_fct", (void (*)(void))geoposition_cy_call_fct, "zim::writer::IndexData::GeoPosition (PyObject *, std::string, std::string *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("convertToCppHints", (void (*)(void))convertToCppHints, "std::map (PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_ExportFunction("hints_cy_call_fct", (void (*)(void))hints_cy_call_fct, "std::map (PyObject *, std::string, std::string *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_modinit_type_init_code(void) { __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ if (PyType_Ready(&__pyx_type_6libzim_WritingBlob) < 0) __PYX_ERR(0, 207, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6libzim_WritingBlob.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6libzim_WritingBlob.tp_dictoffset && __pyx_type_6libzim_WritingBlob.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6libzim_WritingBlob.tp_getattro = __Pyx_PyObject_GenericGetAttr; } if (PyObject_SetAttr(__pyx_m, __pyx_n_s_WritingBlob, (PyObject *)&__pyx_type_6libzim_WritingBlob) < 0) __PYX_ERR(0, 207, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6libzim_WritingBlob) < 0) __PYX_ERR(0, 207, __pyx_L1_error) __pyx_ptype_6libzim_WritingBlob = &__pyx_type_6libzim_WritingBlob; if (PyType_Ready(&__pyx_type_6libzim__Creator) < 0) __PYX_ERR(0, 240, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6libzim__Creator.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6libzim__Creator.tp_dictoffset && __pyx_type_6libzim__Creator.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6libzim__Creator.tp_getattro = __Pyx_PyObject_GenericGetAttr; } #if CYTHON_UPDATE_DESCRIPTOR_DOC { PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6libzim__Creator, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 240, __pyx_L1_error) if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { __pyx_wrapperbase_6libzim_8_Creator_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_6libzim_8_Creator_2__init__.doc = __pyx_doc_6libzim_8_Creator_2__init__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6libzim_8_Creator_2__init__; } } #endif if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Creator, (PyObject *)&__pyx_type_6libzim__Creator) < 0) __PYX_ERR(0, 240, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6libzim__Creator) < 0) __PYX_ERR(0, 240, __pyx_L1_error) __pyx_ptype_6libzim__Creator = &__pyx_type_6libzim__Creator; __pyx_vtabptr_6libzim_ReadingBlob = &__pyx_vtable_6libzim_ReadingBlob; __pyx_vtable_6libzim_ReadingBlob.from_blob = (PyObject *(*)(wrapper::Blob))__pyx_f_6libzim_11ReadingBlob_from_blob; if (PyType_Ready(&__pyx_type_6libzim_ReadingBlob) < 0) __PYX_ERR(0, 607, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6libzim_ReadingBlob.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6libzim_ReadingBlob.tp_dictoffset && __pyx_type_6libzim_ReadingBlob.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6libzim_ReadingBlob.tp_getattro = __Pyx_PyObject_GenericGetAttr; } if (__Pyx_SetVtable(__pyx_type_6libzim_ReadingBlob.tp_dict, __pyx_vtabptr_6libzim_ReadingBlob) < 0) __PYX_ERR(0, 607, __pyx_L1_error) if (PyObject_SetAttr(__pyx_m, __pyx_n_s_ReadingBlob, (PyObject *)&__pyx_type_6libzim_ReadingBlob) < 0) __PYX_ERR(0, 607, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6libzim_ReadingBlob) < 0) __PYX_ERR(0, 607, __pyx_L1_error) __pyx_ptype_6libzim_ReadingBlob = &__pyx_type_6libzim_ReadingBlob; __pyx_vtabptr_6libzim_Entry = &__pyx_vtable_6libzim_Entry; __pyx_vtable_6libzim_Entry.from_entry = (PyObject *(*)(wrapper::Entry))__pyx_f_6libzim_5Entry_from_entry; if (PyType_Ready(&__pyx_type_6libzim_Entry) < 0) __PYX_ERR(0, 657, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6libzim_Entry.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6libzim_Entry.tp_dictoffset && __pyx_type_6libzim_Entry.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6libzim_Entry.tp_getattro = __Pyx_PyObject_GenericGetAttr; } if (__Pyx_SetVtable(__pyx_type_6libzim_Entry.tp_dict, __pyx_vtabptr_6libzim_Entry) < 0) __PYX_ERR(0, 657, __pyx_L1_error) if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Entry, (PyObject *)&__pyx_type_6libzim_Entry) < 0) __PYX_ERR(0, 657, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6libzim_Entry) < 0) __PYX_ERR(0, 657, __pyx_L1_error) __pyx_ptype_6libzim_Entry = &__pyx_type_6libzim_Entry; __pyx_vtabptr_6libzim_Item = &__pyx_vtable_6libzim_Item; __pyx_vtable_6libzim_Item.from_item = (PyObject *(*)(wrapper::Item))__pyx_f_6libzim_4Item_from_item; if (PyType_Ready(&__pyx_type_6libzim_Item) < 0) __PYX_ERR(0, 714, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6libzim_Item.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6libzim_Item.tp_dictoffset && __pyx_type_6libzim_Item.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6libzim_Item.tp_getattro = __Pyx_PyObject_GenericGetAttr; } if (__Pyx_SetVtable(__pyx_type_6libzim_Item.tp_dict, __pyx_vtabptr_6libzim_Item) < 0) __PYX_ERR(0, 714, __pyx_L1_error) if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Item, (PyObject *)&__pyx_type_6libzim_Item) < 0) __PYX_ERR(0, 714, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6libzim_Item) < 0) __PYX_ERR(0, 714, __pyx_L1_error) __pyx_ptype_6libzim_Item = &__pyx_type_6libzim_Item; if (PyType_Ready(&__pyx_type_6libzim_Archive) < 0) __PYX_ERR(0, 775, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6libzim_Archive.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6libzim_Archive.tp_dictoffset && __pyx_type_6libzim_Archive.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6libzim_Archive.tp_getattro = __Pyx_PyObject_GenericGetAttr; } if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Archive, (PyObject *)&__pyx_type_6libzim_Archive) < 0) __PYX_ERR(0, 775, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6libzim_Archive) < 0) __PYX_ERR(0, 775, __pyx_L1_error) __pyx_ptype_6libzim_Archive = &__pyx_type_6libzim_Archive; if (PyType_Ready(&__pyx_type_6libzim_Query) < 0) __PYX_ERR(0, 1037, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6libzim_Query.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6libzim_Query.tp_dictoffset && __pyx_type_6libzim_Query.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6libzim_Query.tp_getattro = __Pyx_PyObject_GenericGetAttr; } if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Query, (PyObject *)&__pyx_type_6libzim_Query) < 0) __PYX_ERR(0, 1037, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6libzim_Query) < 0) __PYX_ERR(0, 1037, __pyx_L1_error) __pyx_ptype_6libzim_Query = &__pyx_type_6libzim_Query; __pyx_vtabptr_6libzim_SearchResultSet = &__pyx_vtable_6libzim_SearchResultSet; __pyx_vtable_6libzim_SearchResultSet.from_resultset = (PyObject *(*)(wrapper::SearchResultSet))__pyx_f_6libzim_15SearchResultSet_from_resultset; if (PyType_Ready(&__pyx_type_6libzim_SearchResultSet) < 0) __PYX_ERR(0, 1047, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6libzim_SearchResultSet.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6libzim_SearchResultSet.tp_dictoffset && __pyx_type_6libzim_SearchResultSet.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6libzim_SearchResultSet.tp_getattro = __Pyx_PyObject_GenericGetAttr; } #if CYTHON_UPDATE_DESCRIPTOR_DOC { PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6libzim_SearchResultSet, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(0, 1047, __pyx_L1_error) if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { __pyx_wrapperbase_6libzim_15SearchResultSet___iter__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_6libzim_15SearchResultSet___iter__.doc = __pyx_doc_6libzim_15SearchResultSet___iter__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6libzim_15SearchResultSet___iter__; } } #endif if (__Pyx_SetVtable(__pyx_type_6libzim_SearchResultSet.tp_dict, __pyx_vtabptr_6libzim_SearchResultSet) < 0) __PYX_ERR(0, 1047, __pyx_L1_error) if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SearchResultSet, (PyObject *)&__pyx_type_6libzim_SearchResultSet) < 0) __PYX_ERR(0, 1047, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6libzim_SearchResultSet) < 0) __PYX_ERR(0, 1047, __pyx_L1_error) __pyx_ptype_6libzim_SearchResultSet = &__pyx_type_6libzim_SearchResultSet; __pyx_vtabptr_6libzim_Search = &__pyx_vtable_6libzim_Search; __pyx_vtable_6libzim_Search.from_search = (PyObject *(*)(wrapper::Search))__pyx_f_6libzim_6Search_from_search; if (PyType_Ready(&__pyx_type_6libzim_Search) < 0) __PYX_ERR(0, 1066, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6libzim_Search.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6libzim_Search.tp_dictoffset && __pyx_type_6libzim_Search.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6libzim_Search.tp_getattro = __Pyx_PyObject_GenericGetAttr; } if (__Pyx_SetVtable(__pyx_type_6libzim_Search.tp_dict, __pyx_vtabptr_6libzim_Search) < 0) __PYX_ERR(0, 1066, __pyx_L1_error) if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Search, (PyObject *)&__pyx_type_6libzim_Search) < 0) __PYX_ERR(0, 1066, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6libzim_Search) < 0) __PYX_ERR(0, 1066, __pyx_L1_error) __pyx_ptype_6libzim_Search = &__pyx_type_6libzim_Search; if (PyType_Ready(&__pyx_type_6libzim_Searcher) < 0) __PYX_ERR(0, 1097, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6libzim_Searcher.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6libzim_Searcher.tp_dictoffset && __pyx_type_6libzim_Searcher.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6libzim_Searcher.tp_getattro = __Pyx_PyObject_GenericGetAttr; } if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Searcher, (PyObject *)&__pyx_type_6libzim_Searcher) < 0) __PYX_ERR(0, 1097, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6libzim_Searcher) < 0) __PYX_ERR(0, 1097, __pyx_L1_error) __pyx_ptype_6libzim_Searcher = &__pyx_type_6libzim_Searcher; __pyx_vtabptr_6libzim_SuggestionResultSet = &__pyx_vtable_6libzim_SuggestionResultSet; __pyx_vtable_6libzim_SuggestionResultSet.from_resultset = (PyObject *(*)(wrapper::SuggestionResultSet))__pyx_f_6libzim_19SuggestionResultSet_from_resultset; if (PyType_Ready(&__pyx_type_6libzim_SuggestionResultSet) < 0) __PYX_ERR(0, 1148, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6libzim_SuggestionResultSet.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6libzim_SuggestionResultSet.tp_dictoffset && __pyx_type_6libzim_SuggestionResultSet.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6libzim_SuggestionResultSet.tp_getattro = __Pyx_PyObject_GenericGetAttr; } #if CYTHON_UPDATE_DESCRIPTOR_DOC { PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6libzim_SuggestionResultSet, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(0, 1148, __pyx_L1_error) if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { __pyx_wrapperbase_6libzim_19SuggestionResultSet___iter__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_6libzim_19SuggestionResultSet___iter__.doc = __pyx_doc_6libzim_19SuggestionResultSet___iter__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6libzim_19SuggestionResultSet___iter__; } } #endif if (__Pyx_SetVtable(__pyx_type_6libzim_SuggestionResultSet.tp_dict, __pyx_vtabptr_6libzim_SuggestionResultSet) < 0) __PYX_ERR(0, 1148, __pyx_L1_error) if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SuggestionResultSet, (PyObject *)&__pyx_type_6libzim_SuggestionResultSet) < 0) __PYX_ERR(0, 1148, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6libzim_SuggestionResultSet) < 0) __PYX_ERR(0, 1148, __pyx_L1_error) __pyx_ptype_6libzim_SuggestionResultSet = &__pyx_type_6libzim_SuggestionResultSet; __pyx_vtabptr_6libzim_SuggestionSearch = &__pyx_vtable_6libzim_SuggestionSearch; __pyx_vtable_6libzim_SuggestionSearch.from_search = (PyObject *(*)(wrapper::SuggestionSearch))__pyx_f_6libzim_16SuggestionSearch_from_search; if (PyType_Ready(&__pyx_type_6libzim_SuggestionSearch) < 0) __PYX_ERR(0, 1167, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6libzim_SuggestionSearch.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6libzim_SuggestionSearch.tp_dictoffset && __pyx_type_6libzim_SuggestionSearch.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6libzim_SuggestionSearch.tp_getattro = __Pyx_PyObject_GenericGetAttr; } if (__Pyx_SetVtable(__pyx_type_6libzim_SuggestionSearch.tp_dict, __pyx_vtabptr_6libzim_SuggestionSearch) < 0) __PYX_ERR(0, 1167, __pyx_L1_error) if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SuggestionSearch, (PyObject *)&__pyx_type_6libzim_SuggestionSearch) < 0) __PYX_ERR(0, 1167, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6libzim_SuggestionSearch) < 0) __PYX_ERR(0, 1167, __pyx_L1_error) __pyx_ptype_6libzim_SuggestionSearch = &__pyx_type_6libzim_SuggestionSearch; if (PyType_Ready(&__pyx_type_6libzim_SuggestionSearcher) < 0) __PYX_ERR(0, 1197, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6libzim_SuggestionSearcher.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6libzim_SuggestionSearcher.tp_dictoffset && __pyx_type_6libzim_SuggestionSearcher.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6libzim_SuggestionSearcher.tp_getattro = __Pyx_PyObject_GenericGetAttr; } if (PyObject_SetAttr(__pyx_m, __pyx_n_s_SuggestionSearcher, (PyObject *)&__pyx_type_6libzim_SuggestionSearcher) < 0) __PYX_ERR(0, 1197, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6libzim_SuggestionSearcher) < 0) __PYX_ERR(0, 1197, __pyx_L1_error) __pyx_ptype_6libzim_SuggestionSearcher = &__pyx_type_6libzim_SuggestionSearcher; if (PyType_Ready(&__pyx_type_6libzim___pyx_scope_struct__gen_blob) < 0) __PYX_ERR(0, 456, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6libzim___pyx_scope_struct__gen_blob.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6libzim___pyx_scope_struct__gen_blob.tp_dictoffset && __pyx_type_6libzim___pyx_scope_struct__gen_blob.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6libzim___pyx_scope_struct__gen_blob.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6libzim___pyx_scope_struct__gen_blob = &__pyx_type_6libzim___pyx_scope_struct__gen_blob; if (PyType_Ready(&__pyx_type_6libzim___pyx_scope_struct_1_gen_blob) < 0) __PYX_ERR(0, 471, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6libzim___pyx_scope_struct_1_gen_blob.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6libzim___pyx_scope_struct_1_gen_blob.tp_dictoffset && __pyx_type_6libzim___pyx_scope_struct_1_gen_blob.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6libzim___pyx_scope_struct_1_gen_blob.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6libzim___pyx_scope_struct_1_gen_blob = &__pyx_type_6libzim___pyx_scope_struct_1_gen_blob; if (PyType_Ready(&__pyx_type_6libzim___pyx_scope_struct_2___iter__) < 0) __PYX_ERR(0, 1058, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6libzim___pyx_scope_struct_2___iter__.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6libzim___pyx_scope_struct_2___iter__.tp_dictoffset && __pyx_type_6libzim___pyx_scope_struct_2___iter__.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6libzim___pyx_scope_struct_2___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6libzim___pyx_scope_struct_2___iter__ = &__pyx_type_6libzim___pyx_scope_struct_2___iter__; if (PyType_Ready(&__pyx_type_6libzim___pyx_scope_struct_3___iter__) < 0) __PYX_ERR(0, 1159, __pyx_L1_error) #if PY_VERSION_HEX < 0x030800B1 __pyx_type_6libzim___pyx_scope_struct_3___iter__.tp_print = 0; #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6libzim___pyx_scope_struct_3___iter__.tp_dictoffset && __pyx_type_6libzim___pyx_scope_struct_3___iter__.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type_6libzim___pyx_scope_struct_3___iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; } __pyx_ptype_6libzim___pyx_scope_struct_3___iter__ = &__pyx_type_6libzim___pyx_scope_struct_3___iter__; __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_modinit_type_import_code(void) { __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT(PyTypeObject), #else sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT(PyHeapTypeObject), #endif __Pyx_ImportType_CheckSize_Warn); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_modinit_variable_import_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); /*--- Variable import code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_function_import_code(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); /*--- Function import code ---*/ __Pyx_RefNannyFinishContext(); return 0; } #ifndef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #elif PY_MAJOR_VERSION < 3 #ifdef __cplusplus #define __Pyx_PyMODINIT_FUNC extern "C" void #else #define __Pyx_PyMODINIT_FUNC void #endif #else #ifdef __cplusplus #define __Pyx_PyMODINIT_FUNC extern "C" PyObject * #else #define __Pyx_PyMODINIT_FUNC PyObject * #endif #endif #if PY_MAJOR_VERSION < 3 __Pyx_PyMODINIT_FUNC initlibzim(void) CYTHON_SMALL_CODE; /*proto*/ __Pyx_PyMODINIT_FUNC initlibzim(void) #else __Pyx_PyMODINIT_FUNC PyInit_libzim(void) CYTHON_SMALL_CODE; /*proto*/ __Pyx_PyMODINIT_FUNC PyInit_libzim(void) #if CYTHON_PEP489_MULTI_PHASE_INIT { return PyModuleDef_Init(&__pyx_moduledef); } static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { #if PY_VERSION_HEX >= 0x030700A1 static PY_INT64_T main_interpreter_id = -1; PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); if (main_interpreter_id == -1) { main_interpreter_id = current_id; return (unlikely(current_id == -1)) ? -1 : 0; } else if (unlikely(main_interpreter_id != current_id)) #else static PyInterpreterState *main_interpreter = NULL; PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; if (!main_interpreter) { main_interpreter = current_interpreter; } else if (unlikely(main_interpreter != current_interpreter)) #endif { PyErr_SetString( PyExc_ImportError, "Interpreter change detected - this module can only be loaded into one interpreter per process."); return -1; } return 0; } static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { if (allow_none || value != Py_None) { result = PyDict_SetItemString(moddict, to_name, value); } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Clear(); } else { result = -1; } return result; } static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; if (__Pyx_check_single_interpreter()) return NULL; if (__pyx_m) return __Pyx_NewRef(__pyx_m); modname = PyObject_GetAttrString(spec, "name"); if (unlikely(!modname)) goto bad; module = PyModule_NewObject(modname); Py_DECREF(modname); if (unlikely(!module)) goto bad; moddict = PyModule_GetDict(module); if (unlikely(!moddict)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; return module; bad: Py_XDECREF(module); return NULL; } static CYTHON_SMALL_CODE int __pyx_pymod_exec_libzim(PyObject *__pyx_pyinit_module) #endif #endif { 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; PyObject *__pyx_t_10 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannyDeclarations #if CYTHON_PEP489_MULTI_PHASE_INIT if (__pyx_m) { if (__pyx_m == __pyx_pyinit_module) return 0; PyErr_SetString(PyExc_RuntimeError, "Module 'libzim' has already been imported. Re-initialisation is not supported."); return -1; } #elif PY_MAJOR_VERSION >= 3 if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif #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("__Pyx_PyMODINIT_FUNC PyInit_libzim(void)", 0); if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pxy_PyFrame_Initialize_Offsets __Pxy_PyFrame_Initialize_Offsets(); #endif __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_AsyncGen_USED if (__pyx_AsyncGen_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(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS PyEval_InitThreads(); #endif /*--- Module creation code ---*/ #if CYTHON_PEP489_MULTI_PHASE_INIT __pyx_m = __pyx_pyinit_module; Py_INCREF(__pyx_m); #else #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4("libzim", __pyx_methods, __pyx_k_openZIM_s_file_format_library_bi, 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) #endif __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) Py_INCREF(__pyx_b); __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_cython_runtime); 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_libzim) { if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __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, "libzim")) { if (unlikely(PyDict_SetItemString(modules, "libzim", __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 type/function init code ---*/ (void)__Pyx_modinit_global_init_code(); (void)__Pyx_modinit_variable_export_code(); if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) (void)__Pyx_modinit_variable_import_code(); (void)__Pyx_modinit_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 /* "libzim.pyx":30 * * https://openzim.org""" * __path__ = [] # <<<<<<<<<<<<<< * * cimport zim */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_path_3, __pyx_t_1) < 0) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":34 * cimport zim * * import datetime # <<<<<<<<<<<<<< * import enum * import importlib */ __pyx_t_1 = __Pyx_Import(__pyx_n_s_datetime, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_datetime, __pyx_t_1) < 0) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":35 * * import datetime * import enum # <<<<<<<<<<<<<< * import importlib * import importlib.abc */ __pyx_t_1 = __Pyx_Import(__pyx_n_s_enum, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_enum, __pyx_t_1) < 0) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":36 * import datetime * import enum * import importlib # <<<<<<<<<<<<<< * import importlib.abc * import os */ __pyx_t_1 = __Pyx_Import(__pyx_n_s_importlib, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_importlib, __pyx_t_1) < 0) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":37 * import enum * import importlib * import importlib.abc # <<<<<<<<<<<<<< * import os * import pathlib */ __pyx_t_1 = __Pyx_Import(__pyx_n_s_importlib_abc, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_importlib, __pyx_t_1) < 0) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":38 * import importlib * import importlib.abc * import os # <<<<<<<<<<<<<< * import pathlib * import sys */ __pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":39 * import importlib.abc * import os * import pathlib # <<<<<<<<<<<<<< * import sys * import traceback */ __pyx_t_1 = __Pyx_Import(__pyx_n_s_pathlib, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_pathlib, __pyx_t_1) < 0) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":40 * import os * import pathlib * import sys # <<<<<<<<<<<<<< * import traceback * from collections import OrderedDict */ __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":41 * import pathlib * import sys * import traceback # <<<<<<<<<<<<<< * from collections import OrderedDict * from types import ModuleType */ __pyx_t_1 = __Pyx_Import(__pyx_n_s_traceback, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_traceback, __pyx_t_1) < 0) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":42 * import sys * import traceback * from collections import OrderedDict # <<<<<<<<<<<<<< * from types import ModuleType * from typing import Dict, Generator, Iterator, List, Optional, Set, Tuple, Union */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __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, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __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, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_OrderedDict, __pyx_t_1) < 0) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":43 * import traceback * from collections import OrderedDict * from types import ModuleType # <<<<<<<<<<<<<< * from typing import Dict, Generator, Iterator, List, Optional, Set, Tuple, Union * from uuid import UUID */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_ModuleType); __Pyx_GIVEREF(__pyx_n_s_ModuleType); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_ModuleType); __pyx_t_1 = __Pyx_Import(__pyx_n_s_types, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __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_ModuleType); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_ModuleType, __pyx_t_2) < 0) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":44 * from collections import OrderedDict * from types import ModuleType * from typing import Dict, Generator, Iterator, List, Optional, Set, Tuple, Union # <<<<<<<<<<<<<< * from uuid import UUID * */ __pyx_t_1 = PyList_New(8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_Dict); __Pyx_GIVEREF(__pyx_n_s_Dict); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Dict); __Pyx_INCREF(__pyx_n_s_Generator); __Pyx_GIVEREF(__pyx_n_s_Generator); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_Generator); __Pyx_INCREF(__pyx_n_s_Iterator); __Pyx_GIVEREF(__pyx_n_s_Iterator); PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_Iterator); __Pyx_INCREF(__pyx_n_s_List); __Pyx_GIVEREF(__pyx_n_s_List); PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_List); __Pyx_INCREF(__pyx_n_s_Optional); __Pyx_GIVEREF(__pyx_n_s_Optional); PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_s_Optional); __Pyx_INCREF(__pyx_n_s_Set); __Pyx_GIVEREF(__pyx_n_s_Set); PyList_SET_ITEM(__pyx_t_1, 5, __pyx_n_s_Set); __Pyx_INCREF(__pyx_n_s_Tuple); __Pyx_GIVEREF(__pyx_n_s_Tuple); PyList_SET_ITEM(__pyx_t_1, 6, __pyx_n_s_Tuple); __Pyx_INCREF(__pyx_n_s_Union); __Pyx_GIVEREF(__pyx_n_s_Union); PyList_SET_ITEM(__pyx_t_1, 7, __pyx_n_s_Union); __pyx_t_2 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __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_Dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Dict, __pyx_t_1) < 0) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Generator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Generator, __pyx_t_1) < 0) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Iterator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Iterator, __pyx_t_1) < 0) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_List); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_List, __pyx_t_1) < 0) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Optional); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Optional, __pyx_t_1) < 0) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Set); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Set, __pyx_t_1) < 0) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Tuple); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Tuple, __pyx_t_1) < 0) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Union); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Union, __pyx_t_1) < 0) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":45 * from types import ModuleType * from typing import Dict, Generator, Iterator, List, Optional, Set, Tuple, Union * from uuid import UUID # <<<<<<<<<<<<<< * * from cpython.buffer cimport PyBUF_WRITABLE */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_UUID); __Pyx_GIVEREF(__pyx_n_s_UUID); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_UUID); __pyx_t_1 = __Pyx_Import(__pyx_n_s_uuid, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __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_UUID); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_UUID, __pyx_t_2) < 0) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":59 * from libcpp.utility cimport move * * pybool = type(True) # <<<<<<<<<<<<<< * pyint = type(1) * */ if (PyDict_SetItem(__pyx_d, __pyx_n_s_pybool, ((PyObject *)Py_TYPE(Py_True))) < 0) __PYX_ERR(0, 59, __pyx_L1_error) /* "libzim.pyx":60 * * pybool = type(True) * pyint = type(1) # <<<<<<<<<<<<<< * * def create_module(name, doc, members): */ if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyint, ((PyObject *)Py_TYPE(__pyx_int_1))) < 0) __PYX_ERR(0, 60, __pyx_L1_error) /* "libzim.pyx":62 * pyint = type(1) * * def create_module(name, doc, members): # <<<<<<<<<<<<<< * """Create/define a module for name and docstring, populated by members""" * module = ModuleType(name, doc) */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6libzim_1create_module, NULL, __pyx_n_s_libzim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_create_module, __pyx_t_1) < 0) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":205 * ############################################################################### * * writer_module_name = f"{__name__}.writer" # <<<<<<<<<<<<<< * * cdef class WritingBlob: */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_1, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyUnicode_Concat(__pyx_t_2, __pyx_kp_u_writer_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_writer_module_name, __pyx_t_1) < 0) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":208 * * cdef class WritingBlob: * __module__ = writer_module_name # <<<<<<<<<<<<<< * cdef zim.Blob c_blob * cdef bytes ref_content */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_writer_module_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6libzim_WritingBlob->tp_dict, __pyx_n_s_module_2, __pyx_t_1) < 0) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6libzim_WritingBlob); /* "libzim.pyx":224 * * * class Compression(enum.Enum): # <<<<<<<<<<<<<< * """Compression algorithms available to create ZIM files""" * __module__ = writer_module_name */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_enum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Enum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __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(0, 224, __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_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_Compression, __pyx_n_s_Compression, (PyObject *) NULL, __pyx_n_s_libzim, __pyx_kp_s_Compression_algorithms_available); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* "libzim.pyx":226 * class Compression(enum.Enum): * """Compression algorithms available to create ZIM files""" * __module__ = writer_module_name # <<<<<<<<<<<<<< * # We don't care of the exact value. The function comp_from_int will do the right * # conversion to zim::Compression */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_writer_module_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_module_2, __pyx_t_4) < 0) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "libzim.pyx":229 * # We don't care of the exact value. The function comp_from_int will do the right * # conversion to zim::Compression * none = 0 # <<<<<<<<<<<<<< * zstd = 1 * */ if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_none, __pyx_int_0) < 0) __PYX_ERR(0, 229, __pyx_L1_error) /* "libzim.pyx":230 * # conversion to zim::Compression * none = 0 * zstd = 1 # <<<<<<<<<<<<<< * * */ if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_zstd, __pyx_int_1) < 0) __PYX_ERR(0, 230, __pyx_L1_error) /* "libzim.pyx":224 * * * class Compression(enum.Enum): # <<<<<<<<<<<<<< * """Compression algorithms available to create ZIM files""" * __module__ = writer_module_name */ __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Compression, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Compression, __pyx_t_4) < 0) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_DECREF(__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; /* "libzim.pyx":233 * * * class Hint(enum.Enum): # <<<<<<<<<<<<<< * __module__ = writer_module_name * COMPRESS = zim.HintKeys.COMPRESS */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_enum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Enum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __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(0, 233, __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_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_Hint, __pyx_n_s_Hint, (PyObject *) NULL, __pyx_n_s_libzim, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* "libzim.pyx":234 * * class Hint(enum.Enum): * __module__ = writer_module_name # <<<<<<<<<<<<<< * COMPRESS = zim.HintKeys.COMPRESS * FRONT_ARTICLE = zim.HintKeys.FRONT_ARTICLE */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_writer_module_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_module_2, __pyx_t_4) < 0) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "libzim.pyx":235 * class Hint(enum.Enum): * __module__ = writer_module_name * COMPRESS = zim.HintKeys.COMPRESS # <<<<<<<<<<<<<< * FRONT_ARTICLE = zim.HintKeys.FRONT_ARTICLE * */ __pyx_t_4 = __Pyx_PyInt_From_zim_3a__3a_writer_3a__3a_HintKeys(zim::writer::COMPRESS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_COMPRESS, __pyx_t_4) < 0) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "libzim.pyx":236 * __module__ = writer_module_name * COMPRESS = zim.HintKeys.COMPRESS * FRONT_ARTICLE = zim.HintKeys.FRONT_ARTICLE # <<<<<<<<<<<<<< * * */ __pyx_t_4 = __Pyx_PyInt_From_zim_3a__3a_writer_3a__3a_HintKeys(zim::writer::FRONT_ARTICLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_FRONT_ARTICLE, __pyx_t_4) < 0) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "libzim.pyx":233 * * * class Hint(enum.Enum): # <<<<<<<<<<<<<< * __module__ = writer_module_name * COMPRESS = zim.HintKeys.COMPRESS */ __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Hint, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Hint, __pyx_t_4) < 0) __PYX_ERR(0, 233, __pyx_L1_error) __Pyx_DECREF(__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; /* "libzim.pyx":251 * _started : bool * flag if the creator has started""" * __module__ = writer_module_name # <<<<<<<<<<<<<< * * cdef zim.ZimCreator c_creator */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_writer_module_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_6libzim__Creator->tp_dict, __pyx_n_s_module_2, __pyx_t_1) < 0) __PYX_ERR(0, 251, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_6libzim__Creator); /* "libzim.pyx":415 * return self._filename * * class ContentProvider: # <<<<<<<<<<<<<< * __module__ = writer_module_name * def __init__(self): */ __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_ContentProvider, __pyx_n_s_ContentProvider, (PyObject *) NULL, __pyx_n_s_libzim, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 415, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* "libzim.pyx":416 * * class ContentProvider: * __module__ = writer_module_name # <<<<<<<<<<<<<< * def __init__(self): * self.generator = None */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_writer_module_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_module_2, __pyx_t_2) < 0) __PYX_ERR(0, 416, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":417 * class ContentProvider: * __module__ = writer_module_name * def __init__(self): # <<<<<<<<<<<<<< * self.generator = None * */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_15ContentProvider_1__init__, 0, __pyx_n_s_ContentProvider___init, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 417, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":420 * self.generator = None * * def get_size(self) -> pyint: # <<<<<<<<<<<<<< * """Size of get_data's result in bytes""" * raise NotImplementedError("get_size must be implemented.") */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyint); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 420, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_t_3) < 0) __PYX_ERR(0, 420, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_15ContentProvider_3get_size, 0, __pyx_n_s_ContentProvider_get_size, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__57)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 420, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_size, __pyx_t_3) < 0) __PYX_ERR(0, 420, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "libzim.pyx":424 * raise NotImplementedError("get_size must be implemented.") * * def feed(self) -> WritingBlob: # <<<<<<<<<<<<<< * """Blob(s) containing the complete content of the article. * Must return an empty blob to tell writer no more content has to be written. */ __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_WritingBlob) < 0) __PYX_ERR(0, 424, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_15ContentProvider_5feed, 0, __pyx_n_s_ContentProvider_feed, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__59)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_feed, __pyx_t_2) < 0) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":441 * return self._blob * * def gen_blob(self) -> Generator[WritingBlob, None, None]: # <<<<<<<<<<<<<< * """Generator yielding blobs for the content of the article""" * raise NotImplementedError("gen_blob (ro feed) must be implemented") */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Generator); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_ptype_6libzim_WritingBlob)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6libzim_WritingBlob)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_ptype_6libzim_WritingBlob)); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_4, 1, Py_None); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_4, 2, Py_None); __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 441, __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; if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_15ContentProvider_7gen_blob, 0, __pyx_n_s_ContentProvider_gen_blob, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__61)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_gen_blob, __pyx_t_5) < 0) __PYX_ERR(0, 441, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "libzim.pyx":415 * return self._filename * * class ContentProvider: # <<<<<<<<<<<<<< * __module__ = writer_module_name * def __init__(self): */ __pyx_t_5 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_ContentProvider, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 415, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_d, __pyx_n_s_ContentProvider, __pyx_t_5) < 0) __PYX_ERR(0, 415, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":446 * * * class StringProvider(ContentProvider): # <<<<<<<<<<<<<< * """ContentProvider for a single encoded-or-not UTF-8 string""" * __module__ = writer_module_name */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ContentProvider); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 446, __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_CalculateMetaclass(NULL, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_5, __pyx_n_s_StringProvider, __pyx_n_s_StringProvider, (PyObject *) NULL, __pyx_n_s_libzim, __pyx_kp_s_ContentProvider_for_a_single_enc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); /* "libzim.pyx":448 * class StringProvider(ContentProvider): * """ContentProvider for a single encoded-or-not UTF-8 string""" * __module__ = writer_module_name # <<<<<<<<<<<<<< * def __init__(self, content: Union[str, bytes]): * super().__init__() */ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_writer_module_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_module_2, __pyx_t_3) < 0) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "libzim.pyx":449 * """ContentProvider for a single encoded-or-not UTF-8 string""" * __module__ = writer_module_name * def __init__(self, content: Union[str, bytes]): # <<<<<<<<<<<<<< * super().__init__() * self.content = content.encode("UTF-8") if isinstance(content, str) else content */ __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Union); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)(&PyUnicode_Type))); __Pyx_INCREF(((PyObject *)(&PyBytes_Type))); __Pyx_GIVEREF(((PyObject *)(&PyBytes_Type))); PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)(&PyBytes_Type))); __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_content, __pyx_t_8) < 0) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_14StringProvider_1__init__, 0, __pyx_n_s_StringProvider___init, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__63)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_t_8); PyList_Append(__pyx_t_4, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_8) < 0) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; /* "libzim.pyx":453 * self.content = content.encode("UTF-8") if isinstance(content, str) else content * * def get_size(self) -> pyint: # <<<<<<<<<<<<<< * return len(self.content) * */ __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyint); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_t_3) < 0) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_14StringProvider_3get_size, 0, __pyx_n_s_StringProvider_get_size, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__65)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_8); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_get_size, __pyx_t_3) < 0) __PYX_ERR(0, 453, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "libzim.pyx":456 * return len(self.content) * * def gen_blob(self) -> Generator[WritingBlob, None, None]: # <<<<<<<<<<<<<< * yield WritingBlob(self.content) * */ __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Generator); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)__pyx_ptype_6libzim_WritingBlob)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6libzim_WritingBlob)); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_ptype_6libzim_WritingBlob)); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_7, 1, Py_None); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_7, 2, Py_None); __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_t_6) < 0) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_14StringProvider_5gen_blob, 0, __pyx_n_s_StringProvider_gen_blob, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_gen_blob, __pyx_t_6) < 0) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* "libzim.pyx":446 * * * class StringProvider(ContentProvider): # <<<<<<<<<<<<<< * """ContentProvider for a single encoded-or-not UTF-8 string""" * __module__ = writer_module_name */ __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_StringProvider, __pyx_t_5, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__Pyx_CyFunction_InitClassCell(__pyx_t_4, __pyx_t_6) < 0) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_StringProvider, __pyx_t_6) < 0) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __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; /* "libzim.pyx":460 * * * class FileProvider(ContentProvider): # <<<<<<<<<<<<<< * """ContentProvider for a file using its local path""" * __module__ = writer_module_name */ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ContentProvider); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 460, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 460, __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_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 460, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_5, __pyx_t_1, __pyx_n_s_FileProvider, __pyx_n_s_FileProvider, (PyObject *) NULL, __pyx_n_s_libzim, __pyx_kp_s_ContentProvider_for_a_file_using); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 460, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 460, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); /* "libzim.pyx":462 * class FileProvider(ContentProvider): * """ContentProvider for a file using its local path""" * __module__ = writer_module_name # <<<<<<<<<<<<<< * def __init__(self, filepath: Union[pathlib.Path, str]): * super().__init__() */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_writer_module_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 462, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_module_2, __pyx_t_4) < 0) __PYX_ERR(0, 462, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "libzim.pyx":463 * """ContentProvider for a file using its local path""" * __module__ = writer_module_name * def __init__(self, filepath: Union[pathlib.Path, str]): # <<<<<<<<<<<<<< * super().__init__() * self.filepath = filepath */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 463, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Union); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 463, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_pathlib); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 463, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_Path); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 463, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 463, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)(&PyUnicode_Type))); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 463, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_filepath, __pyx_t_8) < 0) __PYX_ERR(0, 463, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_12FileProvider_1__init__, 0, __pyx_n_s_FileProvider___init, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__68)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 463, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_t_8); PyList_Append(__pyx_t_6, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_8, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_8) < 0) __PYX_ERR(0, 463, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; /* "libzim.pyx":468 * self.size = os.path.getsize(self.filepath) * * def get_size(self) -> pyint: # <<<<<<<<<<<<<< * return self.size * */ __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 468, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyint); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 468, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_return, __pyx_t_4) < 0) __PYX_ERR(0, 468, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_12FileProvider_3get_size, 0, __pyx_n_s_FileProvider_get_size, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__70)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 468, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_8); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_get_size, __pyx_t_4) < 0) __PYX_ERR(0, 468, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "libzim.pyx":471 * return self.size * * def gen_blob(self) -> Generator[WritingBlob, None, None]: # <<<<<<<<<<<<<< * bsize = 1048576 # 1MiB chunk * with open(self.filepath, "rb") as fh: */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 471, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Generator); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 471, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 471, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)__pyx_ptype_6libzim_WritingBlob)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6libzim_WritingBlob)); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_ptype_6libzim_WritingBlob)); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_7, 1, Py_None); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_7, 2, Py_None); __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 471, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_t_3) < 0) __PYX_ERR(0, 471, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_12FileProvider_5gen_blob, 0, __pyx_n_s_FileProvider_gen_blob, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 471, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_gen_blob, __pyx_t_3) < 0) __PYX_ERR(0, 471, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "libzim.pyx":460 * * * class FileProvider(ContentProvider): # <<<<<<<<<<<<<< * """ContentProvider for a file using its local path""" * __module__ = writer_module_name */ __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_5, __pyx_n_s_FileProvider, __pyx_t_1, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 460, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__Pyx_CyFunction_InitClassCell(__pyx_t_6, __pyx_t_3) < 0) __PYX_ERR(0, 460, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileProvider, __pyx_t_3) < 0) __PYX_ERR(0, 460, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __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; /* "libzim.pyx":479 * res = fh.read(bsize) * * class IndexData: # <<<<<<<<<<<<<< * """ IndexData stub to override * */ __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_IndexData, __pyx_n_s_IndexData, (PyObject *) NULL, __pyx_n_s_libzim, __pyx_kp_s_IndexData_stub_to_override_Retu); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 479, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* "libzim.pyx":483 * * Return a subclass of it in Item.get_indexdata()""" * __module__ = writer_module_name # <<<<<<<<<<<<<< * * def has_indexdata(self) -> bool: */ __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_writer_module_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_module_2, __pyx_t_5) < 0) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "libzim.pyx":485 * __module__ = writer_module_name * * def has_indexdata(self) -> bool: # <<<<<<<<<<<<<< * """Return true if the IndexData actually contains data""" * return False */ __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 485, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_bool) < 0) __PYX_ERR(0, 485, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_9IndexData_1has_indexdata, 0, __pyx_n_s_IndexData_has_indexdata, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__73)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 485, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_has_indexdata, __pyx_t_2) < 0) __PYX_ERR(0, 485, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":489 * return False * * def get_title(self) -> str: # <<<<<<<<<<<<<< * """Title to index. Might be the same as Item.get_title or not""" * raise NotImplementedError("get_title must be implemented.") */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 489, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 489, __pyx_L1_error) __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_9IndexData_3get_title, 0, __pyx_n_s_IndexData_get_title, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__75)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 489, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_title, __pyx_t_5) < 0) __PYX_ERR(0, 489, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "libzim.pyx":493 * raise NotImplementedError("get_title must be implemented.") * * def get_content(self) -> str: # <<<<<<<<<<<<<< * """Content to index. Might be the same as Item.get_title or not""" * raise NotImplementedError("get_content must be implemented.") */ __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 493, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_9IndexData_5get_content, 0, __pyx_n_s_IndexData_get_content, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__77)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_content, __pyx_t_2) < 0) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":497 * raise NotImplementedError("get_content must be implemented.") * * def get_keywords(self) -> str: # <<<<<<<<<<<<<< * """Keywords used to index the item. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 497, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 497, __pyx_L1_error) __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_9IndexData_7get_keywords, 0, __pyx_n_s_IndexData_get_keywords, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__79)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 497, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_keywords, __pyx_t_5) < 0) __PYX_ERR(0, 497, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "libzim.pyx":503 * raise NotImplementedError("get_keywords must be implemented.") * * def get_wordcount(self) -> int: # <<<<<<<<<<<<<< * """Number of word in content""" * raise NotImplementedError("get_wordcount must be implemented.") */ __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 503, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_int) < 0) __PYX_ERR(0, 503, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_9IndexData_9get_wordcount, 0, __pyx_n_s_IndexData_get_wordcount, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__81)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_wordcount, __pyx_t_2) < 0) __PYX_ERR(0, 503, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":507 * raise NotImplementedError("get_wordcount must be implemented.") * * def get_geoposition(self) -> Optional[Tuple[float, float]]: # <<<<<<<<<<<<<< * """GeoPosition used to index the item. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Optional); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Tuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(((PyObject *)(&PyFloat_Type))); __Pyx_GIVEREF(((PyObject *)(&PyFloat_Type))); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)(&PyFloat_Type))); __Pyx_INCREF(((PyObject *)(&PyFloat_Type))); __Pyx_GIVEREF(((PyObject *)(&PyFloat_Type))); PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)(&PyFloat_Type))); __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_t_6) < 0) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_9IndexData_11get_geoposition, 0, __pyx_n_s_IndexData_get_geoposition, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__83)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_geoposition, __pyx_t_6) < 0) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* "libzim.pyx":479 * res = fh.read(bsize) * * class IndexData: # <<<<<<<<<<<<<< * """ IndexData stub to override * */ __pyx_t_6 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_IndexData, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 479, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_d, __pyx_n_s_IndexData, __pyx_t_6) < 0) __PYX_ERR(0, 479, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":514 * * * class BaseWritingItem: # <<<<<<<<<<<<<< * """Item stub to override * */ __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_BaseWritingItem, __pyx_n_s_BaseWritingItem, (PyObject *) NULL, __pyx_n_s_libzim, __pyx_kp_s_Item_stub_to_override_Pass_a_sub); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* "libzim.pyx":518 * * Pass a subclass of it to Creator.add_item()""" * __module__ = writer_module_name # <<<<<<<<<<<<<< * * def __init__(self): */ __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_writer_module_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 518, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_module_2, __pyx_t_6) < 0) __PYX_ERR(0, 518, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* "libzim.pyx":520 * __module__ = writer_module_name * * def __init__(self): # <<<<<<<<<<<<<< * self._blob = None * */ __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_15BaseWritingItem_1__init__, 0, __pyx_n_s_BaseWritingItem___init, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__85)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 520, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_6) < 0) __PYX_ERR(0, 520, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* "libzim.pyx":523 * self._blob = None * * def get_path(self) -> str: # <<<<<<<<<<<<<< * """Full path of item""" * raise NotImplementedError("get_path must be implemented.") */ __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 523, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_15BaseWritingItem_3get_path, 0, __pyx_n_s_BaseWritingItem_get_path, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__87)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_path, __pyx_t_2) < 0) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":527 * raise NotImplementedError("get_path must be implemented.") * * def get_title(self) -> str: # <<<<<<<<<<<<<< * """Item title. Might be indexed and used in suggestions""" * raise NotImplementedError("get_title must be implemented.") */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 527, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 527, __pyx_L1_error) __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_15BaseWritingItem_5get_title, 0, __pyx_n_s_BaseWritingItem_get_title, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__89)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 527, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_title, __pyx_t_6) < 0) __PYX_ERR(0, 527, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* "libzim.pyx":531 * raise NotImplementedError("get_title must be implemented.") * * def get_mimetype(self) -> str: # <<<<<<<<<<<<<< * """MIME-type of the item's content.""" * raise NotImplementedError("get_mimetype must be implemented.") */ __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 531, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 531, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_15BaseWritingItem_7get_mimetype, 0, __pyx_n_s_BaseWritingItem_get_mimetype, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__91)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 531, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_mimetype, __pyx_t_2) < 0) __PYX_ERR(0, 531, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":535 * raise NotImplementedError("get_mimetype must be implemented.") * * def get_contentprovider(self) -> ContentProvider: # <<<<<<<<<<<<<< * """ContentProvider containing the complete content of the item""" * raise NotImplementedError("get_contentprovider must be implemented.") */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_ContentProvider); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 535, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_t_6) < 0) __PYX_ERR(0, 535, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_15BaseWritingItem_9get_contentprovider, 0, __pyx_n_s_BaseWritingItem_get_contentprovi, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__93)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 535, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_contentprovider, __pyx_t_6) < 0) __PYX_ERR(0, 535, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* "libzim.pyx":539 * raise NotImplementedError("get_contentprovider must be implemented.") * * def get_hints(self) -> Dict[Hint, pyint]: # <<<<<<<<<<<<<< * """Dict of Hint: value informing Creator how to handle this item""" * raise NotImplementedError("get_hints must be implemented.") */ __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Dict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Hint); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyint); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 539, __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_5); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_15BaseWritingItem_11get_hints, 0, __pyx_n_s_BaseWritingItem_get_hints, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__95)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_hints, __pyx_t_5) < 0) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "libzim.pyx":543 * raise NotImplementedError("get_hints must be implemented.") * * def __repr__(self) -> str: # <<<<<<<<<<<<<< * return ( * f"{self.__class__.__name__}(path={self.get_path()}, " */ __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 543, __pyx_L1_error) __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_15BaseWritingItem_13__repr__, 0, __pyx_n_s_BaseWritingItem___repr, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__97)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_repr, __pyx_t_6) < 0) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* "libzim.pyx":514 * * * class BaseWritingItem: # <<<<<<<<<<<<<< * """Item stub to override * */ __pyx_t_6 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_BaseWritingItem, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_d, __pyx_n_s_BaseWritingItem, __pyx_t_6) < 0) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libzim.pyx":550 * * * class Creator(_Creator): # <<<<<<<<<<<<<< * __module__ = writer_module_name * def config_compression(self, compression: Compression): */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_ptype_6libzim__Creator)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6libzim__Creator)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_6libzim__Creator)); __pyx_t_6 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_Py3MetaclassPrepare(__pyx_t_6, __pyx_t_1, __pyx_n_s_Creator_2, __pyx_n_s_Creator_2, (PyObject *) NULL, __pyx_n_s_libzim, (PyObject *) NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* "libzim.pyx":551 * * class Creator(_Creator): * __module__ = writer_module_name # <<<<<<<<<<<<<< * def config_compression(self, compression: Compression): * if not isinstance(compression, Compression): */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_writer_module_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 551, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_module_2, __pyx_t_2) < 0) __PYX_ERR(0, 551, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":552 * class Creator(_Creator): * __module__ = writer_module_name * def config_compression(self, compression: Compression): # <<<<<<<<<<<<<< * if not isinstance(compression, Compression): * compression = getattr(Compression, compression.lower()) */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Compression); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_compression, __pyx_t_4) < 0) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_7Creator_1config_compression, 0, __pyx_n_s_Creator_config_compression, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__99)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_4); PyList_Append(__pyx_t_3, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_config_compression, __pyx_t_4) < 0) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "libzim.pyx":557 * return super().config_compression(compression) * * def add_metadata( # <<<<<<<<<<<<<< * self, name: str, content: Union[str, bytes, datetime.date, datetime.datetime], * mimetype: str = "text/plain;charset=UTF-8" */ __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_name, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 557, __pyx_L1_error) /* "libzim.pyx":558 * * def add_metadata( * self, name: str, content: Union[str, bytes, datetime.date, datetime.datetime], # <<<<<<<<<<<<<< * mimetype: str = "text/plain;charset=UTF-8" * ): */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Union); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 558, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_datetime); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 558, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_date); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 558, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_datetime); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 558, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_datetime); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 558, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 558, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)(&PyUnicode_Type))); __Pyx_INCREF(((PyObject *)(&PyBytes_Type))); __Pyx_GIVEREF(((PyObject *)(&PyBytes_Type))); PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)(&PyBytes_Type))); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_9); __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 558, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_content, __pyx_t_9) < 0) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_mimetype, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 557, __pyx_L1_error) /* "libzim.pyx":557 * return super().config_compression(compression) * * def add_metadata( # <<<<<<<<<<<<<< * self, name: str, content: Union[str, bytes, datetime.date, datetime.datetime], * mimetype: str = "text/plain;charset=UTF-8" */ __pyx_t_9 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_7Creator_3add_metadata, 0, __pyx_n_s_Creator_add_metadata, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__101)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_9); PyList_Append(__pyx_t_3, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_9, __pyx_tuple__102); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_9, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_add_metadata, __pyx_t_9) < 0) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; /* "libzim.pyx":567 * super().add_metadata(name=name, content=content, mimetype=mimetype) * * def __repr__(self) -> str: # <<<<<<<<<<<<<< * return f"Creator(filename={self.filename})" * */ __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 567, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 567, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_7Creator_5__repr__, 0, __pyx_n_s_Creator___repr, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__104)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 567, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_repr, __pyx_t_4) < 0) __PYX_ERR(0, 567, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "libzim.pyx":550 * * * class Creator(_Creator): # <<<<<<<<<<<<<< * __module__ = writer_module_name * def config_compression(self, compression: Compression): */ __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_6, __pyx_n_s_Creator_2, __pyx_t_1, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_CyFunction_InitClassCell(__pyx_t_3, __pyx_t_4) < 0) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_Creator_2, __pyx_t_4) < 0) __PYX_ERR(0, 550, __pyx_L1_error) __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_1); __pyx_t_1 = 0; /* "libzim.pyx":570 * return f"Creator(filename={self.filename})" * * writer_module_doc = """libzim writer module # <<<<<<<<<<<<<< * - Creator to create ZIM files * - Item to store ZIM articles metadata */ if (PyDict_SetItem(__pyx_d, __pyx_n_s_writer_module_doc, __pyx_kp_u_libzim_writer_module_Creator_to) < 0) __PYX_ERR(0, 570, __pyx_L1_error) /* "libzim.pyx":587 * creator.set_mainpath(path)""" * writer_public_objects = [ * Creator, # <<<<<<<<<<<<<< * Compression, * ('Blob', WritingBlob), */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Creator_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* "libzim.pyx":588 * writer_public_objects = [ * Creator, * Compression, # <<<<<<<<<<<<<< * ('Blob', WritingBlob), * Hint, */ __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Compression); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 588, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); /* "libzim.pyx":589 * Creator, * Compression, * ('Blob', WritingBlob), # <<<<<<<<<<<<<< * Hint, * ('Item', BaseWritingItem), */ __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 589, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_n_u_Blob); __Pyx_GIVEREF(__pyx_n_u_Blob); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_n_u_Blob); __Pyx_INCREF(((PyObject *)__pyx_ptype_6libzim_WritingBlob)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6libzim_WritingBlob)); PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_ptype_6libzim_WritingBlob)); /* "libzim.pyx":590 * Compression, * ('Blob', WritingBlob), * Hint, # <<<<<<<<<<<<<< * ('Item', BaseWritingItem), * ContentProvider, */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Hint); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 590, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); /* "libzim.pyx":591 * ('Blob', WritingBlob), * Hint, * ('Item', BaseWritingItem), # <<<<<<<<<<<<<< * ContentProvider, * FileProvider, */ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_BaseWritingItem); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 591, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 591, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_n_u_Item); __Pyx_GIVEREF(__pyx_n_u_Item); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_n_u_Item); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3); __pyx_t_3 = 0; /* "libzim.pyx":592 * Hint, * ('Item', BaseWritingItem), * ContentProvider, # <<<<<<<<<<<<<< * FileProvider, * StringProvider, */ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ContentProvider); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 592, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* "libzim.pyx":593 * ('Item', BaseWritingItem), * ContentProvider, * FileProvider, # <<<<<<<<<<<<<< * StringProvider, * IndexData */ __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_FileProvider); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 593, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); /* "libzim.pyx":594 * ContentProvider, * FileProvider, * StringProvider, # <<<<<<<<<<<<<< * IndexData * ] */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_StringProvider); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); /* "libzim.pyx":595 * FileProvider, * StringProvider, * IndexData # <<<<<<<<<<<<<< * ] * writer = create_module(writer_module_name, writer_module_doc, writer_public_objects) */ __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_IndexData); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 595, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); /* "libzim.pyx":586 * creator.add_item(MyItemSubclass(path, title, mimetype, content) * creator.set_mainpath(path)""" * writer_public_objects = [ # <<<<<<<<<<<<<< * Creator, * Compression, */ __pyx_t_10 = PyList_New(9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 586, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_1); PyList_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_6); PyList_SET_ITEM(__pyx_t_10, 1, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_10, 2, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_10, 3, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_9); PyList_SET_ITEM(__pyx_t_10, 4, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_3); PyList_SET_ITEM(__pyx_t_10, 5, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_7); PyList_SET_ITEM(__pyx_t_10, 6, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_10, 7, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_8); PyList_SET_ITEM(__pyx_t_10, 8, __pyx_t_8); __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_9 = 0; __pyx_t_3 = 0; __pyx_t_7 = 0; __pyx_t_2 = 0; __pyx_t_8 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_writer_public_objects, __pyx_t_10) < 0) __PYX_ERR(0, 586, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; /* "libzim.pyx":597 * IndexData * ] * writer = create_module(writer_module_name, writer_module_doc, writer_public_objects) # <<<<<<<<<<<<<< * * */ __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_create_module); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_writer_module_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_writer_module_doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_writer_public_objects); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_7); __pyx_t_8 = 0; __pyx_t_2 = 0; __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_writer, __pyx_t_7) < 0) __PYX_ERR(0, 597, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* "libzim.pyx":604 * ############################################################################### * * reader_module_name = f"{__name__}.reader" # <<<<<<<<<<<<<< * cdef Py_ssize_t itemsize = 1 * */ __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_name_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_t_7, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_t_3, __pyx_kp_u_reader_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_reader_module_name, __pyx_t_7) < 0) __PYX_ERR(0, 604, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* "libzim.pyx":605 * * reader_module_name = f"{__name__}.reader" * cdef Py_ssize_t itemsize = 1 # <<<<<<<<<<<<<< * * cdef class ReadingBlob: */ __pyx_v_6libzim_itemsize = 1; /* "libzim.pyx":608 * * cdef class ReadingBlob: * __module__ = reader_module_name # <<<<<<<<<<<<<< * cdef zim.Blob c_blob * cdef Py_ssize_t size */ __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_reader_module_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 608, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem((PyObject *)__pyx_ptype_6libzim_ReadingBlob->tp_dict, __pyx_n_s_module_2, __pyx_t_7) < 0) __PYX_ERR(0, 608, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; PyType_Modified(__pyx_ptype_6libzim_ReadingBlob); /* "libzim.pyx":664 * *c_entry : Entry (zim::) * a pointer to the C++ entry object""" * __module__ = reader_module_name # <<<<<<<<<<<<<< * cdef zim.Entry c_entry * */ __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_reader_module_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 664, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem((PyObject *)__pyx_ptype_6libzim_Entry->tp_dict, __pyx_n_s_module_2, __pyx_t_7) < 0) __PYX_ERR(0, 664, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; PyType_Modified(__pyx_ptype_6libzim_Entry); /* "libzim.pyx":721 * *c_entry : Entry (zim::) * a pointer to the C++ entry object""" * __module__ = reader_module_name # <<<<<<<<<<<<<< * cdef zim.Item c_item * cdef ReadingBlob _blob */ __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_reader_module_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 721, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem((PyObject *)__pyx_ptype_6libzim_Item->tp_dict, __pyx_n_s_module_2, __pyx_t_7) < 0) __PYX_ERR(0, 721, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; PyType_Modified(__pyx_ptype_6libzim_Item); /* "libzim.pyx":785 * the file name of the Archive Reader object""" * * __module__ = reader_module_name # <<<<<<<<<<<<<< * cdef zim.Archive c_archive * cdef object _filename */ __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_reader_module_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 785, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem((PyObject *)__pyx_ptype_6libzim_Archive->tp_dict, __pyx_n_s_module_2, __pyx_t_7) < 0) __PYX_ERR(0, 785, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; PyType_Modified(__pyx_ptype_6libzim_Archive); /* "libzim.pyx":1011 * return f"{self.__class__.__name__}(filename={self.filename})" * * reader_module_doc = """libzim reader module # <<<<<<<<<<<<<< * * - Archive to open and read ZIM files (gives access to all `Entry`) */ if (PyDict_SetItem(__pyx_d, __pyx_n_s_reader_module_doc, __pyx_kp_u_libzim_reader_module_Archive_to) < 0) __PYX_ERR(0, 1011, __pyx_L1_error) /* "libzim.pyx":1023 * print(f"Article {entry.title} at {entry.path} is " * f"{entry.get_item().content.nbytes}b")""" * reader_public_objects = [ # <<<<<<<<<<<<<< * Archive, * Entry, */ __pyx_t_7 = PyList_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1023, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)__pyx_ptype_6libzim_Archive)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6libzim_Archive)); PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_ptype_6libzim_Archive)); __Pyx_INCREF(((PyObject *)__pyx_ptype_6libzim_Entry)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6libzim_Entry)); PyList_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_ptype_6libzim_Entry)); __Pyx_INCREF(((PyObject *)__pyx_ptype_6libzim_Item)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6libzim_Item)); PyList_SET_ITEM(__pyx_t_7, 2, ((PyObject *)__pyx_ptype_6libzim_Item)); if (PyDict_SetItem(__pyx_d, __pyx_n_s_reader_public_objects, __pyx_t_7) < 0) __PYX_ERR(0, 1023, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* "libzim.pyx":1028 * Item, * ] * reader = create_module(reader_module_name, reader_module_doc, reader_public_objects) # <<<<<<<<<<<<<< * * */ __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_create_module); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1028, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_reader_module_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1028, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_reader_module_doc); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1028, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_reader_public_objects); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1028, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1028, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_2); __pyx_t_3 = 0; __pyx_t_10 = 0; __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1028, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_reader, __pyx_t_2) < 0) __PYX_ERR(0, 1028, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":1035 * ############################################################################### * * search_module_name = f"{__name__}.search" # <<<<<<<<<<<<<< * * cdef class Query: */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1035, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1035, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_t_8, __pyx_kp_u_search_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1035, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_search_module_name, __pyx_t_2) < 0) __PYX_ERR(0, 1035, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":1039 * cdef class Query: * """ZIM agnostic Query-builder to use with a Searcher""" * __module__ = search_module_name # <<<<<<<<<<<<<< * cdef zim.Query c_query * */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_search_module_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1039, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6libzim_Query->tp_dict, __pyx_n_s_module_2, __pyx_t_2) < 0) __PYX_ERR(0, 1039, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6libzim_Query); /* "libzim.pyx":1049 * cdef class SearchResultSet: * """Iterator over a Search result: entry paths""" * __module__ = search_module_name # <<<<<<<<<<<<<< * cdef zim.SearchResultSet c_resultset * */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_search_module_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1049, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6libzim_SearchResultSet->tp_dict, __pyx_n_s_module_2, __pyx_t_2) < 0) __PYX_ERR(0, 1049, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6libzim_SearchResultSet); /* "libzim.pyx":1068 * cdef class Search: * """Search request over a ZIM Archive""" * __module__ = search_module_name # <<<<<<<<<<<<<< * cdef zim.Search c_search * */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_search_module_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1068, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6libzim_Search->tp_dict, __pyx_n_s_module_2, __pyx_t_2) < 0) __PYX_ERR(0, 1068, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6libzim_Search); /* "libzim.pyx":1104 * *c_archive : Searcher * a pointer to a C++ Searcher object""" * __module__ = search_module_name # <<<<<<<<<<<<<< * * cdef zim.Searcher c_searcher */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_search_module_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_6libzim_Searcher->tp_dict, __pyx_n_s_module_2, __pyx_t_2) < 0) __PYX_ERR(0, 1104, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_6libzim_Searcher); /* "libzim.pyx":1122 * return Search.from_search(move(self.c_searcher.search(query.c_query))) * * search_module_doc = """libzim search module # <<<<<<<<<<<<<< * * - Query to prepare a query from a string */ if (PyDict_SetItem(__pyx_d, __pyx_n_s_search_module_doc, __pyx_kp_u_libzim_search_module_Query_to_pr) < 0) __PYX_ERR(0, 1122, __pyx_L1_error) /* "libzim.pyx":1135 * for path in search.getResult(10, 10) # get result from 10 to 20 (10 results) * print(path, archive.get_entry_by_path(path).title)""" * search_public_objects = [ # <<<<<<<<<<<<<< * Searcher, * Query */ __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_ptype_6libzim_Searcher)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6libzim_Searcher)); PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_6libzim_Searcher)); __Pyx_INCREF(((PyObject *)__pyx_ptype_6libzim_Query)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6libzim_Query)); PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_ptype_6libzim_Query)); if (PyDict_SetItem(__pyx_d, __pyx_n_s_search_public_objects, __pyx_t_2) < 0) __PYX_ERR(0, 1135, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":1139 * Query * ] * search = create_module(search_module_name, search_module_doc, search_public_objects) # <<<<<<<<<<<<<< * * */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_create_module); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1139, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_search_module_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1139, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_search_module_doc); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1139, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_search_public_objects); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1139, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1139, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_10); __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1139, __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; if (PyDict_SetItem(__pyx_d, __pyx_n_s_search, __pyx_t_10) < 0) __PYX_ERR(0, 1139, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; /* "libzim.pyx":1146 * ############################################################################### * * suggestion_module_name = f"{__name__}.suggestion" # <<<<<<<<<<<<<< * * cdef class SuggestionResultSet: */ __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_name_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_t_10, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = __Pyx_PyUnicode_Concat(__pyx_t_3, __pyx_kp_u_suggestion_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_suggestion_module_name, __pyx_t_10) < 0) __PYX_ERR(0, 1146, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; /* "libzim.pyx":1150 * cdef class SuggestionResultSet: * """Iterator over a SuggestionSearch result: entry paths""" * __module__ = suggestion_module_name # <<<<<<<<<<<<<< * cdef zim.SuggestionResultSet c_resultset * */ __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_suggestion_module_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (PyDict_SetItem((PyObject *)__pyx_ptype_6libzim_SuggestionResultSet->tp_dict, __pyx_n_s_module_2, __pyx_t_10) < 0) __PYX_ERR(0, 1150, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; PyType_Modified(__pyx_ptype_6libzim_SuggestionResultSet); /* "libzim.pyx":1168 * * cdef class SuggestionSearch: * __module__ = suggestion_module_name # <<<<<<<<<<<<<< * cdef zim.SuggestionSearch c_search * */ __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_suggestion_module_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (PyDict_SetItem((PyObject *)__pyx_ptype_6libzim_SuggestionSearch->tp_dict, __pyx_n_s_module_2, __pyx_t_10) < 0) __PYX_ERR(0, 1168, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; PyType_Modified(__pyx_ptype_6libzim_SuggestionSearch); /* "libzim.pyx":1204 * *c_archive : Searcher * a pointer to a C++ Searcher object""" * __module__ = suggestion_module_name # <<<<<<<<<<<<<< * * cdef zim.SuggestionSearcher c_searcher */ __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_suggestion_module_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (PyDict_SetItem((PyObject *)__pyx_ptype_6libzim_SuggestionSearcher->tp_dict, __pyx_n_s_module_2, __pyx_t_10) < 0) __PYX_ERR(0, 1204, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; PyType_Modified(__pyx_ptype_6libzim_SuggestionSearcher); /* "libzim.pyx":1222 * return SuggestionSearch.from_search(move(self.c_searcher.suggest(query.encode('UTF-8')))) * * suggestion_module_doc = """libzim suggestion module # <<<<<<<<<<<<<< * * - SuggestionSearcher to perform a suggestion search over a libzim.reader.Archive */ if (PyDict_SetItem(__pyx_d, __pyx_n_s_suggestion_module_doc, __pyx_kp_u_libzim_suggestion_module_Suggest) < 0) __PYX_ERR(0, 1222, __pyx_L1_error) /* "libzim.pyx":1233 * for path in suggestion.getResult(10, 10) # get result from 10 to 20 (10 results) * print(path, archive.get_entry_by_path(path).title)""" * suggestion_public_objects = [ # <<<<<<<<<<<<<< * SuggestionSearcher * ] */ __pyx_t_10 = PyList_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(((PyObject *)__pyx_ptype_6libzim_SuggestionSearcher)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6libzim_SuggestionSearcher)); PyList_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_ptype_6libzim_SuggestionSearcher)); if (PyDict_SetItem(__pyx_d, __pyx_n_s_suggestion_public_objects, __pyx_t_10) < 0) __PYX_ERR(0, 1233, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; /* "libzim.pyx":1236 * SuggestionSearcher * ] * suggestion = create_module(suggestion_module_name, suggestion_module_doc, suggestion_public_objects) # <<<<<<<<<<<<<< * * version_module_doc = """libzim version module */ __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_create_module); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_suggestion_module_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_suggestion_module_doc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_suggestion_public_objects); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_suggestion, __pyx_t_7) < 0) __PYX_ERR(0, 1236, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* "libzim.pyx":1238 * suggestion = create_module(suggestion_module_name, suggestion_module_doc, suggestion_public_objects) * * version_module_doc = """libzim version module # <<<<<<<<<<<<<< * - Get version of libzim and its dependencies * - Print version of libzim and its dependencies */ if (PyDict_SetItem(__pyx_d, __pyx_n_s_version_module_doc, __pyx_kp_u_libzim_version_module_Get_versio) < 0) __PYX_ERR(0, 1238, __pyx_L1_error) /* "libzim.pyx":1253 * * * def print_versions(out: Union[sys.stdout, sys.stderr] = sys.stdout): # <<<<<<<<<<<<<< * """print libzim and its dependencies list with their versions""" * for library, version in get_versions().items(): */ __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_sys); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_stdout); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_k__49 = __pyx_t_8; __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyCFunction_NewEx(&__pyx_mdef_6libzim_3print_versions, NULL, __pyx_n_s_libzim); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (PyDict_SetItem(__pyx_d, __pyx_n_s_print_versions, __pyx_t_8) < 0) __PYX_ERR(0, 1253, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; /* "libzim.pyx":1260 * * * def get_versions() -> OrderedDict[str, str]: # <<<<<<<<<<<<<< * """ library: version mapping. Always includes `libzim`""" * versions = zim.getVersions() */ __pyx_t_8 = PyCFunction_NewEx(&__pyx_mdef_6libzim_5get_versions, NULL, __pyx_n_s_libzim); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1260, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_versions, __pyx_t_8) < 0) __PYX_ERR(0, 1260, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; /* "libzim.pyx":1268 * }) * * def get_libzim_version() -> str: # <<<<<<<<<<<<<< * """libzim version string""" * return get_versions()["libzim"] */ __pyx_t_8 = PyCFunction_NewEx(&__pyx_mdef_6libzim_7get_libzim_version, NULL, __pyx_n_s_libzim); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1268, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_libzim_version, __pyx_t_8) < 0) __PYX_ERR(0, 1268, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; /* "libzim.pyx":1273 * * version_public_objects = [ * get_libzim_version, # <<<<<<<<<<<<<< * get_versions, * print_versions, */ __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_get_libzim_version); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1273, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); /* "libzim.pyx":1274 * version_public_objects = [ * get_libzim_version, * get_versions, # <<<<<<<<<<<<<< * print_versions, * ] */ __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_get_versions); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1274, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); /* "libzim.pyx":1275 * get_libzim_version, * get_versions, * print_versions, # <<<<<<<<<<<<<< * ] * version_module_name = f"{__name__}.version" */ __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_print_versions); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); /* "libzim.pyx":1272 * return get_versions()["libzim"] * * version_public_objects = [ # <<<<<<<<<<<<<< * get_libzim_version, * get_versions, */ __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1272, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_8); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_7); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_10); PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_10); __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_10 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_version_public_objects, __pyx_t_2) < 0) __PYX_ERR(0, 1272, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":1277 * print_versions, * ] * version_module_name = f"{__name__}.version" # <<<<<<<<<<<<<< * version = create_module(version_module_name, version_module_doc, version_public_objects) * */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1277, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_10 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1277, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_t_10, __pyx_kp_u_version_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1277, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_version_module_name, __pyx_t_2) < 0) __PYX_ERR(0, 1277, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":1278 * ] * version_module_name = f"{__name__}.version" * version = create_module(version_module_name, version_module_doc, version_public_objects) # <<<<<<<<<<<<<< * * */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_create_module); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1278, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_version_module_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1278, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_version_module_doc); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1278, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_version_public_objects); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1278, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1278, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_8); __pyx_t_10 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1278, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_t_8) < 0) __PYX_ERR(0, 1278, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; /* "libzim.pyx":1281 * * * class ModuleLoader(importlib.abc.Loader): # <<<<<<<<<<<<<< * # Create our module. Easy, just return the created module * @staticmethod */ __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_importlib); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1281, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_abc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1281, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Loader); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1281, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1281, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1281, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_8, __pyx_t_3, __pyx_n_s_ModuleLoader, __pyx_n_s_ModuleLoader, (PyObject *) NULL, __pyx_n_s_libzim, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1281, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); /* "libzim.pyx":1284 * # Create our module. Easy, just return the created module * @staticmethod * def create_module(spec): # <<<<<<<<<<<<<< * return { * 'libzim.writer': writer, */ __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_12ModuleLoader_1create_module, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_ModuleLoader_create_module, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__111)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1284, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); /* "libzim.pyx":1283 * class ModuleLoader(importlib.abc.Loader): * # Create our module. Easy, just return the created module * @staticmethod # <<<<<<<<<<<<<< * def create_module(spec): * return { */ __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1283, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_create_module, __pyx_t_10) < 0) __PYX_ERR(0, 1284, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; /* "libzim.pyx":1294 * * @staticmethod * def exec_module(module): # <<<<<<<<<<<<<< * # Nothing to execute for our already existing module. * # But we need to define exec_module to tell python not use the legacy import system. */ __pyx_t_10 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_12ModuleLoader_3exec_module, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_ModuleLoader_exec_module, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__113)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1294, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); /* "libzim.pyx":1293 * }.get(spec.name, None) * * @staticmethod # <<<<<<<<<<<<<< * def exec_module(module): * # Nothing to execute for our already existing module. */ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_exec_module, __pyx_t_7) < 0) __PYX_ERR(0, 1294, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* "libzim.pyx":1281 * * * class ModuleLoader(importlib.abc.Loader): # <<<<<<<<<<<<<< * # Create our module. Easy, just return the created module * @staticmethod */ __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_8, __pyx_n_s_ModuleLoader, __pyx_t_3, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1281, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_d, __pyx_n_s_ModuleLoader, __pyx_t_7) < 0) __PYX_ERR(0, 1281, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "libzim.pyx":1299 * pass * * class ModuleFinder(importlib.abc.MetaPathFinder): # <<<<<<<<<<<<<< * def find_spec(self, fullname, path, target=None): * if fullname.startswith("libzim."): */ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_importlib); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_abc); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_MetaPathFinder); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_8, __pyx_n_s_ModuleFinder, __pyx_n_s_ModuleFinder, (PyObject *) NULL, __pyx_n_s_libzim, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); /* "libzim.pyx":1300 * * class ModuleFinder(importlib.abc.MetaPathFinder): * def find_spec(self, fullname, path, target=None): # <<<<<<<<<<<<<< * if fullname.startswith("libzim."): * return importlib.machinery.ModuleSpec(fullname, ModuleLoader) */ __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_6libzim_12ModuleFinder_1find_spec, 0, __pyx_n_s_ModuleFinder_find_spec, NULL, __pyx_n_s_libzim, __pyx_d, ((PyObject *)__pyx_codeobj__115)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__116); if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_find_spec, __pyx_t_7) < 0) __PYX_ERR(0, 1300, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* "libzim.pyx":1299 * pass * * class ModuleFinder(importlib.abc.MetaPathFinder): # <<<<<<<<<<<<<< * def find_spec(self, fullname, path, target=None): * if fullname.startswith("libzim."): */ __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_ModuleFinder, __pyx_t_8, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_d, __pyx_n_s_ModuleFinder, __pyx_t_7) < 0) __PYX_ERR(0, 1299, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; /* "libzim.pyx":1307 * * # register finder for our submodules * sys.meta_path.insert(0, ModuleFinder()) # <<<<<<<<<<<<<< * * __all__ = ["writer", "reader", "search", "suggestion", "version"] */ __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_sys); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1307, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_meta_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1307, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_insert); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1307, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ModuleFinder); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1307, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1307, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1307, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1307, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":1309 * sys.meta_path.insert(0, ModuleFinder()) * * __all__ = ["writer", "reader", "search", "suggestion", "version"] # <<<<<<<<<<<<<< * */ __pyx_t_2 = PyList_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1309, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_u_writer); __Pyx_GIVEREF(__pyx_n_u_writer); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_u_writer); __Pyx_INCREF(__pyx_n_u_reader); __Pyx_GIVEREF(__pyx_n_u_reader); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_u_reader); __Pyx_INCREF(__pyx_n_u_search); __Pyx_GIVEREF(__pyx_n_u_search); PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_u_search); __Pyx_INCREF(__pyx_n_u_suggestion); __Pyx_GIVEREF(__pyx_n_u_suggestion); PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_u_suggestion); __Pyx_INCREF(__pyx_n_u_version); __Pyx_GIVEREF(__pyx_n_u_version); PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_u_version); if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_2) < 0) __PYX_ERR(0, 1309, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libzim.pyx":1 * # This file is part of python-libzim # <<<<<<<<<<<<<< * # (see https://github.com/libzim/python-libzim) * # */ __pyx_t_2 = __Pyx_PyDict_NewPresized(0); 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; /* "pair.to_py":158 * * @cname("__pyx_convert_pair_to_py_std_3a__3a_string____std_3a__3a_string") * cdef object __pyx_convert_pair_to_py_std_3a__3a_string____std_3a__3a_string(const pair[X,Y]& p): # <<<<<<<<<<<<<< * return p.first, p.second * */ /*--- 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); __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_10); if (__pyx_m) { if (__pyx_d) { __Pyx_AddTraceback("init libzim", __pyx_clineno, __pyx_lineno, __pyx_filename); } Py_CLEAR(__pyx_m); } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init libzim"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if CYTHON_PEP489_MULTI_PHASE_INIT return (__pyx_m != NULL) ? 0 : -1; #elif PY_MAJOR_VERSION >= 3 return __pyx_m; #else return; #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(modname); if (!m) goto end; p = PyObject_GetAttrString(m, "RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* PyObjectGetAttrStr */ #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); } #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; } /* 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); } /* 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_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 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(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 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(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; } /* PyDictVersioning */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { PyObject *dict = Py_TYPE(obj)->tp_dict; return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; } static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { PyObject **dictptr = NULL; Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; if (offset) { #if CYTHON_COMPILING_IN_CPYTHON dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); #else dictptr = _PyObject_GetDictPtr(obj); #endif } return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; } static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { PyObject *dict = Py_TYPE(obj)->tp_dict; if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) return 0; return obj_dict_version == __Pyx_get_object_dict_version(obj); } #endif /* GetModuleGlobalName */ #if CYTHON_USE_DICT_VERSIONS static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) #else static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) #endif { PyObject *result; #if !CYTHON_AVOID_BORROWED_REFS #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { return __Pyx_NewRef(result); } else if (unlikely(PyErr_Occurred())) { return NULL; } #else result = PyDict_GetItem(__pyx_d, name); __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { return __Pyx_NewRef(result); } #endif #else result = PyObject_GetItem(__pyx_d, name); __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { return __Pyx_NewRef(result); } PyErr_Clear(); #endif return __Pyx_GetBuiltinName(name); } /* PyFunctionFastCall */ #if CYTHON_FAST_PYCALL static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, PyObject *globals) { PyFrameObject *f; PyThreadState *tstate = __Pyx_PyThreadState_Current; 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 = __Pyx_PyFrame_GetLocalsplus(f); 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, Py_ssize_t 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, (int)nargs, k, (int)nk, d, (int)nd, kwdefs, closure); #else result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, args, (int)nargs, k, (int)nk, d, (int)nd, closure); #endif Py_XDECREF(kwtuple); done: Py_LeaveRecursiveCall(); return result; } #endif #endif /* 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); int flags = PyCFunction_GET_FLAGS(func); assert(PyCFunction_Check(func)); assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); 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()); if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); } else { return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); } } #endif /* PyObjectCall */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *result; ternaryfunc call = Py_TYPE(func)->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 /* GetItemInt */ static 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 Py_ssize_t wrapped_i = i; if (wraparound & unlikely(i < 0)) { wrapped_i += PyList_GET_SIZE(o); } if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, wrapped_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 Py_ssize_t wrapped_i = i; if (wraparound & unlikely(i < 0)) { wrapped_i += PyTuple_GET_SIZE(o); } if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, wrapped_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(__Pyx_is_valid_index(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(__Pyx_is_valid_index(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)); } /* PyObjectSetAttrStr */ #if CYTHON_USE_TYPE_SLOTS 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); } #endif /* GetAttr */ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { #if CYTHON_USE_TYPE_SLOTS #if PY_MAJOR_VERSION >= 3 if (likely(PyUnicode_Check(n))) #else if (likely(PyString_Check(n))) #endif return __Pyx_PyObject_GetAttrStr(o, n); #endif return PyObject_GetAttr(o, n); } /* 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; if (unlikely(stop <= start)) return __Pyx_NewRef(__pyx_empty_unicode); length = stop - start; cstring += start; if (decode_func) { return decode_func(cstring, length, errors); } else { return PyUnicode_Decode(cstring, length, encoding, errors); } } /* 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 /* 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 #if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) #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 /* 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 if (likely(PyCFunction_Check(func))) { if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { return __Pyx_PyObject_CallMethO(func, arg); #if CYTHON_FAST_PYCCALL } else if (__Pyx_PyFastCFunction_Check(func)) { 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 /* HasAttr */ static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { PyObject *r; if (unlikely(!__Pyx_PyBaseString_Check(n))) { PyErr_SetString(PyExc_TypeError, "hasattr(): attribute name must be string"); return -1; } r = __Pyx_GetAttr(o, n); if (unlikely(!r)) { PyErr_Clear(); return 0; } else { Py_DECREF(r); return 1; } } /* 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(); else state = (PyGILState_STATE)0; #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 } /* PyObjectCall2Args */ static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { PyObject *args, *result = NULL; #if CYTHON_FAST_PYCALL if (PyFunction_Check(function)) { PyObject *args[2] = {arg1, arg2}; return __Pyx_PyFunction_FastCall(function, args, 2); } #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(function)) { PyObject *args[2] = {arg1, arg2}; return __Pyx_PyCFunction_FastCall(function, args, 2); } #endif args = PyTuple_New(2); if (unlikely(!args)) goto done; Py_INCREF(arg1); PyTuple_SET_ITEM(args, 0, arg1); Py_INCREF(arg2); PyTuple_SET_ITEM(args, 1, arg2); Py_INCREF(function); result = __Pyx_PyObject_Call(function, args, NULL); Py_DECREF(args); Py_DECREF(function); done: return result; } /* GetTopmostException */ #if CYTHON_USE_EXC_INFO_STACK static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) { _PyErr_StackItem *exc_info = tstate->exc_info; while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && exc_info->previous_item != NULL) { exc_info = exc_info->previous_item; } return exc_info; } #endif /* SaveResetException */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { #if CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); *type = exc_info->exc_type; *value = exc_info->exc_value; *tb = exc_info->exc_traceback; #else *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; #endif 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; #if CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = type; exc_info->exc_value = value; exc_info->exc_traceback = tb; #else 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; #endif Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } #endif /* PyErrExceptionMatches */ #if CYTHON_FAST_THREAD_STATE static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(tuple); #if PY_MAJOR_VERSION >= 3 for (i=0; icurexc_type; if (exc_type == err) return 1; if (unlikely(!exc_type)) return 0; if (unlikely(PyTuple_Check(err))) return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); } #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 #if CYTHON_USE_EXC_INFO_STACK { _PyErr_StackItem *exc_info = tstate->exc_info; tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = local_type; exc_info->exc_value = local_value; exc_info->exc_traceback = local_tb; } #else 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; #endif 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; } /* 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; #if CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = *type; exc_info->exc_value = *value; exc_info->exc_traceback = *tb; #else 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; #endif *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 /* 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(__Pyx_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } /* 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 (cause) { 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_FAST_THREAD_STATE PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } #else 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); #endif } bad: Py_XDECREF(owned_instance); return; } #endif /* IterFinish */ static CYTHON_INLINE int __Pyx_IterFinish(void) { #if CYTHON_FAST_THREAD_STATE PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject* exc_type = tstate->curexc_type; if (unlikely(exc_type)) { if (likely(__Pyx_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 } /* PyObjectGetMethod */ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { PyObject *attr; #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; descrgetfunc f = NULL; PyObject **dictptr, *dict; int meth_found = 0; assert (*method == NULL); if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { attr = __Pyx_PyObject_GetAttrStr(obj, name); goto try_unpack; } if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { return 0; } descr = _PyType_Lookup(tp, name); if (likely(descr != NULL)) { Py_INCREF(descr); #if PY_MAJOR_VERSION >= 3 #ifdef __Pyx_CyFunction_USED if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) #else if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type))) #endif #else #ifdef __Pyx_CyFunction_USED if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) #else if (likely(PyFunction_Check(descr))) #endif #endif { meth_found = 1; } else { f = Py_TYPE(descr)->tp_descr_get; if (f != NULL && PyDescr_IsData(descr)) { attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); Py_DECREF(descr); goto try_unpack; } } } dictptr = _PyObject_GetDictPtr(obj); if (dictptr != NULL && (dict = *dictptr) != NULL) { Py_INCREF(dict); attr = __Pyx_PyDict_GetItemStr(dict, name); if (attr != NULL) { Py_INCREF(attr); Py_DECREF(dict); Py_XDECREF(descr); goto try_unpack; } Py_DECREF(dict); } if (meth_found) { *method = descr; return 1; } if (f != NULL) { attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); Py_DECREF(descr); goto try_unpack; } if (descr != NULL) { *method = descr; return 0; } PyErr_Format(PyExc_AttributeError, #if PY_MAJOR_VERSION >= 3 "'%.50s' object has no attribute '%U'", tp->tp_name, name); #else "'%.50s' object has no attribute '%.400s'", tp->tp_name, PyString_AS_STRING(name)); #endif return 0; #else attr = __Pyx_PyObject_GetAttrStr(obj, name); goto try_unpack; #endif try_unpack: #if CYTHON_UNPACK_METHODS if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { PyObject *function = PyMethod_GET_FUNCTION(attr); Py_INCREF(function); Py_DECREF(attr); *method = function; return 1; } #endif *method = attr; return 0; } /* PyObjectCallMethod0 */ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { PyObject *method = NULL, *result = NULL; int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); if (likely(is_method)) { result = __Pyx_PyObject_CallOneArg(method, obj); Py_DECREF(method); return result; } if (unlikely(!method)) goto bad; result = __Pyx_PyObject_CallNoArg(method); Py_DECREF(method); bad: return result; } /* 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"); } /* 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); } /* UnpackItemEndCheck */ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { if (unlikely(retval)) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; } return __Pyx_IterFinish(); } /* 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_exact( PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) { PyObject *value1 = NULL, *value2 = NULL; #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); Py_INCREF(value1); value2 = PyTuple_GET_ITEM(tuple, 1); Py_INCREF(value2); #endif if (decref_tuple) { Py_DECREF(tuple); } *pvalue1 = value1; *pvalue2 = value2; return 0; #if CYTHON_COMPILING_IN_PYPY bad: Py_XDECREF(value1); Py_XDECREF(value2); if (decref_tuple) { Py_XDECREF(tuple); } return -1; #endif } static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int has_known_size, int decref_tuple) { Py_ssize_t index; PyObject *value1 = NULL, *value2 = NULL, *iter = NULL; 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); *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 (is_dict) { #if !CYTHON_COMPILING_IN_PYPY *p_orig_length = PyDict_Size(iterable); Py_INCREF(iterable); return iterable; #elif PY_MAJOR_VERSION >= 3 static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL; PyObject **pp = NULL; if (method_name) { const char *name = PyUnicode_AsUTF8(method_name); if (strcmp(name, "iteritems") == 0) pp = &py_items; else if (strcmp(name, "iterkeys") == 0) pp = &py_keys; else if (strcmp(name, "itervalues") == 0) pp = &py_values; if (pp) { if (!*pp) { *pp = PyUnicode_FromString(name + 4); if (!*pp) return NULL; } method_name = *pp; } } #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; } /* ArgTypeTest */ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) { if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } else if (exact) { #if PY_MAJOR_VERSION == 2 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; #endif } else { if (likely(__Pyx_TypeCheck(obj, type))) return 1; } PyErr_Format(PyExc_TypeError, "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } /* IterNext */ static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) { PyObject* exc_type; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign exc_type = __Pyx_PyErr_Occurred(); if (unlikely(exc_type)) { if (!defval || unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) return NULL; __Pyx_PyErr_Clear(); Py_INCREF(defval); return defval; } if (defval) { Py_INCREF(defval); return defval; } __Pyx_PyErr_SetNone(PyExc_StopIteration); return NULL; } static void __Pyx_PyIter_Next_ErrorNoIterator(PyObject *iterator) { PyErr_Format(PyExc_TypeError, "%.200s object is not an iterator", Py_TYPE(iterator)->tp_name); } static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) { PyObject* next; iternextfunc iternext = Py_TYPE(iterator)->tp_iternext; if (likely(iternext)) { #if CYTHON_USE_TYPE_SLOTS next = iternext(iterator); if (likely(next)) return next; #if PY_VERSION_HEX >= 0x02070000 if (unlikely(iternext == &_PyObject_NextNotImplemented)) return NULL; #endif #else next = PyIter_Next(iterator); if (likely(next)) return next; #endif } else if (CYTHON_USE_TYPE_SLOTS || unlikely(!PyIter_Check(iterator))) { __Pyx_PyIter_Next_ErrorNoIterator(iterator); return NULL; } #if !CYTHON_USE_TYPE_SLOTS else { next = PyIter_Next(iterator); if (likely(next)) return next; } #endif return __Pyx_PyIter_Next2Default(defval); } /* JoinPyUnicode */ static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, CYTHON_UNUSED Py_UCS4 max_char) { #if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS PyObject *result_uval; int result_ukind; Py_ssize_t i, char_pos; void *result_udata; #if CYTHON_PEP393_ENABLED result_uval = PyUnicode_New(result_ulength, max_char); if (unlikely(!result_uval)) return NULL; result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; result_udata = PyUnicode_DATA(result_uval); #else result_uval = PyUnicode_FromUnicode(NULL, result_ulength); if (unlikely(!result_uval)) return NULL; result_ukind = sizeof(Py_UNICODE); result_udata = PyUnicode_AS_UNICODE(result_uval); #endif char_pos = 0; for (i=0; i < value_count; i++) { int ukind; Py_ssize_t ulength; void *udata; PyObject *uval = PyTuple_GET_ITEM(value_tuple, i); if (unlikely(__Pyx_PyUnicode_READY(uval))) goto bad; ulength = __Pyx_PyUnicode_GET_LENGTH(uval); if (unlikely(!ulength)) continue; if (unlikely(char_pos + ulength < 0)) goto overflow; ukind = __Pyx_PyUnicode_KIND(uval); udata = __Pyx_PyUnicode_DATA(uval); if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) { memcpy((char *)result_udata + char_pos * result_ukind, udata, (size_t) (ulength * result_ukind)); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters) _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); #else Py_ssize_t j; for (j=0; j < ulength; j++) { Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); } #endif } char_pos += ulength; } return result_uval; overflow: PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); bad: Py_DECREF(result_uval); return NULL; #else result_ulength++; value_count++; return PyUnicode_Join(__pyx_empty_unicode, value_tuple); #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; #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) Py_hash_t hash1, hash2; hash1 = ((PyBytesObject*)s1)->ob_shash; hash2 = ((PyBytesObject*)s2)->ob_shash; if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { return (equals == Py_NE); } #endif 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; } #if CYTHON_USE_UNICODE_INTERNALS { Py_hash_t hash1, hash2; #if CYTHON_PEP393_ENABLED hash1 = ((PyASCIIObject*)s1)->hash; hash2 = ((PyASCIIObject*)s2)->hash; #else hash1 = ((PyUnicodeObject*)s1)->hash; hash2 = ((PyUnicodeObject*)s2)->hash; #endif if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { goto return_ne; } } #endif 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_MAJOR_VERSION < 3 Py_XDECREF(owned_ref); #endif 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 } /* PyUnicode_Unicode */ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj) { if (unlikely(obj == Py_None)) obj = __pyx_kp_u_None; return __Pyx_NewRef(obj); } /* DictGetItem */ #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()) { if (unlikely(PyTuple_Check(key))) { PyObject* args = PyTuple_Pack(1, key); if (likely(args)) { PyErr_SetObject(PyExc_KeyError, args); Py_DECREF(args); } } else { PyErr_SetObject(PyExc_KeyError, key); } } return NULL; } Py_INCREF(value); return value; } #endif /* UnpackUnboundCMethod */ static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { PyObject *method; method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); if (unlikely(!method)) return -1; target->method = method; #if CYTHON_COMPILING_IN_CPYTHON #if PY_MAJOR_VERSION >= 3 if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) #endif { PyMethodDescrObject *descr = (PyMethodDescrObject*) method; target->func = descr->d_method->ml_meth; target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); } #endif return 0; } /* CallUnboundCMethod1 */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) { if (likely(cfunc->func)) { int flag = cfunc->flag; if (flag == METH_O) { return (*(cfunc->func))(self, arg); } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) { #if PY_VERSION_HEX >= 0x030700A0 return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1); #else return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); #endif } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) { return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); } } return __Pyx__CallUnboundCMethod1(cfunc, self, arg); } #endif static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){ PyObject *args, *result = NULL; if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; #if CYTHON_COMPILING_IN_CPYTHON if (cfunc->func && (cfunc->flag & METH_VARARGS)) { args = PyTuple_New(1); if (unlikely(!args)) goto bad; Py_INCREF(arg); PyTuple_SET_ITEM(args, 0, arg); if (cfunc->flag & METH_KEYWORDS) result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL); else result = (*cfunc->func)(self, args); } else { 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); result = __Pyx_PyObject_Call(cfunc->method, args, NULL); } #else args = PyTuple_Pack(2, self, arg); if (unlikely(!args)) goto bad; result = __Pyx_PyObject_Call(cfunc->method, args, NULL); #endif bad: Py_XDECREF(args); return result; } /* CallUnboundCMethod2 */ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1 static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { if (likely(cfunc->func)) { PyObject *args[2] = {arg1, arg2}; if (cfunc->flag == METH_FASTCALL) { #if PY_VERSION_HEX >= 0x030700A0 return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2); #else return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL); #endif } #if PY_VERSION_HEX >= 0x030700A0 if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL); #endif } return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2); } #endif static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){ PyObject *args, *result = NULL; if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; #if CYTHON_COMPILING_IN_CPYTHON if (cfunc->func && (cfunc->flag & METH_VARARGS)) { args = PyTuple_New(2); if (unlikely(!args)) goto bad; Py_INCREF(arg1); PyTuple_SET_ITEM(args, 0, arg1); Py_INCREF(arg2); PyTuple_SET_ITEM(args, 1, arg2); if (cfunc->flag & METH_KEYWORDS) result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL); else result = (*cfunc->func)(self, args); } else { args = PyTuple_New(3); if (unlikely(!args)) goto bad; Py_INCREF(self); PyTuple_SET_ITEM(args, 0, self); Py_INCREF(arg1); PyTuple_SET_ITEM(args, 1, arg1); Py_INCREF(arg2); PyTuple_SET_ITEM(args, 2, arg2); result = __Pyx_PyObject_Call(cfunc->method, args, NULL); } #else args = PyTuple_Pack(3, self, arg1, arg2); if (unlikely(!args)) goto bad; result = __Pyx_PyObject_Call(cfunc->method, args, NULL); #endif bad: Py_XDECREF(args); return result; } /* dict_getitem_default */ static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { PyObject* value; #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY value = PyDict_GetItemWithError(d, key); if (unlikely(!value)) { if (unlikely(PyErr_Occurred())) return NULL; value = default_value; } Py_INCREF(value); if ((1)); #else if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) { value = PyDict_GetItem(d, key); if (unlikely(!value)) { value = default_value; } Py_INCREF(value); } #endif else { if (default_value == Py_None) value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key); else value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value); } return value; } /* PyObject_GenericGetAttrNoDict */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { PyErr_Format(PyExc_AttributeError, #if PY_MAJOR_VERSION >= 3 "'%.50s' object has no attribute '%U'", tp->tp_name, attr_name); #else "'%.50s' object has no attribute '%.400s'", tp->tp_name, PyString_AS_STRING(attr_name)); #endif return NULL; } static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { PyObject *descr; PyTypeObject *tp = Py_TYPE(obj); if (unlikely(!PyString_Check(attr_name))) { return PyObject_GenericGetAttr(obj, attr_name); } assert(!tp->tp_dictoffset); descr = _PyType_Lookup(tp, attr_name); if (unlikely(!descr)) { return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); } Py_INCREF(descr); #if PY_MAJOR_VERSION < 3 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) #endif { descrgetfunc f = Py_TYPE(descr)->tp_descr_get; if (unlikely(f)) { PyObject *res = f(descr, obj, (PyObject *)tp); Py_DECREF(descr); return res; } } return descr; } #endif /* PyObject_GenericGetAttr */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { return PyObject_GenericGetAttr(obj, attr_name); } return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); } #endif /* PyObjectGetAttrStrNoError */ static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) __Pyx_PyErr_Clear(); } static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { PyObject *result; #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); } #endif result = __Pyx_PyObject_GetAttrStr(obj, attr_name); if (unlikely(!result)) { __Pyx_PyObject_GetAttrStr_ClearAttributeError(); } return result; } /* SetupReduce */ static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; PyObject *name_attr; name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2); if (likely(name_attr)) { ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); } else { ret = -1; } if (unlikely(ret < 0)) { PyErr_Clear(); ret = 0; } Py_XDECREF(name_attr); return ret; } static int __Pyx_setup_reduce(PyObject* type_obj) { int ret = 0; PyObject *object_reduce = NULL; PyObject *object_getstate = NULL; PyObject *object_reduce_ex = NULL; PyObject *reduce = NULL; PyObject *reduce_ex = NULL; PyObject *reduce_cython = NULL; PyObject *setstate = NULL; PyObject *setstate_cython = NULL; PyObject *getstate = NULL; #if CYTHON_USE_PYTYPE_LOOKUP getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate); #else getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate); if (!getstate && PyErr_Occurred()) { goto __PYX_BAD; } #endif if (getstate) { #if CYTHON_USE_PYTYPE_LOOKUP object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate); #else object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate); if (!object_getstate && PyErr_Occurred()) { goto __PYX_BAD; } #endif if (object_getstate != getstate) { goto __PYX_GOOD; } } #if CYTHON_USE_PYTYPE_LOOKUP object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; #else object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; #endif reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; if (reduce_ex == object_reduce_ex) { #if CYTHON_USE_PYTYPE_LOOKUP object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; #else object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; #endif reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); if (likely(reduce_cython)) { ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; } else if (reduce == object_reduce || PyErr_Occurred()) { goto __PYX_BAD; } setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); if (!setstate) PyErr_Clear(); if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); if (likely(setstate_cython)) { ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; } else if (!setstate || PyErr_Occurred()) { goto __PYX_BAD; } } PyType_Modified((PyTypeObject*)type_obj); } } goto __PYX_GOOD; __PYX_BAD: if (!PyErr_Occurred()) PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); ret = -1; __PYX_GOOD: #if !CYTHON_USE_PYTYPE_LOOKUP Py_XDECREF(object_reduce); Py_XDECREF(object_reduce_ex); Py_XDECREF(object_getstate); Py_XDECREF(getstate); #endif Py_XDECREF(reduce); Py_XDECREF(reduce_ex); Py_XDECREF(reduce_cython); Py_XDECREF(setstate); Py_XDECREF(setstate_cython); return ret; } /* 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; } /* TypeImport */ #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize check_size) { PyObject *result = 0; char warning[200]; Py_ssize_t basicsize; Py_ssize_t itemsize; #ifdef Py_LIMITED_API PyObject *py_basicsize; PyObject *py_itemsize; #endif result = PyObject_GetAttrString(module, class_name); 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; itemsize = ((PyTypeObject *)result)->tp_itemsize; #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; py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); if (!py_itemsize) goto bad; itemsize = PyLong_AsSsize_t(py_itemsize); Py_DECREF(py_itemsize); py_itemsize = 0; if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; #endif if (itemsize) { if (size % alignment) { alignment = size % alignment; } if (itemsize < (Py_ssize_t)alignment) itemsize = (Py_ssize_t)alignment; } if ((size_t)(basicsize + itemsize) < size) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", module_name, class_name, size, basicsize); goto bad; } if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", module_name, class_name, size, basicsize); goto bad; } else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", module_name, class_name, size, basicsize); if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(result); return NULL; } #endif /* 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_MAJOR_VERSION < 3 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 ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; PyErr_Clear(); } } level = 0; } #endif if (!module) { #if PY_MAJOR_VERSION < 3 PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, level); #endif } } bad: #if PY_MAJOR_VERSION < 3 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; } /* 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_2, 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_2, 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; } /* 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; } /* CythonFunctionShared */ #include 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, CYTHON_UNUSED void *context) { 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, CYTHON_UNUSED void *context) { 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, CYTHON_UNUSED void *context) { 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, CYTHON_UNUSED void *context) { Py_INCREF(op->func_qualname); return op->func_qualname; } static int __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) { 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, CYTHON_UNUSED void *context) { 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, CYTHON_UNUSED void *context) { 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, CYTHON_UNUSED void *context) { Py_INCREF(op->func_globals); return op->func_globals; } static PyObject * __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { Py_INCREF(Py_None); return Py_None; } static PyObject * __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { 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, CYTHON_UNUSED void *context) { 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, CYTHON_UNUSED void *context) { 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, CYTHON_UNUSED void *context) { 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, CYTHON_UNUSED void *context) { 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, CYTHON_UNUSED void *context) { 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, CYTHON_UNUSED void *context) { 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(PyCFunctionObject, 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 Py_INCREF(m->func_qualname); return m->func_qualname; #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_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { if (unlikely(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_size = 0; op->defaults = NULL; op->defaults_tuple = NULL; op->defaults_kwdict = NULL; op->defaults_getter = NULL; op->func_annotations = NULL; 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) { if (__Pyx_CyFunction_weakreflist(m) != NULL) PyObject_ClearWeakRefs((PyObject *) m); __Pyx_CyFunction_clear(m); PyObject_GC_Del(m); } static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) { PyObject_GC_UnTrack(m); __Pyx__CyFunction_dealloc(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) { #if PY_MAJOR_VERSION < 3 __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; #endif 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)(void*)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; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS arg0 = PyTuple_GET_ITEM(arg, 0); #else arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; #endif result = (*meth)(self, arg0); #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) Py_DECREF(arg0); #endif 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); #if PY_MAJOR_VERSION > 2 PyErr_Format(PyExc_TypeError, "unbound method %.200S() needs an argument", cyfunc->func_qualname); #else PyErr_SetString(PyExc_TypeError, "unbound method needs an argument"); #endif 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 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 0, #endif }; static int __pyx_CyFunction_init(void) { __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); if (unlikely(__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 (unlikely(!m->defaults)) return PyErr_NoMemory(); memset(m->defaults, 0, size); m->defaults_pyobjects = pyobjects; m->defaults_size = size; 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); } /* CythonFunction */ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { PyObject *op = __Pyx_CyFunction_Init( PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), ml, flags, qualname, closure, module, globals, code ); if (likely(op)) { PyObject_GC_Track(op); } return op; } /* ObjectGetItem */ #if CYTHON_USE_TYPE_SLOTS static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { PyObject *runerr = NULL; Py_ssize_t key_value; PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; if (unlikely(!(m && m->sq_item))) { PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); return NULL; } key_value = __Pyx_PyIndex_AsSsize_t(index); if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); } if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { PyErr_Clear(); PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); } return NULL; } static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; if (likely(m && m->mp_subscript)) { return m->mp_subscript(obj, key); } return __Pyx_PyObject_GetIndex(obj, key); } #endif /* CyFunctionClassCell */ static int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, PyObject *classobj) { Py_ssize_t i, count = PyList_GET_SIZE(cyfunctions); for (i = 0; i < count; i++) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS PyList_GET_ITEM(cyfunctions, i); #else PySequence_ITEM(cyfunctions, i); if (unlikely(!m)) return -1; #endif Py_INCREF(classobj); m->func_classobj = classobj; #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) Py_DECREF((PyObject*)m); #endif } return 0; } /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif if (unlikely(!__pyx_cython_runtime)) { return c_line; } __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); #if CYTHON_COMPILING_IN_CPYTHON cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); if (likely(cython_runtime_dict)) { __PYX_PY_DICT_LOOKUP_IF_MODIFIED( use_cline, *cython_runtime_dict, __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) } else #endif { PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); if (use_cline_obj) { use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; Py_DECREF(use_cline_obj); } else { PyErr_Clear(); use_cline = NULL; } } if (!use_cline) { c_line = 0; (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; } __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); return c_line; } #endif /* 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" #if PY_VERSION_HEX >= 0x030b00a6 #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = NULL; PyObject *py_funcname = NULL; #if PY_MAJOR_VERSION < 3 PyObject *py_srcfile = NULL; py_srcfile = PyString_FromString(filename); if (!py_srcfile) goto bad; #endif if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); if (!py_funcname) goto bad; #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); if (!py_funcname) goto bad; funcname = PyUnicode_AsUTF8(py_funcname); if (!funcname) goto bad; #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); if (!py_funcname) goto bad; #endif } #if PY_MAJOR_VERSION < 3 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); #else py_code = PyCode_NewEmpty(filename, funcname, py_line); #endif Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline return py_code; bad: Py_XDECREF(py_funcname); #if PY_MAJOR_VERSION < 3 Py_XDECREF(py_srcfile); #endif 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; PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject *ptype, *pvalue, *ptraceback; if (c_line) { c_line = __Pyx_CLineForTraceback(tstate, c_line); } py_code = __pyx_find_code_object(c_line ? -c_line : py_line); if (!py_code) { __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) { /* If the code object creation fails, then we should clear the fetched exception references and propagate the new exception */ Py_XDECREF(ptype); Py_XDECREF(pvalue); Py_XDECREF(ptraceback); goto bad; } __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } py_frame = PyFrame_New( tstate, /*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); } /* 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_zim_3a__3a_writer_3a__3a_HintKeys(zim::writer::HintKeys value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const zim::writer::HintKeys neg_one = (zim::writer::HintKeys) -1, const_zero = (zim::writer::HintKeys) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(zim::writer::HintKeys) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(zim::writer::HintKeys) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(zim::writer::HintKeys) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(zim::writer::HintKeys) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(zim::writer::HintKeys) <= 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(zim::writer::HintKeys), little, !is_unsigned); } } /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const int neg_one = (int) -1, const_zero = (int) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif 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; } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const long neg_one = (long) -1, const_zero = (long) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif 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); } } /* CIntFromPy */ static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif 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 uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif 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 zim::writer::HintKeys __Pyx_PyInt_As_zim_3a__3a_writer_3a__3a_HintKeys(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const zim::writer::HintKeys neg_one = (zim::writer::HintKeys) -1, const_zero = (zim::writer::HintKeys) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(zim::writer::HintKeys) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(zim::writer::HintKeys, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (zim::writer::HintKeys) 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 (zim::writer::HintKeys) 0; case 1: __PYX_VERIFY_RETURN_INT(zim::writer::HintKeys, digit, digits[0]) case 2: if (8 * sizeof(zim::writer::HintKeys) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(zim::writer::HintKeys, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(zim::writer::HintKeys) >= 2 * PyLong_SHIFT) { return (zim::writer::HintKeys) (((((zim::writer::HintKeys)digits[1]) << PyLong_SHIFT) | (zim::writer::HintKeys)digits[0])); } } break; case 3: if (8 * sizeof(zim::writer::HintKeys) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(zim::writer::HintKeys, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(zim::writer::HintKeys) >= 3 * PyLong_SHIFT) { return (zim::writer::HintKeys) (((((((zim::writer::HintKeys)digits[2]) << PyLong_SHIFT) | (zim::writer::HintKeys)digits[1]) << PyLong_SHIFT) | (zim::writer::HintKeys)digits[0])); } } break; case 4: if (8 * sizeof(zim::writer::HintKeys) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(zim::writer::HintKeys, 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(zim::writer::HintKeys) >= 4 * PyLong_SHIFT) { return (zim::writer::HintKeys) (((((((((zim::writer::HintKeys)digits[3]) << PyLong_SHIFT) | (zim::writer::HintKeys)digits[2]) << PyLong_SHIFT) | (zim::writer::HintKeys)digits[1]) << PyLong_SHIFT) | (zim::writer::HintKeys)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 (zim::writer::HintKeys) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(zim::writer::HintKeys) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(zim::writer::HintKeys, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(zim::writer::HintKeys) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(zim::writer::HintKeys, 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 (zim::writer::HintKeys) 0; case -1: __PYX_VERIFY_RETURN_INT(zim::writer::HintKeys, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(zim::writer::HintKeys, digit, +digits[0]) case -2: if (8 * sizeof(zim::writer::HintKeys) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(zim::writer::HintKeys, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(zim::writer::HintKeys) - 1 > 2 * PyLong_SHIFT) { return (zim::writer::HintKeys) (((zim::writer::HintKeys)-1)*(((((zim::writer::HintKeys)digits[1]) << PyLong_SHIFT) | (zim::writer::HintKeys)digits[0]))); } } break; case 2: if (8 * sizeof(zim::writer::HintKeys) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(zim::writer::HintKeys, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(zim::writer::HintKeys) - 1 > 2 * PyLong_SHIFT) { return (zim::writer::HintKeys) ((((((zim::writer::HintKeys)digits[1]) << PyLong_SHIFT) | (zim::writer::HintKeys)digits[0]))); } } break; case -3: if (8 * sizeof(zim::writer::HintKeys) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(zim::writer::HintKeys, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(zim::writer::HintKeys) - 1 > 3 * PyLong_SHIFT) { return (zim::writer::HintKeys) (((zim::writer::HintKeys)-1)*(((((((zim::writer::HintKeys)digits[2]) << PyLong_SHIFT) | (zim::writer::HintKeys)digits[1]) << PyLong_SHIFT) | (zim::writer::HintKeys)digits[0]))); } } break; case 3: if (8 * sizeof(zim::writer::HintKeys) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(zim::writer::HintKeys, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(zim::writer::HintKeys) - 1 > 3 * PyLong_SHIFT) { return (zim::writer::HintKeys) ((((((((zim::writer::HintKeys)digits[2]) << PyLong_SHIFT) | (zim::writer::HintKeys)digits[1]) << PyLong_SHIFT) | (zim::writer::HintKeys)digits[0]))); } } break; case -4: if (8 * sizeof(zim::writer::HintKeys) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(zim::writer::HintKeys, 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(zim::writer::HintKeys) - 1 > 4 * PyLong_SHIFT) { return (zim::writer::HintKeys) (((zim::writer::HintKeys)-1)*(((((((((zim::writer::HintKeys)digits[3]) << PyLong_SHIFT) | (zim::writer::HintKeys)digits[2]) << PyLong_SHIFT) | (zim::writer::HintKeys)digits[1]) << PyLong_SHIFT) | (zim::writer::HintKeys)digits[0]))); } } break; case 4: if (8 * sizeof(zim::writer::HintKeys) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(zim::writer::HintKeys, 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(zim::writer::HintKeys) - 1 > 4 * PyLong_SHIFT) { return (zim::writer::HintKeys) ((((((((((zim::writer::HintKeys)digits[3]) << PyLong_SHIFT) | (zim::writer::HintKeys)digits[2]) << PyLong_SHIFT) | (zim::writer::HintKeys)digits[1]) << PyLong_SHIFT) | (zim::writer::HintKeys)digits[0]))); } } break; } #endif if (sizeof(zim::writer::HintKeys) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(zim::writer::HintKeys, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(zim::writer::HintKeys) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(zim::writer::HintKeys, 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 zim::writer::HintKeys 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 (zim::writer::HintKeys) -1; } } else { zim::writer::HintKeys val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (zim::writer::HintKeys) -1; val = __Pyx_PyInt_As_zim_3a__3a_writer_3a__3a_HintKeys(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to zim::writer::HintKeys"); return (zim::writer::HintKeys) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to zim::writer::HintKeys"); return (zim::writer::HintKeys) -1; } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint64_t(uint64_t value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif 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); } } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const int neg_one = (int) -1, const_zero = (int) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif 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_unsigned_int(unsigned int value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(unsigned int) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(unsigned int) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(unsigned int) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(unsigned 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(unsigned int), little, !is_unsigned); } } /* CIntFromPy */ static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(unsigned int) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (unsigned 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 (unsigned int) 0; case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, digits[0]) case 2: if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT) { return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); } } break; case 3: if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT) { return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); } } break; case 4: if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned int) >= 4 * PyLong_SHIFT) { return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned 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 (unsigned int) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(unsigned int) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned 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 (unsigned int) 0; case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, +digits[0]) case -2: if (8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); } } break; case 2: if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); } } break; case -3: if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); } } break; case 3: if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); } } break; case -4: if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned int) - 1 > 4 * PyLong_SHIFT) { return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); } } break; case 4: if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned int) - 1 > 4 * PyLong_SHIFT) { return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); } } break; } #endif if (sizeof(unsigned int) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned 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 unsigned 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 (unsigned int) -1; } } else { unsigned int val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (unsigned int) -1; val = __Pyx_PyInt_As_unsigned_int(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned int"); return (unsigned int) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned int"); return (unsigned int) -1; } /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const long neg_one = (long) -1, const_zero = (long) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif 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; } /* FastTypeChecks */ #if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { a = a->tp_base; if (a == b) return 1; } return b == &PyBaseObject_Type; } static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { PyObject *mro; if (a == b) return 1; mro = a->tp_mro; if (likely(mro)) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(mro); for (i = 0; i < n; i++) { if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) return 1; } return 0; } return __Pyx_InBases(a, b); } #if PY_MAJOR_VERSION == 2 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { PyObject *exception, *value, *tb; int res; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ErrFetch(&exception, &value, &tb); res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; if (unlikely(res == -1)) { PyErr_WriteUnraisable(err); res = 0; } if (!res) { res = PyObject_IsSubclass(err, exc_type2); if (unlikely(res == -1)) { PyErr_WriteUnraisable(err); res = 0; } } __Pyx_ErrRestore(exception, value, tb); return res; } #else static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; if (!res) { res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); } return res; } #endif static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { Py_ssize_t i, n; assert(PyExceptionClass_Check(exc_type)); n = PyTuple_GET_SIZE(tuple); #if PY_MAJOR_VERSION >= 3 for (i=0; i #include #if PY_VERSION_HEX >= 0x030b00a6 #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif #define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom) static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) { PyObject *et, *ev, *tb; PyObject *value = NULL; __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 (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) { value = ev; } if (likely(value)) { Py_XDECREF(tb); Py_DECREF(et); *pvalue = value; return 0; } } else if (!__Pyx_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; } static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) { PyObject *t, *v, *tb; t = exc_state->exc_type; v = exc_state->exc_value; tb = exc_state->exc_traceback; exc_state->exc_type = NULL; exc_state->exc_value = NULL; exc_state->exc_traceback = NULL; Py_XDECREF(t); Py_XDECREF(v); Py_XDECREF(tb); } #define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL) static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) { const char *msg; if ((0)) { #ifdef __Pyx_Coroutine_USED } else if (__Pyx_Coroutine_Check((PyObject*)gen)) { msg = "coroutine already executing"; #endif #ifdef __Pyx_AsyncGen_USED } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) { msg = "async generator already executing"; #endif } else { msg = "generator already executing"; } PyErr_SetString(PyExc_ValueError, msg); } #define __Pyx_Coroutine_NotStartedError(gen) (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL) static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) { const char *msg; if ((0)) { #ifdef __Pyx_Coroutine_USED } else if (__Pyx_Coroutine_Check(gen)) { msg = "can't send non-None value to a just-started coroutine"; #endif #ifdef __Pyx_AsyncGen_USED } else if (__Pyx_AsyncGen_CheckExact(gen)) { msg = "can't send non-None value to a just-started async generator"; #endif } else { msg = "can't send non-None value to a just-started generator"; } PyErr_SetString(PyExc_TypeError, msg); } #define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing) (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL) static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) { #ifdef __Pyx_Coroutine_USED if (!closing && __Pyx_Coroutine_Check(gen)) { PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine"); } else #endif if (value) { #ifdef __Pyx_AsyncGen_USED if (__Pyx_AsyncGen_CheckExact(gen)) PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration); else #endif PyErr_SetNone(PyExc_StopIteration); } } static PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) { __Pyx_PyThreadState_declare PyThreadState *tstate; __Pyx_ExcInfoStruct *exc_state; PyObject *retval; assert(!self->is_running); if (unlikely(self->resume_label == 0)) { if (unlikely(value && value != Py_None)) { return __Pyx_Coroutine_NotStartedError((PyObject*)self); } } if (unlikely(self->resume_label == -1)) { return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing); } #if CYTHON_FAST_THREAD_STATE __Pyx_PyThreadState_assign tstate = __pyx_tstate; #else tstate = __Pyx_PyThreadState_Current; #endif exc_state = &self->gi_exc_state; if (exc_state->exc_type) { #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON #else if (exc_state->exc_traceback) { PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback; PyFrameObject *f = tb->tb_frame; assert(f->f_back == NULL); #if PY_VERSION_HEX >= 0x030B00A1 f->f_back = PyThreadState_GetFrame(tstate); #else Py_XINCREF(tstate->frame); f->f_back = tstate->frame; #endif } #endif } #if CYTHON_USE_EXC_INFO_STACK exc_state->previous_item = tstate->exc_info; tstate->exc_info = exc_state; #else if (exc_state->exc_type) { __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); } else { __Pyx_Coroutine_ExceptionClear(exc_state); __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); } #endif self->is_running = 1; retval = self->body((PyObject *) self, tstate, value); self->is_running = 0; #if CYTHON_USE_EXC_INFO_STACK exc_state = &self->gi_exc_state; tstate->exc_info = exc_state->previous_item; exc_state->previous_item = NULL; __Pyx_Coroutine_ResetFrameBackpointer(exc_state); #endif return retval; } static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) { PyObject *exc_tb = exc_state->exc_traceback; if (likely(exc_tb)) { #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON #else PyTracebackObject *tb = (PyTracebackObject *) exc_tb; PyFrameObject *f = tb->tb_frame; Py_CLEAR(f->f_back); #endif } } static CYTHON_INLINE PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) { if (unlikely(!retval)) { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign if (!__Pyx_PyErr_Occurred()) { PyObject *exc = PyExc_StopIteration; #ifdef __Pyx_AsyncGen_USED if (__Pyx_AsyncGen_CheckExact(gen)) exc = __Pyx_PyExc_StopAsyncIteration; #endif __Pyx_PyErr_SetNone(exc); } } return retval; } #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) static CYTHON_INLINE PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) { #if PY_VERSION_HEX <= 0x030A00A1 return _PyGen_Send(gen, arg); #else PyObject *result; if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) { if (PyAsyncGen_CheckExact(gen)) { assert(result == Py_None); PyErr_SetNone(PyExc_StopAsyncIteration); } else if (result == Py_None) { PyErr_SetNone(PyExc_StopIteration); } else { _PyGen_SetStopIterationValue(result); } Py_CLEAR(result); } return result; #endif } #endif static CYTHON_INLINE PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) { PyObject *ret; PyObject *val = NULL; __Pyx_Coroutine_Undelegate(gen); __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val); ret = __Pyx_Coroutine_SendEx(gen, val, 0); 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(gen->is_running)) return __Pyx_Coroutine_AlreadyRunningError(gen); 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_Check(yf)) { ret = __Pyx_Coroutine_Send(yf, value); } else #endif #ifdef __Pyx_AsyncGen_USED if (__pyx_PyAsyncGenASend_CheckExact(yf)) { ret = __Pyx_async_gen_asend_send(yf, value); } else #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) if (PyGen_CheckExact(yf)) { ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); } else #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) if (PyCoro_CheckExact(yf)) { ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : 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, 0); } return __Pyx_Coroutine_MethodReturn(self, 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_Check(yf)) { retval = __Pyx_Coroutine_Close(yf); if (!retval) return -1; } else if (__Pyx_CoroutineAwait_CheckExact(yf)) { retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL); if (!retval) return -1; } else #endif #ifdef __Pyx_AsyncGen_USED if (__pyx_PyAsyncGenASend_CheckExact(yf)) { retval = __Pyx_async_gen_asend_close(yf, NULL); } else if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) { retval = __Pyx_async_gen_athrow_close(yf, NULL); } 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(gen->is_running)) return __Pyx_Coroutine_AlreadyRunningError(gen); if (yf) { PyObject *ret; gen->is_running = 1; #ifdef __Pyx_Generator_USED if (__Pyx_Generator_CheckExact(yf)) { ret = __Pyx_Generator_Next(yf); } else #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) if (PyGen_CheckExact(yf)) { ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL); } else #endif #ifdef __Pyx_Coroutine_USED if (__Pyx_Coroutine_Check(yf)) { ret = __Pyx_Coroutine_Send(yf, Py_None); } 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, 0); } static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) { return __Pyx_Coroutine_Close(self); } 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(gen->is_running)) return __Pyx_Coroutine_AlreadyRunningError(gen); 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, 1); if (unlikely(retval)) { const char *msg; Py_DECREF(retval); if ((0)) { #ifdef __Pyx_Coroutine_USED } else if (__Pyx_Coroutine_Check(self)) { msg = "coroutine ignored GeneratorExit"; #endif #ifdef __Pyx_AsyncGen_USED } else if (__Pyx_AsyncGen_CheckExact(self)) { #if PY_VERSION_HEX < 0x03060000 msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)"; #else msg = "async generator ignored GeneratorExit"; #endif #endif } else { msg = "generator ignored GeneratorExit"; } PyErr_SetString(PyExc_RuntimeError, msg); return NULL; } raised_exception = PyErr_Occurred(); if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) { if (raised_exception) PyErr_Clear(); Py_INCREF(Py_None); return Py_None; } return NULL; } static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb, PyObject *args, int close_on_genexit) { __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; PyObject *yf = gen->yieldfrom; if (unlikely(gen->is_running)) return __Pyx_Coroutine_AlreadyRunningError(gen); if (yf) { PyObject *ret; Py_INCREF(yf); if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) { int err = __Pyx_Coroutine_CloseIter(gen, yf); Py_DECREF(yf); __Pyx_Coroutine_Undelegate(gen); if (err < 0) return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0)); goto throw_here; } gen->is_running = 1; if (0 #ifdef __Pyx_Generator_USED || __Pyx_Generator_CheckExact(yf) #endif #ifdef __Pyx_Coroutine_USED || __Pyx_Coroutine_Check(yf) #endif ) { ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit); #ifdef __Pyx_Coroutine_USED } else if (__Pyx_CoroutineAwait_CheckExact(yf)) { ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit); #endif } else { 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; } if (likely(args)) { ret = PyObject_CallObject(meth, args); } else { ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL); } Py_DECREF(meth); } gen->is_running = 0; Py_DECREF(yf); if (!ret) { ret = __Pyx_Coroutine_FinishDelegation(gen); } return __Pyx_Coroutine_MethodReturn(self, ret); } throw_here: __Pyx_Raise(typ, val, tb, NULL); return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0)); } static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) { PyObject *typ; PyObject *val = NULL; PyObject *tb = NULL; if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb)) return NULL; return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1); } static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) { Py_VISIT(exc_state->exc_type); Py_VISIT(exc_state->exc_value); Py_VISIT(exc_state->exc_traceback); return 0; } static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) { Py_VISIT(gen->closure); Py_VISIT(gen->classobj); Py_VISIT(gen->yieldfrom); return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg); } 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); __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state); #ifdef __Pyx_AsyncGen_USED if (__Pyx_AsyncGen_CheckExact(self)) { Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer); } #endif Py_CLEAR(gen->gi_code); Py_CLEAR(gen->gi_frame); Py_CLEAR(gen->gi_name); Py_CLEAR(gen->gi_qualname); Py_CLEAR(gen->gi_modulename); 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 && CYTHON_USE_TP_FINALIZE if (PyObject_CallFinalizerFromDealloc(self)) #else Py_TYPE(gen)->tp_del(self); if (Py_REFCNT(self) > 0) #endif { return; } PyObject_GC_UnTrack(self); } #ifdef __Pyx_AsyncGen_USED if (__Pyx_AsyncGen_CheckExact(self)) { /* We have to handle this case for asynchronous generators right here, because this code has to be between UNTRACK and GC_Del. */ Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer); } #endif __Pyx_Coroutine_clear(self); PyObject_GC_Del(gen); } static void __Pyx_Coroutine_del(PyObject *self) { PyObject *error_type, *error_value, *error_traceback; __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; __Pyx_PyThreadState_declare if (gen->resume_label < 0) { return; } #if !CYTHON_USE_TP_FINALIZE assert(self->ob_refcnt == 0); __Pyx_SET_REFCNT(self, 1); #endif __Pyx_PyThreadState_assign __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); #ifdef __Pyx_AsyncGen_USED if (__Pyx_AsyncGen_CheckExact(self)) { __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self; PyObject *finalizer = agen->ag_finalizer; if (finalizer && !agen->ag_closed) { PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self); if (unlikely(!res)) { PyErr_WriteUnraisable(self); } else { Py_DECREF(res); } __Pyx_ErrRestore(error_type, error_value, error_traceback); return; } } #endif if (unlikely(gen->resume_label == 0 && !error_value)) { #ifdef __Pyx_Coroutine_USED #ifdef __Pyx_Generator_USED if (!__Pyx_Generator_CheckExact(self)) #endif { PyObject_GC_UnTrack(self); #if PY_MAJOR_VERSION >= 3 || defined(PyErr_WarnFormat) if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0)) PyErr_WriteUnraisable(self); #else {PyObject *msg; char *cmsg; #if CYTHON_COMPILING_IN_PYPY msg = NULL; cmsg = (char*) "coroutine was never awaited"; #else char *cname; PyObject *qualname; qualname = gen->gi_qualname; cname = PyString_AS_STRING(qualname); msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname); if (unlikely(!msg)) { PyErr_Clear(); cmsg = (char*) "coroutine was never awaited"; } else { cmsg = PyString_AS_STRING(msg); } #endif if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0)) PyErr_WriteUnraisable(self); Py_XDECREF(msg);} #endif PyObject_GC_Track(self); } #endif } else { PyObject *res = __Pyx_Coroutine_Close(self); if (unlikely(!res)) { if (PyErr_Occurred()) PyErr_WriteUnraisable(self); } else { Py_DECREF(res); } } __Pyx_ErrRestore(error_type, error_value, error_traceback); #if !CYTHON_USE_TP_FINALIZE assert(Py_REFCNT(self) > 0); if (--self->ob_refcnt == 0) { return; } { Py_ssize_t refcnt = Py_REFCNT(self); _Py_NewReference(self); __Pyx_SET_REFCNT(self, refcnt); } #if CYTHON_COMPILING_IN_CPYTHON assert(PyType_IS_GC(Py_TYPE(self)) && _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, CYTHON_UNUSED void *context) { 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, CYTHON_UNUSED void *context) { 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, CYTHON_UNUSED void *context) { 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, CYTHON_UNUSED void *context) { 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 PyObject * __Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context) { PyObject *frame = self->gi_frame; if (!frame) { if (unlikely(!self->gi_code)) { Py_RETURN_NONE; } frame = (PyObject *) PyFrame_New( PyThreadState_Get(), /*PyThreadState *tstate,*/ (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/ __pyx_d, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (unlikely(!frame)) return NULL; self->gi_frame = frame; } Py_INCREF(frame); return frame; } static __pyx_CoroutineObject *__Pyx__Coroutine_New( PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, PyObject *name, PyObject *qualname, PyObject *module_name) { __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type); if (unlikely(!gen)) return NULL; return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name); } static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, PyObject *name, PyObject *qualname, PyObject *module_name) { gen->body = body; gen->closure = closure; Py_XINCREF(closure); gen->is_running = 0; gen->resume_label = 0; gen->classobj = NULL; gen->yieldfrom = NULL; gen->gi_exc_state.exc_type = NULL; gen->gi_exc_state.exc_value = NULL; gen->gi_exc_state.exc_traceback = NULL; #if CYTHON_USE_EXC_INFO_STACK gen->gi_exc_state.previous_item = NULL; #endif 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; Py_XINCREF(code); gen->gi_code = code; gen->gi_frame = NULL; 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 */ #ifndef CYTHON_REGISTER_ABCS #define CYTHON_REGISTER_ABCS 1 #endif #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 (CYTHON_REGISTER_ABCS && !abc_patched) { PyObject *module; module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections"); if (!module) { PyErr_WriteUnraisable(NULL); if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, ((PY_MAJOR_VERSION >= 3) ? "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_Method, 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")}, {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL}, {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}, {(char *) "gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL, (char*) PyDoc_STR("Frame 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 CYTHON_USE_TP_FINALIZE 0, #else __Pyx_Coroutine_del, #endif 0, #if CYTHON_USE_TP_FINALIZE __Pyx_Coroutine_del, #elif PY_VERSION_HEX >= 0x030400a1 0, #endif #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 0, #endif #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 0, #endif }; static int __pyx_Generator_init(void) { __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; __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[5]; int same=1, i, found_dot; const char* rt_from_call = Py_GetVersion(); PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); found_dot = 0; for (i = 0; i < 4; i++) { if (!ctversion[i]) { same = (rt_from_call[i] < '0' || rt_from_call[i] > '9'); break; } if (rt_from_call[i] != ctversion[i]) { same = 0; break; } } if (!same) { char rtversion[5] = {'\0'}; char message[200]; for (i=0; i<4; ++i) { if (rt_from_call[i] == '.') { if (found_dot) break; found_dot = 1; } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') { break; } rtversion[i] = rt_from_call[i]; } 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; } /* FunctionExport */ static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) { PyObject *d = 0; PyObject *cobj = 0; union { void (*fp)(void); void *p; } tmp; d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__"); if (!d) { PyErr_Clear(); d = PyDict_New(); if (!d) goto bad; Py_INCREF(d); if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0) goto bad; } tmp.fp = f; #if PY_VERSION_HEX >= 0x02070000 cobj = PyCapsule_New(tmp.p, sig, 0); #else cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0); #endif if (!cobj) goto bad; if (PyDict_SetItemString(d, name, cobj) < 0) goto bad; Py_DECREF(cobj); Py_DECREF(d); return 0; bad: Py_XDECREF(cobj); Py_XDECREF(d); return -1; } /* 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; if (PyObject_Hash(*t->p) == -1) 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 const char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT #if !CYTHON_PEP393_ENABLED static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { 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 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (likely(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 #endif static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { #if __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)) { return __Pyx_PyUnicode_AsStringAndSize(o, length); } 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 int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { int retval; if (unlikely(!x)) return -1; retval = __Pyx_PyObject_IsTrue(x); Py_DECREF(x); return retval; } static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, "__int__ returned non-int (type %.200s). " "The ability to return an instance of a strict subclass of int " "is deprecated, and may be removed in a future version of Python.", Py_TYPE(result)->tp_name)) { Py_DECREF(result); return NULL; } return result; } #endif PyErr_Format(PyExc_TypeError, "__%.4s__ returned non-%.4s (type %.200s)", type_name, type_name, Py_TYPE(result)->tp_name); Py_DECREF(result); return NULL; } 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 (likely(PyInt_Check(x) || PyLong_Check(x))) #else if (likely(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 = m->nb_int(x); } else if (m && m->nb_long) { name = "long"; res = m->nb_long(x); } #else if (likely(m && m->nb_int)) { name = "int"; res = m->nb_int(x); } #endif #else if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { res = PyNumber_Int(x); } #endif if (likely(res)) { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { #else if (unlikely(!PyLong_CheckExact(res))) { #endif return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); } } 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(b); } #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 Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); #if PY_MAJOR_VERSION < 3 } else if (likely(PyInt_CheckExact(o))) { return PyInt_AS_LONG(o); #endif } else { Py_ssize_t ival; PyObject *x; x = PyNumber_Index(o); if (!x) return -1; ival = PyInt_AsLong(x); Py_DECREF(x); return ival; } } static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); } #endif /* Py_PYTHON_H */ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1682955392.0 libzim-3.1.0/libzim/libzim.h0000644000175100001730000000323714423756200015337 0ustar00runnerdocker/* Generated by Cython 0.29.34 */ #ifndef __PYX_HAVE__libzim #define __PYX_HAVE__libzim #include "Python.h" #ifndef __PYX_HAVE_API__libzim #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(_T) _T #endif __PYX_EXTERN_C bool obj_has_attribute(PyObject *, std::string); __PYX_EXTERN_C std::string string_cy_call_fct(PyObject *, std::string, std::string *); __PYX_EXTERN_C wrapper::Blob blob_cy_call_fct(PyObject *, std::string, std::string *); __PYX_EXTERN_C zim::writer::ContentProvider *contentprovider_cy_call_fct(PyObject *, std::string, std::string *); __PYX_EXTERN_C zim::writer::IndexData *indexdata_cy_call_fct(PyObject *, std::string, std::string *); __PYX_EXTERN_C bool bool_cy_call_fct(PyObject *, std::string, std::string *); __PYX_EXTERN_C uint64_t uint64_cy_call_fct(PyObject *, std::string, std::string *); __PYX_EXTERN_C uint32_t uint32_cy_call_fct(PyObject *, std::string, std::string *); __PYX_EXTERN_C zim::writer::IndexData::GeoPosition geoposition_cy_call_fct(PyObject *, std::string, std::string *); __PYX_EXTERN_C std::map convertToCppHints(PyObject *); __PYX_EXTERN_C std::map hints_cy_call_fct(PyObject *, std::string, std::string *); #endif /* !__PYX_HAVE_API__libzim */ /* WARNING: the interface of the module init function changed in CPython 3.5. */ /* It now returns a PyModuleDef instance instead of a PyModule instance. */ #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC initlibzim(void); #else PyMODINIT_FUNC PyInit_libzim(void); #endif #endif /* !__PYX_HAVE__libzim */ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1682955378.0 libzim-3.1.0/libzim/libzim.pyx0000644000175100001730000012717314423756162015745 0ustar00runnerdocker# This file is part of python-libzim # (see https://github.com/libzim/python-libzim) # # Copyright (c) 2020 Juan Diego Caballero # Copyright (c) 2020 Matthieu Gautier # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Make our libzim module a package by setting a __path__ # There is no real path here, but it will be passed to our module finder. """openZIM's file format library binding - libzim.writer to create ZIM file with Creator - libzim.reader to open ZIM file as Archive - libzim.search to search on an Archive - libzim.suggestion to retrieve suggestions on an Archive https://openzim.org""" __path__ = [] cimport zim import datetime import enum import importlib import importlib.abc import os import pathlib import sys import traceback from collections import OrderedDict from types import ModuleType from typing import Dict, Generator, Iterator, List, Optional, Set, Tuple, Union from uuid import UUID from cpython.buffer cimport PyBUF_WRITABLE from cpython.ref cimport PyObject from cython.operator import preincrement from libc.stdint cimport uint32_t, uint64_t from libcpp cimport bool from libcpp.map cimport map from libcpp.memory cimport shared_ptr from libcpp.string cimport string from libcpp.utility cimport move pybool = type(True) pyint = type(1) def create_module(name, doc, members): """Create/define a module for name and docstring, populated by members""" module = ModuleType(name, doc) _all = [] for obj in members: if isinstance(obj, tuple): name = obj[0] obj = obj[1] else: name = obj.__name__ setattr(module, name, obj) _all.append(name) module.__all__ = _all sys.modules[name] = module return module ############################################################################### #  Public API to be called from C++ side # ############################################################################### # This calls a python method and returns a python object. cdef object call_method(object obj, string method): func = getattr(obj, method.decode('UTF-8')) return func() # Define methods calling a python method and converting the resulting python # object to the correct cpp type. # Will be used by cpp side to call python method. cdef public api: bool obj_has_attribute(object obj, string attribute) with gil: """Check if a object has a given attribute""" return hasattr(obj, attribute.decode('UTF-8')) string string_cy_call_fct(object obj, string method, string *error) with gil: """Lookup and execute a pure virtual method on object returning a string""" try: ret_str = call_method(obj, method) return ret_str.encode('UTF-8') except Exception as e: error[0] = traceback.format_exc().encode('UTF-8') return b"" zim.Blob blob_cy_call_fct(object obj, string method, string *error) with gil: """Lookup and execute a pure virtual method on object returning a Blob""" cdef WritingBlob blob try: blob = call_method(obj, method) if blob is None: raise RuntimeError("Blob is none") return move(blob.c_blob) except Exception as e: error[0] = traceback.format_exc().encode('UTF-8') return move(zim.Blob()) zim.ContentProvider* contentprovider_cy_call_fct(object obj, string method, string *error) with gil: """Lookup and execute a pure virtual method on object returning a ContentProvider""" try: contentProvider = call_method(obj, method) if not contentProvider: raise RuntimeError("ContentProvider is None") return new zim.ContentProviderWrapper(contentProvider) except Exception as e: error[0] = traceback.format_exc().encode('UTF-8') return NULL zim.IndexData* indexdata_cy_call_fct(object obj, string method, string *error) with gil: """Lookup and execute a pure virtual method on object returning a IndexData""" try: indexData = call_method(obj, method) if not indexData: # indexData is none return NULL; return new zim.IndexDataWrapper(indexData) except Exception as e: error[0] = traceback.format_exc().encode('UTF-8') return NULL bool bool_cy_call_fct(object obj, string method, string *error) with gil: """Lookup and execute a pure virtual method on object returning a bool""" try: return call_method(obj, method) except Exception as e: error[0] = traceback.format_exc().encode('UTF-8') return False uint64_t uint64_cy_call_fct(object obj, string method, string *error) with gil: """Lookup and execute a pure virtual method on object returning an uint64_t""" try: return call_method(obj, method) except Exception as e: error[0] = traceback.format_exc().encode('UTF-8') return 0 uint32_t uint32_cy_call_fct(object obj, string method, string *error) with gil: """Lookup and execute a pure virtual method on object returning an uint_32""" try: return call_method(obj, method) except Exception as e: error[0] = traceback.format_exc().encode('UTF-8') return 0 zim.GeoPosition geoposition_cy_call_fct(object obj, string method, string *error) with gil: """Lookup and execute a pure virtual method on object returning a GeoPosition""" try: geoPosition = call_method(obj, method) if geoPosition: return zim.GeoPosition(True, geoPosition[0], geoPosition[1]); except Exception as e: error[0] = traceback.format_exc().encode('UTF-8') return zim.GeoPosition(False, 0, 0) map[zim.HintKeys, uint64_t] convertToCppHints(dict hintsDict): """C++ Hints from Python dict""" cdef map[zim.HintKeys, uint64_t] ret; for key, value in hintsDict.items(): ret[key.value] = value return ret map[zim.HintKeys, uint64_t] hints_cy_call_fct(object obj, string method, string* error) with gil: """Lookup and execute a pure virtual method on object returning Hints""" cdef map[zim.HintKeys, uint64_t] ret; try: func = getattr(obj, method.decode('UTF-8')) hintsDict = {k: pybool(v) for k, v in func().items() if isinstance(k, Hint)} return convertToCppHints(hintsDict) except Exception as e: error[0] = traceback.format_exc().encode('UTF-8') return ret ############################################################################### #  Creator module # ############################################################################### writer_module_name = f"{__name__}.writer" cdef class WritingBlob: __module__ = writer_module_name cdef zim.Blob c_blob cdef bytes ref_content def __cinit__(self, content: Union[str, bytes]): if isinstance(content, str): self.ref_content = content.encode('UTF-8') else: self.ref_content = content self.c_blob = move(zim.Blob( self.ref_content, len(self.ref_content))) def size(self): return self.c_blob.size() class Compression(enum.Enum): """Compression algorithms available to create ZIM files""" __module__ = writer_module_name # We don't care of the exact value. The function comp_from_int will do the right # conversion to zim::Compression none = 0 zstd = 1 class Hint(enum.Enum): __module__ = writer_module_name COMPRESS = zim.HintKeys.COMPRESS FRONT_ARTICLE = zim.HintKeys.FRONT_ARTICLE cdef class _Creator: """ZIM Creator Attributes ---------- *c_creator : zim.ZimCreator a pointer to the C++ Creator object _filename: pathlib.Path path to create the ZIM file at _started : bool flag if the creator has started""" __module__ = writer_module_name cdef zim.ZimCreator c_creator cdef object _filename cdef object _started def __cinit__(self, object filename: pathlib.Path, *args, **kwargs): self._filename = pathlib.Path(filename) self._started = False # fail early if destination is not writable parent = self._filename.expanduser().resolve().parent if not os.access(parent, mode=os.W_OK, effective_ids=(os.access in os.supports_effective_ids)): raise IOError(f"Unable to write ZIM file at {self._filename}") def __init__(self, filename: pathlib.Path): """Constructs a Creator for a ZIM file at path Parameters ---------- filename : pathlib.Path Full path to a zim file""" pass def config_verbose(self, bool verbose: bool) -> Creator: """Set creator verbosity (inside libzim). Default is off""" if self._started: raise RuntimeError("Creator started") self.c_creator.configVerbose(verbose) return self def config_compression(self, compression: Compression) -> Creator: """Set compression algorithm to use. Check libzim for default Fall 2021 default: zstd""" if self._started: raise RuntimeError("Creator started") self.c_creator.configCompression(zim.comp_from_int(compression.value)) return self def config_clustersize(self, int size: pyint) -> Creator: """Set size of created clusters. Check libzim for default libzim will store at most this value per cluster before creating another one. Fall 2021 default: 2Mib""" if self._started: raise RuntimeError("Creator started") self.c_creator.configClusterSize(size) return self def config_indexing(self, bool indexing: bool, str language: str) -> Creator: """Configure fulltext indexing feature indexing: whether to create a full-text index of the content language: language (ISO-639-3 code) to assume content in during indexation""" if self._started: raise RuntimeError("Creator started") self.c_creator.configIndexing(indexing, language.encode('UTF-8')) return self def config_nbworkers(self, int nbWorkers: pyint) -> Creator: """Number of thread to use for internal worker""" if self._started: raise RuntimeError("Creator started") self.c_creator.configNbWorkers(nbWorkers) return self def set_mainpath(self, str mainPath: str) -> Creator: """Set path of the main entry""" self.c_creator.setMainPath(mainPath.encode('UTF-8')) return self def add_illustration(self, int size: pyint, content: bytes): """Add a PNG illustration to Archive https://wiki.openzim.org/wiki/Metadata Raises ------ RuntimeError If an Illustration exists with the same size""" cdef string _content = content self.c_creator.addIllustration(size, _content) # def set_uuid(self, uuid) -> Creator: # self.c_creator.setUuid(uuid) def add_item(self, writer_item not None: BaseWritingItem): """Add an item to the Creator object. Parameters ---------- item : WriterItem The item to add to the file Raises ------ RuntimeError If an Item exists with the same path RuntimeError If the ZimCreator was already finalized""" if not self._started: raise RuntimeError("Creator not started") # Make a shared pointer to ZimArticleWrapper from the ZimArticle object cdef shared_ptr[zim.WriterItem] item = shared_ptr[zim.WriterItem]( new zim.WriterItemWrapper(writer_item)); with nogil: self.c_creator.addItem(item) def add_metadata(self, str name: str, bytes content: bytes, str mimetype: str): """Add metadata entry to Archive https://wiki.openzim.org/wiki/Metadata Raises ------ RuntimeError If a Metadata exists with the same name""" if not self._started: raise RuntimeError("Creator not started") cdef string _name = name.encode('UTF-8') cdef string _content = content cdef string _mimetype = mimetype.encode('UTF-8') with nogil: self.c_creator.addMetadata(_name, _content, _mimetype) def add_redirection(self, str path: str, str title: str, str targetPath: str, dict hints: Dict[Hint, pyint]): """Add redirection entry to Archive https://wiki.openzim.org/wiki/ZIM_file_format#Redirect_Entry Raises ------ RuntimeError If a Rediction exists with the same path """ if not self._started: raise RuntimeError("Creator not started") cdef string _path = path.encode('UTF-8') cdef string _title = title.encode('UTF-8') cdef string _targetPath = targetPath.encode('UTF-8') cdef map[zim.HintKeys, uint64_t] _hints = convertToCppHints(hints) with nogil: self.c_creator.addRedirection(_path, _title, _targetPath, _hints) def __enter__(self): cdef string _path = str(self._filename).encode('UTF-8') with nogil: self.c_creator.startZimCreation(_path) self._started = True return self def __exit__(self, exc_type, exc_val, exc_tb): if True or exc_type is None: with nogil: self.c_creator.finishZimCreation() self._started = False @property def filename(self) -> pathlib.Path: return self._filename class ContentProvider: __module__ = writer_module_name def __init__(self): self.generator = None def get_size(self) -> pyint: """Size of get_data's result in bytes""" raise NotImplementedError("get_size must be implemented.") def feed(self) -> WritingBlob: """Blob(s) containing the complete content of the article. Must return an empty blob to tell writer no more content has to be written. Sum(size(blobs)) must be equals to `self.get_size()` """ if self.generator is None: self.generator = self.gen_blob() try: # We have to keep a ref to _blob to be sure gc do not del it while cpp is # using it self._blob = next(self.generator) except StopIteration: self._blob = WritingBlob("") return self._blob def gen_blob(self) -> Generator[WritingBlob, None, None]: """Generator yielding blobs for the content of the article""" raise NotImplementedError("gen_blob (ro feed) must be implemented") class StringProvider(ContentProvider): """ContentProvider for a single encoded-or-not UTF-8 string""" __module__ = writer_module_name def __init__(self, content: Union[str, bytes]): super().__init__() self.content = content.encode("UTF-8") if isinstance(content, str) else content def get_size(self) -> pyint: return len(self.content) def gen_blob(self) -> Generator[WritingBlob, None, None]: yield WritingBlob(self.content) class FileProvider(ContentProvider): """ContentProvider for a file using its local path""" __module__ = writer_module_name def __init__(self, filepath: Union[pathlib.Path, str]): super().__init__() self.filepath = filepath self.size = os.path.getsize(self.filepath) def get_size(self) -> pyint: return self.size def gen_blob(self) -> Generator[WritingBlob, None, None]: bsize = 1048576 # 1MiB chunk with open(self.filepath, "rb") as fh: res = fh.read(bsize) while res: yield WritingBlob(res) res = fh.read(bsize) class IndexData: """ IndexData stub to override Return a subclass of it in Item.get_indexdata()""" __module__ = writer_module_name def has_indexdata(self) -> bool: """Return true if the IndexData actually contains data""" return False def get_title(self) -> str: """Title to index. Might be the same as Item.get_title or not""" raise NotImplementedError("get_title must be implemented.") def get_content(self) -> str: """Content to index. Might be the same as Item.get_title or not""" raise NotImplementedError("get_content must be implemented.") def get_keywords(self) -> str: """Keywords used to index the item. Must be a string containing keywords separated by a space""" raise NotImplementedError("get_keywords must be implemented.") def get_wordcount(self) -> int: """Number of word in content""" raise NotImplementedError("get_wordcount must be implemented.") def get_geoposition(self) -> Optional[Tuple[float, float]]: """GeoPosition used to index the item. Must be a tuple (latitude, longitude) or None""" return None class BaseWritingItem: """Item stub to override Pass a subclass of it to Creator.add_item()""" __module__ = writer_module_name def __init__(self): self._blob = None def get_path(self) -> str: """Full path of item""" raise NotImplementedError("get_path must be implemented.") def get_title(self) -> str: """Item title. Might be indexed and used in suggestions""" raise NotImplementedError("get_title must be implemented.") def get_mimetype(self) -> str: """MIME-type of the item's content.""" raise NotImplementedError("get_mimetype must be implemented.") def get_contentprovider(self) -> ContentProvider: """ContentProvider containing the complete content of the item""" raise NotImplementedError("get_contentprovider must be implemented.") def get_hints(self) -> Dict[Hint, pyint]: """Dict of Hint: value informing Creator how to handle this item""" raise NotImplementedError("get_hints must be implemented.") def __repr__(self) -> str: return ( f"{self.__class__.__name__}(path={self.get_path()}, " f"title={self.get_title()})" ) class Creator(_Creator): __module__ = writer_module_name def config_compression(self, compression: Compression): if not isinstance(compression, Compression): compression = getattr(Compression, compression.lower()) return super().config_compression(compression) def add_metadata( self, name: str, content: Union[str, bytes, datetime.date, datetime.datetime], mimetype: str = "text/plain;charset=UTF-8" ): if name == "Date" and isinstance(content, (datetime.date, datetime.datetime)): content = content.strftime("%Y-%m-%d").encode("UTF-8") if isinstance(content, str): content = content.encode("UTF-8") super().add_metadata(name=name, content=content, mimetype=mimetype) def __repr__(self) -> str: return f"Creator(filename={self.filename})" writer_module_doc = """libzim writer module - Creator to create ZIM files - Item to store ZIM articles metadata - ContentProvider to store an Item's content - Blob to store actual content - StringProvider to store an Item's content from a string - FileProvider to store an Item's content from a file path - Compression to select the algorithm to compress ZIM archive with Usage: with Creator(pathlib.Path("myfile.zim")) as creator: creator.config_verbose(False) creator.add_metadata("Name", b"my name") # example creator.add_item(MyItemSubclass(path, title, mimetype, content) creator.set_mainpath(path)""" writer_public_objects = [ Creator, Compression, ('Blob', WritingBlob), Hint, ('Item', BaseWritingItem), ContentProvider, FileProvider, StringProvider, IndexData ] writer = create_module(writer_module_name, writer_module_doc, writer_public_objects) ############################################################################### #  Reader module # ############################################################################### reader_module_name = f"{__name__}.reader" cdef Py_ssize_t itemsize = 1 cdef class ReadingBlob: __module__ = reader_module_name cdef zim.Blob c_blob cdef Py_ssize_t size cdef int view_count # Factory functions - Currently Cython can't use classmethods @staticmethod cdef from_blob(zim.Blob blob): """Creates a python Blob from a C++ Blob (zim::) -> Blob Parameters ---------- blob : Blob A C++ Entry Returns ------ Blob Casted blob""" cdef ReadingBlob rblob = ReadingBlob() rblob.c_blob = move(blob) rblob.size = rblob.c_blob.size() rblob.view_count = 0 return rblob def __dealloc__(self): if self.view_count: raise RuntimeError("Blob has views") def __getbuffer__(self, Py_buffer *buffer, int flags): if flags&PyBUF_WRITABLE: raise BufferError("Cannot create writable memoryview on readonly data") buffer.obj = self buffer.buf = self.c_blob.data() buffer.len = self.size buffer.readonly = 1 buffer.format = 'c' buffer.internal = NULL # see References buffer.itemsize = itemsize buffer.ndim = 1 buffer.shape = &self.size buffer.strides = &itemsize buffer.suboffsets = NULL # for pointer arrays only self.view_count += 1 def __releasebuffer__(self, Py_buffer *buffer): self.view_count -= 1 cdef class Entry: """Entry in a ZIM archive Attributes ---------- *c_entry : Entry (zim::) a pointer to the C++ entry object""" __module__ = reader_module_name cdef zim.Entry c_entry # Factory functions - Currently Cython can't use classmethods @staticmethod cdef from_entry(zim.Entry ent): """Creates a python Entry from a C++ Entry (zim::) -> Entry Parameters ---------- ent : Entry A C++ Entry Returns ------ Entry Casted entry""" cdef Entry entry = Entry() entry.c_entry = move(ent) return entry @property def title(self) -> str: return self.c_entry.getTitle().decode('UTF-8') @property def path(self) -> str: return self.c_entry.getPath().decode("UTF-8", "strict") @property def _index(self) -> pyint: """Internal index in Archive""" return self.c_entry.getIndex() @property def is_redirect(self) -> pybool: """Whether entry is a redirect""" return self.c_entry.isRedirect() def get_redirect_entry(self) -> Entry: """Target of this entry, if a redirect""" cdef zim.Entry entry = move(self.c_entry.getRedirectEntry()) return Entry.from_entry(move(entry)) def get_item(self) -> Item: cdef zim.Item item = move(self.c_entry.getItem(True)) return Item.from_item(move(item)) def __repr__(self) -> str: return f"{self.__class__.__name__}(url={self.path}, title={self.title})" cdef class Item: """Item in a ZIM archive Attributes ---------- *c_entry : Entry (zim::) a pointer to the C++ entry object""" __module__ = reader_module_name cdef zim.Item c_item cdef ReadingBlob _blob cdef bool _haveBlob # Factory functions - Currently Cython can't use classmethods @staticmethod cdef from_item(zim.Item _item): """Creates a python ReadArticle from a C++ Article (zim::) -> ReadArticle Parameters ---------- _item : Item A C++ Item Returns ------ Item Casted item""" cdef Item item = Item() item.c_item = move(_item) return item @property def title(self) -> str: return self.c_item.getTitle().decode('UTF-8') @property def path(self) -> str: return self.c_item.getPath().decode("UTF-8", "strict") @property def content(self) -> memoryview: if not self._haveBlob: self._blob = ReadingBlob.from_blob(move(self.c_item.getData( 0))) self._haveBlob = True return memoryview(self._blob) @property def mimetype(self) -> str: return self.c_item.getMimetype().decode('UTF-8') @property def _index(self) -> pyint: """Internal index in Archive""" return self.c_item.getIndex() @property def size(self) -> pyint: return self.c_item.getSize() def __repr__(self) -> str: return f"{self.__class__.__name__}(url={self.path}, title={self.title})" cdef class Archive: """ZIM Archive Reader Attributes ---------- *c_archive : Archive a pointer to a C++ Archive object _filename : pathlib.Path the file name of the Archive Reader object""" __module__ = reader_module_name cdef zim.Archive c_archive cdef object _filename def __cinit__(self, object filename: pathlib.Path): """Constructs an Archive from full zim file path Parameters ---------- filename : pathlib.Path Full path to a zim file""" self.c_archive = move(zim.Archive(str(filename).encode('UTF-8'))) self._filename = pathlib.Path(self.c_archive.getFilename().decode("UTF-8", "strict")) def __eq__(self, other) -> pybool: if Archive not in type(self).mro() or Archive not in type(other).mro(): return False try: return self.filename.expanduser().resolve() == other.filename.expanduser().resolve() except Exception: return False @property def filename(self) -> pathlib.Path: return self._filename @property def filesize(self) -> pyint: """Total size of ZIM file (or files if split""" return self.c_archive.getFilesize() def has_entry_by_path(self, path: str) -> pybool: """Whether Archive has an entry with this path""" return self.c_archive.hasEntryByPath(path.encode('UTF-8')) def get_entry_by_path(self, path: str) -> Entry: """Entry from a path -> Entry Parameters ---------- path : str The path of the article Returns ------- Entry The Entry object Raises ------ KeyError If an entry with the provided path is not found in the archive""" cdef zim.Entry entry try: entry = move(self.c_archive.getEntryByPath(path.encode('UTF-8'))) except RuntimeError as e: raise KeyError(str(e)) return Entry.from_entry(move(entry)) def has_entry_by_title(self, title: str) -> pybool: """Whether Archive has en entry with this title Uses get_entry_by_title() so it's specificities apply as well""" return self.c_archive.hasEntryByTitle(title.encode('UTF-8')) def get_entry_by_title(self, title: str) -> Entry: """Entry from a title -> Entry If ZIM doesn't contain a listing/titleOrdered/v1 entry (most likely because if was created without any FRONT_ARTICLE) then this yields results for matching path if the title was not set at creation time. Otherwise raises KeyError. Parameters ---------- title : str The title of the article Returns ------- Entry The first Entry object matching the title Raises ------ KeyError If an entry with the provided title is not found in the archive""" cdef zim.Entry entry try: entry = move(self.c_archive.getEntryByTitle(title.encode('UTF-8'))) except RuntimeError as e: raise KeyError(str(e)) return Entry.from_entry(move(entry)) @property def metadata_keys(self) -> List[str]: """List of Metadata keys present in this archive""" return [key.decode("UTF-8", "strict") for key in self.c_archive.getMetadataKeys()] def get_metadata_item(self, name: str) -> Item: """A Metadata's Item""" cdef zim.Item item = move(self.c_archive.getMetadataItem(name.encode('UTF-8'))) return Item.from_item(move(item)) def get_metadata(self, name: str) -> bytes: """A Metadata's content -> bytes Parameters ---------- name: str name/path of the Metadata Entry Returns ------- bytes Metadata entry's content. Can be of any type.""" return bytes(self.c_archive.getMetadata(name.encode('UTF-8'))) def _get_entry_by_id(self, entry_id: pyint) -> Entry: """Entry from an entry Id""" cdef zim.Entry entry = move(self.c_archive.getEntryByPath(entry_id)) return Entry.from_entry(move(entry)) @property def has_main_entry(self) -> pybool: """Whether Archive has a Main Entry set""" return self.c_archive.hasMainEntry() @property def main_entry(self) -> Entry: """Main Entry of the Archive""" return Entry.from_entry(move(self.c_archive.getMainEntry())) @property def uuid(self) -> UUID: """Archive UUID""" return UUID(self.c_archive.getUuid().hex()) @property def has_new_namespace_scheme(self) -> pybool: """Whether Archive is using new “namespaceless” namespace scheme""" return self.c_archive.hasNewNamespaceScheme() @property def is_multipart(self) -> pybool: """Whether Archive is multipart (split over multiple files)""" return self.c_archive.isMultiPart() @property def has_fulltext_index(self) -> pybool: """Whether Archive includes a full-text index""" return self.c_archive.hasFulltextIndex() @property def has_title_index(self) -> pybool: """Whether Archive includes a Title index""" return self.c_archive.hasTitleIndex() @property def has_checksum(self) -> str: """Whether Archive includes a checksum of its content""" return self.c_archive.hasChecksum() @property def checksum(self) -> str: """Archive's checksum""" return self.c_archive.getChecksum().decode("UTF-8", "strict") def check(self) -> pybool: """Whether Archive has a checksum and file verifies it""" return self.c_archive.check() @property def entry_count(self) -> pyint: """Number of user entries in Archive If Archive doesn't support “user entries” then this returns `all_entry_count`""" return self.c_archive.getEntryCount() @property def all_entry_count(self) -> pyint: """Number of entries in Archive. Total number of entries in the archive, including internal entries created by libzim itself, metadata, indexes, etc.""" return self.c_archive.getAllEntryCount() @property def article_count(self) -> pyint: """Number of “articles” in the Archive If Archive has_new_namespace_scheme then this is the number of Entry with “FRONT_ARTICLE” Hint. Otherwise, this is the number or entries in “A” namespace. Note: a few ZIM created during transition might have new scheme but no listing, resulting in this returning all entries.""" return self.c_archive.getArticleCount() @property def media_count(self) -> pyint: """Number of media in the Archive This definition of "media" is based on the mimetype.""" return self.c_archive.getMediaCount() def get_illustration_sizes(self) -> Set[pyint]: """Sizes for which an illustration is available (@1 scale only)""" return self.c_archive.getIllustrationSizes() def has_illustration(self, size: pyint = None) -> pybool: """Whether Archive has an illustration metadata for this size""" if size is not None: return self.c_archive.hasIllustration(size) return self.c_archive.hasIllustration() def get_illustration_item(self, size: pyint = None) -> Item: """Illustration Metadata Item for this size""" try: if size is not None: return Item.from_item(move(self.c_archive.getIllustrationItem(size))) return Item.from_item(move(self.c_archive.getIllustrationItem())) except RuntimeError as e: raise KeyError(str(e)) def __repr__(self) -> str: return f"{self.__class__.__name__}(filename={self.filename})" reader_module_doc = """libzim reader module - Archive to open and read ZIM files (gives access to all `Entry`) - Entry knows about redirections, exposes path and title and gives access to `Item` - Item holds the content and metadata Usage: with Archive(fpath) as zim: entry = zim.get_entry_by_path(zim.main_entry.path) print(f"Article {entry.title} at {entry.path} is " f"{entry.get_item().content.nbytes}b")""" reader_public_objects = [ Archive, Entry, Item, ] reader = create_module(reader_module_name, reader_module_doc, reader_public_objects) ############################################################################### #  Search module # ############################################################################### search_module_name = f"{__name__}.search" cdef class Query: """ZIM agnostic Query-builder to use with a Searcher""" __module__ = search_module_name cdef zim.Query c_query def set_query(self, query: str): self.c_query.setQuery(query.encode('UTF-8')) return self cdef class SearchResultSet: """Iterator over a Search result: entry paths""" __module__ = search_module_name cdef zim.SearchResultSet c_resultset @staticmethod cdef from_resultset(zim.SearchResultSet _resultset): cdef SearchResultSet resultset = SearchResultSet() resultset.c_resultset = move(_resultset) return resultset def __iter__(self) -> Iterator[str]: """Entry paths found in Archive for Search""" cdef zim.SearchIterator current = self.c_resultset.begin() cdef zim.SearchIterator end = self.c_resultset.end() while current != end: yield current.getPath().decode('UTF-8') preincrement(current) cdef class Search: """Search request over a ZIM Archive""" __module__ = search_module_name cdef zim.Search c_search # Factory functions - Currently Cython can't use classmethods @staticmethod cdef from_search(zim.Search _search): """Creates a python ReadArticle from a C++ Article (zim::) -> ReadArticle Parameters ---------- _item : Item A C++ Item Returns ------ Item Casted item""" cdef Search search = Search() search.c_search = move(_search) return search def getEstimatedMatches(self) -> pyint: """Estimated number of results in Archive for the search""" return self.c_search.getEstimatedMatches() def getResults(self, start: pyint, count: pyint) -> SearchResultSet: """Iterator over Entry paths found in Archive for the search""" return SearchResultSet.from_resultset(move(self.c_search.getResults(start, count))) cdef class Searcher: """ZIM Archive Searcher Attributes ---------- *c_archive : Searcher a pointer to a C++ Searcher object""" __module__ = search_module_name cdef zim.Searcher c_searcher def __cinit__(self, object archive: Archive): """Constructs an Archive from full zim file path Parameters ---------- filename : pathlib.Path Full path to a zim file""" self.c_searcher = move(zim.Searcher(archive.c_archive)) def search(self, object query: Query) -> Search: """Search object for a query of this Searcher's ZIM Archive""" return Search.from_search(move(self.c_searcher.search(query.c_query))) search_module_doc = """libzim search module - Query to prepare a query from a string - Searcher to perform a search over a libzim.reader.Archive Usage: archive = libzim.reader.Archive(fpath) searcher = Searcher(archive) query = Query().setQuery("foo") search = searcher.search(query) for path in search.getResult(10, 10) # get result from 10 to 20 (10 results) print(path, archive.get_entry_by_path(path).title)""" search_public_objects = [ Searcher, Query ] search = create_module(search_module_name, search_module_doc, search_public_objects) ############################################################################### #  Suggestion module # ############################################################################### suggestion_module_name = f"{__name__}.suggestion" cdef class SuggestionResultSet: """Iterator over a SuggestionSearch result: entry paths""" __module__ = suggestion_module_name cdef zim.SuggestionResultSet c_resultset @staticmethod cdef from_resultset(zim.SuggestionResultSet _resultset): cdef SuggestionResultSet resultset = SuggestionResultSet() resultset.c_resultset = move(_resultset) return resultset def __iter__(self) -> Iterator[str]: """Entry paths found in Archive for SuggestionSearch""" cdef zim.SuggestionIterator current = self.c_resultset.begin() cdef zim.SuggestionIterator end = self.c_resultset.end() while current != end: yield current.getSuggestionItem().getPath().decode('UTF-8') preincrement(current) cdef class SuggestionSearch: __module__ = suggestion_module_name cdef zim.SuggestionSearch c_search # Factory functions - Currently Cython can't use classmethods @staticmethod cdef from_search(zim.SuggestionSearch _search): """Creates a python ReadArticle from a C++ Article (zim::) -> ReadArticle Parameters ---------- _item : Item A C++ Item Returns ------ Item Casted item""" cdef SuggestionSearch search = SuggestionSearch() search.c_search = move(_search) return search def getEstimatedMatches(self) -> pyint: """Estimated number of results in Archive for the suggestion search""" return self.c_search.getEstimatedMatches() def getResults(self, start: pyint, count: pyint) -> SuggestionResultSet: """Iterator over Entry paths found in Archive for the suggestion search""" return SuggestionResultSet.from_resultset(move(self.c_search.getResults(start, count))) cdef class SuggestionSearcher: """ZIM Archive SuggestionSearcher Attributes ---------- *c_archive : Searcher a pointer to a C++ Searcher object""" __module__ = suggestion_module_name cdef zim.SuggestionSearcher c_searcher def __cinit__(self, object archive: Archive): """Constructs an Archive from full zim file path Parameters ---------- filename : pathlib.Path Full path to a zim file""" self.c_searcher = move(zim.SuggestionSearcher(archive.c_archive)) def suggest(self, query: str) -> SuggestionSearch: """SuggestionSearch object for a query of this SuggestionSearcher's ZIM Archive""" return SuggestionSearch.from_search(move(self.c_searcher.suggest(query.encode('UTF-8')))) suggestion_module_doc = """libzim suggestion module - SuggestionSearcher to perform a suggestion search over a libzim.reader.Archive Usage: archive = Archive(fpath) suggestion_searcher = SuggestionSearcher(archive) suggestions = suggestion_searcher.suggest("foo") for path in suggestion.getResult(10, 10) # get result from 10 to 20 (10 results) print(path, archive.get_entry_by_path(path).title)""" suggestion_public_objects = [ SuggestionSearcher ] suggestion = create_module(suggestion_module_name, suggestion_module_doc, suggestion_public_objects) version_module_doc = """libzim version module - Get version of libzim and its dependencies - Print version of libzim and its dependencies - Get libzim version Usage: from libzim.version import get_libzim_version, get_versions, print_versions major, minor, patch = get_libzim_version().split(".", 2) for dependency, version in get_versions().items(): print(f"- {dependency}={version}") print_versions()""" def print_versions(out: Union[sys.stdout, sys.stderr] = sys.stdout): """print libzim and its dependencies list with their versions""" for library, version in get_versions().items(): prefix = "" if library == "libzim" else "+ " print(f"{prefix}{library} {version}", file=out or sys.stdout) def get_versions() -> OrderedDict[str, str]: """ library: version mapping. Always includes `libzim`""" versions = zim.getVersions() return OrderedDict({ library.decode("UTF-8"): version.decode("UTF-8") for library, version in versions }) def get_libzim_version() -> str: """libzim version string""" return get_versions()["libzim"] version_public_objects = [ get_libzim_version, get_versions, print_versions, ] version_module_name = f"{__name__}.version" version = create_module(version_module_name, version_module_doc, version_public_objects) class ModuleLoader(importlib.abc.Loader): # Create our module. Easy, just return the created module @staticmethod def create_module(spec): return { 'libzim.writer': writer, 'libzim.reader': reader, 'libzim.search': search, 'libzim.suggestion': suggestion, 'libzim.version': version }.get(spec.name, None) @staticmethod def exec_module(module): # Nothing to execute for our already existing module. # But we need to define exec_module to tell python not use the legacy import system. pass class ModuleFinder(importlib.abc.MetaPathFinder): def find_spec(self, fullname, path, target=None): if fullname.startswith("libzim."): return importlib.machinery.ModuleSpec(fullname, ModuleLoader) # This is not our problem, let import mechanism continue return None # register finder for our submodules sys.meta_path.insert(0, ModuleFinder()) __all__ = ["writer", "reader", "search", "suggestion", "version"] ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1682955392.0 libzim-3.1.0/libzim/libzim_api.h0000644000175100001730000001431614423756200016170 0ustar00runnerdocker/* Generated by Cython 0.29.34 */ #ifndef __PYX_HAVE_API__libzim #define __PYX_HAVE_API__libzim #ifdef __MINGW64__ #define MS_WIN64 #endif #include "Python.h" #include "libzim.h" static bool (*__pyx_api_f_6libzim_obj_has_attribute)(PyObject *, std::string) = 0; #define obj_has_attribute __pyx_api_f_6libzim_obj_has_attribute static std::string (*__pyx_api_f_6libzim_string_cy_call_fct)(PyObject *, std::string, std::string *) = 0; #define string_cy_call_fct __pyx_api_f_6libzim_string_cy_call_fct static wrapper::Blob (*__pyx_api_f_6libzim_blob_cy_call_fct)(PyObject *, std::string, std::string *) = 0; #define blob_cy_call_fct __pyx_api_f_6libzim_blob_cy_call_fct static zim::writer::ContentProvider *(*__pyx_api_f_6libzim_contentprovider_cy_call_fct)(PyObject *, std::string, std::string *) = 0; #define contentprovider_cy_call_fct __pyx_api_f_6libzim_contentprovider_cy_call_fct static zim::writer::IndexData *(*__pyx_api_f_6libzim_indexdata_cy_call_fct)(PyObject *, std::string, std::string *) = 0; #define indexdata_cy_call_fct __pyx_api_f_6libzim_indexdata_cy_call_fct static bool (*__pyx_api_f_6libzim_bool_cy_call_fct)(PyObject *, std::string, std::string *) = 0; #define bool_cy_call_fct __pyx_api_f_6libzim_bool_cy_call_fct static uint64_t (*__pyx_api_f_6libzim_uint64_cy_call_fct)(PyObject *, std::string, std::string *) = 0; #define uint64_cy_call_fct __pyx_api_f_6libzim_uint64_cy_call_fct static uint32_t (*__pyx_api_f_6libzim_uint32_cy_call_fct)(PyObject *, std::string, std::string *) = 0; #define uint32_cy_call_fct __pyx_api_f_6libzim_uint32_cy_call_fct static zim::writer::IndexData::GeoPosition (*__pyx_api_f_6libzim_geoposition_cy_call_fct)(PyObject *, std::string, std::string *) = 0; #define geoposition_cy_call_fct __pyx_api_f_6libzim_geoposition_cy_call_fct static std::map (*__pyx_api_f_6libzim_convertToCppHints)(PyObject *) = 0; #define convertToCppHints __pyx_api_f_6libzim_convertToCppHints static std::map (*__pyx_api_f_6libzim_hints_cy_call_fct)(PyObject *, std::string, std::string *) = 0; #define hints_cy_call_fct __pyx_api_f_6libzim_hints_cy_call_fct #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 #ifndef __PYX_HAVE_RT_ImportFunction #define __PYX_HAVE_RT_ImportFunction static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { PyObject *d = 0; PyObject *cobj = 0; union { void (*fp)(void); void *p; } tmp; d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); if (!d) goto bad; cobj = PyDict_GetItemString(d, funcname); if (!cobj) { PyErr_Format(PyExc_ImportError, "%.200s does not export expected C function %.200s", PyModule_GetName(module), funcname); goto bad; } #if PY_VERSION_HEX >= 0x02070000 if (!PyCapsule_IsValid(cobj, sig)) { PyErr_Format(PyExc_TypeError, "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj)); goto bad; } tmp.p = PyCapsule_GetPointer(cobj, sig); #else {const char *desc, *s1, *s2; desc = (const char *)PyCObject_GetDesc(cobj); if (!desc) goto bad; s1 = desc; s2 = sig; while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } if (*s1 != *s2) { PyErr_Format(PyExc_TypeError, "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", PyModule_GetName(module), funcname, sig, desc); goto bad; } tmp.p = PyCObject_AsVoidPtr(cobj);} #endif *f = tmp.fp; if (!(*f)) goto bad; Py_DECREF(d); return 0; bad: Py_XDECREF(d); return -1; } #endif static int import_libzim(void) { PyObject *module = 0; module = PyImport_ImportModule("libzim"); if (!module) goto bad; if (__Pyx_ImportFunction(module, "obj_has_attribute", (void (**)(void))&__pyx_api_f_6libzim_obj_has_attribute, "bool (PyObject *, std::string)") < 0) goto bad; if (__Pyx_ImportFunction(module, "string_cy_call_fct", (void (**)(void))&__pyx_api_f_6libzim_string_cy_call_fct, "std::string (PyObject *, std::string, std::string *)") < 0) goto bad; if (__Pyx_ImportFunction(module, "blob_cy_call_fct", (void (**)(void))&__pyx_api_f_6libzim_blob_cy_call_fct, "wrapper::Blob (PyObject *, std::string, std::string *)") < 0) goto bad; if (__Pyx_ImportFunction(module, "contentprovider_cy_call_fct", (void (**)(void))&__pyx_api_f_6libzim_contentprovider_cy_call_fct, "zim::writer::ContentProvider *(PyObject *, std::string, std::string *)") < 0) goto bad; if (__Pyx_ImportFunction(module, "indexdata_cy_call_fct", (void (**)(void))&__pyx_api_f_6libzim_indexdata_cy_call_fct, "zim::writer::IndexData *(PyObject *, std::string, std::string *)") < 0) goto bad; if (__Pyx_ImportFunction(module, "bool_cy_call_fct", (void (**)(void))&__pyx_api_f_6libzim_bool_cy_call_fct, "bool (PyObject *, std::string, std::string *)") < 0) goto bad; if (__Pyx_ImportFunction(module, "uint64_cy_call_fct", (void (**)(void))&__pyx_api_f_6libzim_uint64_cy_call_fct, "uint64_t (PyObject *, std::string, std::string *)") < 0) goto bad; if (__Pyx_ImportFunction(module, "uint32_cy_call_fct", (void (**)(void))&__pyx_api_f_6libzim_uint32_cy_call_fct, "uint32_t (PyObject *, std::string, std::string *)") < 0) goto bad; if (__Pyx_ImportFunction(module, "geoposition_cy_call_fct", (void (**)(void))&__pyx_api_f_6libzim_geoposition_cy_call_fct, "zim::writer::IndexData::GeoPosition (PyObject *, std::string, std::string *)") < 0) goto bad; if (__Pyx_ImportFunction(module, "convertToCppHints", (void (**)(void))&__pyx_api_f_6libzim_convertToCppHints, "std::map (PyObject *)") < 0) goto bad; if (__Pyx_ImportFunction(module, "hints_cy_call_fct", (void (**)(void))&__pyx_api_f_6libzim_hints_cy_call_fct, "std::map (PyObject *, std::string, std::string *)") < 0) goto bad; Py_DECREF(module); module = 0; return 0; bad: Py_XDECREF(module); return -1; } #endif /* !__PYX_HAVE_API__libzim */ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1682955378.0 libzim-3.1.0/libzim/zim.pxd0000644000175100001730000001710214423756162015217 0ustar00runnerdocker# This file is part of python-libzim # (see https://github.com/libzim/python-libzim) # # Copyright (c) 2020 Juan Diego Caballero # Copyright (c) 2020 Matthieu Gautier # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from cpython.ref cimport PyObject from libc.stdint cimport uint32_t, uint64_t from libcpp cimport bool from libcpp.map cimport map from libcpp.memory cimport shared_ptr from libcpp.pair cimport pair from libcpp.set cimport set from libcpp.string cimport string from libcpp.vector cimport vector cdef extern from "zim/zim.h" namespace "zim": ctypedef uint64_t size_type ctypedef uint64_t offset_type ctypedef uint32_t entry_index_type cdef enum Compression: # We need to declare something here to be syntaxically correct # but we don't use those values (even if they are valid). None "zim::Compression::None" Zstd "zim::Compression::Zstd" cdef extern from "zim/writer/item.h" namespace "zim::writer": cdef cppclass WriterItem "zim::writer::Item": pass ctypedef enum HintKeys: COMPRESS FRONT_ARTICLE cdef cppclass IndexData: pass cdef extern from "zim/writer/item.h" namespace "zim::writer::IndexData": cppclass GeoPosition: GeoPosition() GeoPosition(bool, double, double) cdef extern from "zim/writer/contentProvider.h" namespace "zim::writer": cdef cppclass ContentProvider: pass cdef extern from "zim/writer/creator.h" namespace "zim::writer": cdef cppclass ZimCreator "zim::writer::Creator": void configVerbose(bint verbose) void configCompression(Compression compression) void configClusterSize(int size) void configIndexing(bint indexing, string language) void configNbWorkers(int nbWorkers) void startZimCreation(string filepath) nogil except +; void addItem(shared_ptr[WriterItem] item) nogil except + void addMetadata(string name, string content, string mimetype) nogil except + void addRedirection(string path, string title, string targetpath, map[HintKeys, uint64_t] hints) nogil except + void finishZimCreation() nogil except + void setMainPath(string mainPath) void addIllustration(unsigned int size, string content) nogil except + cdef extern from "zim/search.h" namespace "zim": cdef cppclass Query: Query() Query& setQuery(string query) Query& setGeorange(float latitude, float longitude, float distance) cdef extern from "zim/search_iterator.h" namespace "zim": cdef cppclass SearchIterator: SearchIterator() SearchIterator operator++() bint operator==(SearchIterator) bint operator!=(SearchIterator) string getPath() string getTitle() # Import the python wrappers (ObjWrapper) from libwrapper. # The only thing we need to know here is how to create the wrappers. # Other (cpp) methods must exists (to be called from cpp side), # but we don't care about them as we will not call them in python side. cdef extern from "libwrapper.h": cdef cppclass ContentProviderWrapper(ContentProvider): ContentProviderWrapper(PyObject* obj) except + cdef cppclass WriterItemWrapper: WriterItemWrapper(PyObject* obj) except + cdef cppclass IndexDataWrapper(IndexData): IndexDataWrapper(PyObject* obj) except + Compression comp_from_int(int) # Import the cpp wrappers. cdef extern from "libwrapper.h" namespace "wrapper": cdef cppclass Blob: Blob() except + Blob(const char* data, uint64_t size) except + const char* data() except + const char* end() except + uint64_t size() except + cdef cppclass Entry: string getTitle() string getPath() except + bint isRedirect() Item getItem(bint follow) except + Item getRedirect() except + Entry getRedirectEntry() except + int getIndex() except + cdef cppclass Item: string getTitle() except + string getPath() except + string getMimetype() except + Blob getData(offset_type offset) except + Blob getData(offset_type offset, size_type size) except + size_type getSize() except + int getIndex() except + cdef cppclass Archive: Archive() except + Archive(string filename) except + uint64_t getFilesize() except + Entry getEntryByPath(string path) except + Entry getEntryByPath(entry_index_type idx) except + Entry getEntryByTitle(string title) except + string getMetadata(string name) except + Item getMetadataItem(string name) except + vector[string] getMetadataKeys() except + Entry getMainEntry() except + Item getIllustrationItem() except + Item getIllustrationItem(int size) except + size_type getEntryCount() except + size_type getAllEntryCount() except + size_type getArticleCount() except + size_type getMediaCount() except + string getChecksum() except + string getFilename() except + string getUuid() except + bool hasMainEntry() except + bool hasIllustration() except + bool hasIllustration(unsigned int size) except + set[unsigned int] getIllustrationSizes() except + bool hasEntryByPath(string path) except + bool hasEntryByTitle(string title) except + bool isMultiPart() except + bool hasNewNamespaceScheme() except + bool hasFulltextIndex() except + bool hasTitleIndex() except + bool hasChecksum() except + bool check() except + cdef cppclass Searcher: Searcher() Searcher(const Archive& archive) except + setVerbose(bool verbose) Search search(Query query) except + cdef cppclass Search: int getEstimatedMatches() except + SearchResultSet getResults(int start, int count) except + cdef cppclass SearchResultSet: SearchIterator begin() SearchIterator end() int size() cdef cppclass SuggestionItem: string getPath() string getTitle() string getSnippet() bool hasSnippet() cdef cppclass SuggestionIterator: SuggestionIterator() SuggestionIterator operator++() bint operator==(SuggestionIterator) bint operator!=(SuggestionIterator) SuggestionItem getSuggestionItem() Entry getEntry() cdef cppclass SuggestionSearcher: SuggestionSearcher() SuggestionSearcher(const Archive& archive) except + setVerbose(bool verbose) SuggestionSearch suggest(string query) except + cdef cppclass SuggestionSearch: int getEstimatedMatches() except + SuggestionResultSet getResults(int start, int count) except + cdef cppclass SuggestionResultSet: SuggestionIterator begin() SuggestionIterator end() int size() cdef extern from "zim/version.h" namespace "zim": cdef vector[pair[string, string]] getVersions() ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1682955392.8671632 libzim-3.1.0/libzim.egg-info/0000755000175100001730000000000014423756201015366 5ustar00runnerdocker././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1682955392.0 libzim-3.1.0/libzim.egg-info/SOURCES.txt0000644000175100001730000000046414423756200017255 0ustar00runnerdockerLICENSE MANIFEST.in README.md pyproject.toml requirements-dev.txt setup.cfg setup.py tasks.py libzim/libwrapper.cpp libzim/libwrapper.h libzim/libzim.cpp libzim/libzim.h libzim/libzim.pyx libzim/libzim_api.h libzim/zim.pxd tests/test_libzim_creator.py tests/test_libzim_reader.py tests/test_libzim_version.py././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1682955378.0 libzim-3.1.0/pyproject.toml0000644000175100001730000000235314423756162015333 0ustar00runnerdocker[build-system] requires = [ "setuptools >= 35.0.2", "wheel >= 0.29.0", "cython >= 0.29.34,<3.0" ] build-backend = "setuptools.build_meta" [tool.black] target-version = ['py37', 'py38', 'py39', 'py310', 'py311'] [tool.pytest.ini_options] testpaths = ["tests"] pythonpath = ["."] [tool.cibuildwheel] build = "*" # disabling musllinux until https://github.com/kiwix/kiwix-build/issues/585 # disabling windows until hhttps://github.com/kiwix/kiwix-build/issues/466 # disabling PyPy due to 2 failing tests skip = "pp* *musllinux* *-win*" test-requires = ["pytest"] test-command = "py.test {project}/tests/" manylinux-x86_64-image = "manylinux_2_28" manylinux-aarch64-image = "manylinux_2_28" manylinux-pypy_x86_64-image = "manylinux_2_28" manylinux-pypy_aarch64-image = "manylinux_2_28" [tool.cibuildwheel.linux] archs = ["x86_64", "aarch64"] [tool.cibuildwheel.macos] archs = ["x86_64", "arm64"] # macOS arm64 is cross-compiled and can not be tested. # cibuildwheel skips it already. *_arm64 this removes the warning # skipping tests on cp <=3.9 as the wheels we produce are on unexpected combinations # because those python versions were released before our building host version # > requires changing wheel names test-skip = "*_arm64 cp39* cp38* cp37*" ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1682955378.0 libzim-3.1.0/requirements-dev.txt0000644000175100001730000000023314423756162016452 0ustar00runnerdockerisort>=5.10.1,<6.0 black>=22.10.0,<23.0 flake8>=6.0.0,<7.0 invoke>=1.7.3,<2.0 coverage>=6.5.0,<7.0 pytest>=7.2,<8.0 pytest-cov>=4.0.0,<5.0 Cython>=0.29.32 ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1682955392.8671632 libzim-3.1.0/setup.cfg0000644000175100001730000000306514423756201014233 0ustar00runnerdocker[metadata] name = libzim version = 3.1.0 url = https://github.com/openzim/python-libzim project_urls = Donate = https://www.kiwix.org/en/support-us/ description = A python-facing API for creating and interacting with ZIM files author = Monadical Inc. author_email = jdc@monadical.com maintainer = openZIM maintainer_email = contact+openzim@kiwix.org long_description = file: README.md long_description_content_type = text/markdown license = GPL-3.0-or-later classifiers = Development Status :: 5 - Production/Stable Topic :: Utilities Topic :: Software Development :: Libraries Topic :: Software Development :: Libraries :: Python Modules Topic :: System :: Archiving Topic :: System :: Archiving :: Compression Topic :: System :: Archiving :: Mirroring Topic :: System :: Archiving :: Backup Intended Audience :: Developers Programming Language :: Cython Programming Language :: Python :: 3 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 Typing :: Stubs Only License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) Operating System :: MacOS Operating System :: POSIX [options] include_package_data = True zim_safe = False packages = libzim python_requires = >=3.7,<3.12 setup_requires = cython >= 0.29.34,<0.30 test_requires = pytest [options.package_data] libzim = libzim.8.dylib libzim.so.8 [isort] profile = black [flake8] max-line-length = 88 [egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1682955378.0 libzim-3.1.0/setup.py0000755000175100001730000003657514423756162014151 0ustar00runnerdocker#!/usr/bin/env python3 """python-libzim (openZIM/libzim binding for Python) The project is compiled in two steps: 1. Cython: compile the cython format files (.pyx, .pyd) to C++ (.cpp and .h) 2. Cythonize: compile the generated C++ to a python-importable binary extension .so The Cython and Cythonize compilation is done automatically by the build backend""" import os import pathlib import platform as sysplatform import re import shutil import subprocess import sys import sysconfig import urllib.request from ctypes.util import find_library from pathlib import Path from typing import Optional, Tuple from Cython.Build import cythonize from Cython.Distutils.build_ext import new_build_ext as build_ext from setuptools import Command, Extension, setup class Config: libzim_dl_version: str = os.getenv("LIBZIM_DL_VERSION", "8.2.0") use_system_libzim: bool = bool(os.getenv("USE_SYSTEM_LIBZIM", False)) download_libzim: bool = not bool(os.getenv("DONT_DOWNLOAD_LIBZIM", False)) # toggle profiling for coverage report in Cython profiling: bool = os.getenv("PROFILE", "") == "1" # macOS signing should_sign_apple: bool = bool(os.getenv("SIGN_APPLE", False)) apple_signing_identity: str = os.getenv("APPLE_SIGNING_IDENTITY") apple_signing_keychain: str = os.getenv("APPLE_SIGNING_KEYCHAIN_PATH") apple_signing_keychain_profile: str = os.getenv("APPLE_SIGNING_KEYCHAIN_PROFILE") supported_platforms = { "Darwin": ["x86_64", "arm64"], "Linux": ["x86_64", "aarch64"], "Linux-musl": ["x86_64", "aarch64"], } base_dir: pathlib.Path = Path(__file__).parent # Avoid running cythonize on `setup.py clean` and similar buildless_commands: Tuple[str] = ( "clean", "--help", "egg_info", "--version", "download_libzim", ) @property def libzim_major(self) -> str: # assuming nightlies are for version 8.x return 8 if self.is_nightly else self.libzim_dl_version[0] @property def found_libzim(self) -> str: return find_library("zim") @property def is_nightly(self) -> bool: return re.match(r"\d{4}-\d{2}-\d{2}", self.libzim_dl_version) @property def platform(self) -> str: """Platform building for: Darwin, Linux""" return sysplatform.system() @property def platform_libc(self) -> str: """Platform adjusted for libc variant: Darwin, Linux, Linux-musl""" if self.platform == "Linux" and self.is_musl: return "Linux-musl" return self.platform @property def arch(self) -> str: # macOS x86_64|arm64 - linux x86_64|aarch64 # when using cibuildwheel on macOS to cross-compile, # `_PYTHON_HOST_PLATFORM` contains # a platform string like macosx-11.0-arm64 # we extract the cross-compile arch from it return ( os.getenv("_PYTHON_HOST_PLATFORM", "").rsplit("-", 1)[-1] or sysplatform.machine() ) def check_platform(self): if ( self.platform_libc not in self.supported_platforms or self.arch not in self.supported_platforms[self.platform_libc] ): raise NotImplementedError( f"Platform {self.platform_libc}/{self.arch} is not supported." ) @property def libzim_fname(self): """binary libzim dynamic library fname (platform dependent)""" # assuming we'll always link to same major return { "Darwin": f"libzim.{self.libzim_major}.dylib", "Linux": f"libzim.so.{self.libzim_major}", }[self.platform] @property def is_musl(self) -> bool: """whether running on a musl system (Alpine)""" ps = subprocess.run( ["/usr/bin/env", "ldd", "--version"], capture_output=True, text=True ) try: return "musl libc" in ps.stdout.readlines()[0] except Exception: return False @property def wants_universal(self) -> bool: """whether requesting a macOS universal build""" return self.platform == "Darwin" and sysconfig.get_platform().endswith( "universal2" ) def get_download_filename(self, arch: Optional[str] = None) -> str: """filename to download to get binary libzim for platform/arch""" arch = arch or self.arch lzplatform = {"Darwin": "macos", "Linux": "linux"}.get(self.platform) variant = "" if self.platform == "Linux": variant = "-musl" if self.is_musl else "-bionic" return pathlib.Path( f"libzim_{lzplatform}-{arch}{variant}-{self.libzim_dl_version}.tar.gz" ).name def download_to_dest(self): """download expected libzim binary into libzim/ and libzim/include/ folders""" if self.wants_universal: folders = {} for arch in self.supported_platforms["Darwin"]: folders[arch] = self._download_and_extract( self.get_download_filename(arch) ) try: # duplicate x86_64 tree as placeholder (removing first) folder = folders["x86_64"].with_name( folders["x86_64"].name.replace("x86_64", "universal") ) shutil.rmtree(folder, ignore_errors=True) shutil.copytree( folders["x86_64"], folder, symlinks=True, ignore_dangling_symlinks=True, ) # delete libzim from copied tree dest = folder / "lib" / self.libzim_fname dest.unlink() # create universal from all archs subprocess.run( ["/usr/bin/env", "lipo"] + [ str(folder / "lib" / self.libzim_fname) for folder in folders.values() ] + ["-output", str(dest), "-create"], check=True, ) finally: # clean-up temp folders for _folder in folders.values(): shutil.rmtree(_folder, ignore_errors=True) else: folder = self._download_and_extract(self.get_download_filename()) self._install_from(folder) def _download_and_extract(self, filename: str) -> pathlib.Path: """folder it downloaded and extracted libzim dist to""" fpath = self.base_dir / filename source_url = "http://download.openzim.org/release/libzim" if self.is_nightly: source_url = f"http://download.openzim.org/nightly/{self.libzim_dl_version}" url = f"{source_url}/{fpath.name}" # download a local copy if none present if not fpath.exists(): print(f"> from {url}") with urllib.request.urlopen(url) as response, open( # nosec fpath, "wb" ) as fh: # nosec fh.write(response.read()) else: print(f"> reusing local file {fpath}") print("> extracting archive") # extract into current folder (all files are inside an in-tar folder) shutil.unpack_archive(fpath, self.base_dir, "gztar") folder = fpath.with_name(fpath.name.replace(".tar.gz", "")) return folder def _install_from(self, folder: pathlib.Path): """move headers and libzim binary from dist folder to expected location""" libzim_dir = self.base_dir / "libzim" # remove existing headers if present self.base_dir.joinpath("include").mkdir(parents=True, exist_ok=True) shutil.rmtree(self.base_dir / "include" / "zim", ignore_errors=True) # copy new zim headers shutil.move(folder / "include" / "zim", self.base_dir / "include" / "zim") # copy new libs for fpath in folder.joinpath("lib").rglob("libzim.*"): print(f"{fpath} -> {libzim_dir / fpath.name}") os.replace(fpath, libzim_dir / fpath.name) # remove temp folder shutil.rmtree(folder, ignore_errors=True) assert self.base_dir.joinpath("include", "zim", "zim.h").exists() if config.platform == "Darwin": print("> ensure libzim is notarized") spctl = subprocess.run( [ "/usr/bin/env", "spctl", "-a", "-v", "-t", "install", str(self.base_dir / "libzim" / config.libzim_fname), ], check=False, ) if spctl.returncode != 0: print( "libzim binary is not notarized! Not an official release?", file=sys.stderr, ) @property def header_file(self) -> pathlib.Path: return self.base_dir / "include" / "zim" / "zim.h" @property def dylib_file(self) -> pathlib.Path: return self.base_dir / "libzim" / self.libzim_fname @property def can_sign_apple(self) -> bool: return all( [ self.platform == "Darwin", self.apple_signing_identity, self.apple_signing_keychain, self.apple_signing_keychain_profile, self.should_sign_apple, ] ) config = Config() def get_cython_extension(): define_macros = [] compiler_directives = {"language_level": "3"} if config.profiling: define_macros += [("CYTHON_TRACE", "1"), ("CYTHON_TRACE_NOGIL", "1")] compiler_directives.update(linetrace=True) include_dirs = [] library_dirs = [] runtime_library_dirs = [] if config.use_system_libzim: if not config.found_libzim: raise EnvironmentError( "[!] The libzim library cannot be found.\n" "Please verify it is correctly installed and can be found." ) print( "Using found library at {config.found_libzim}. " "Adjust CFLAGS/LDFLAGS if needed" ) else: if config.download_libzim: print("Downloading libzim. Set `DONT_DOWNLOAD_LIBZIM` not to.") config.download_to_dest() # Check for the CPP Libzim library headers in expected directory if not config.header_file.exists() or not config.dylib_file.exists(): raise EnvironmentError( "Unable to find a local copy of libzim " f"at {config.header_file} and {config.dylib_file}" ) print("Using local libzim binary. Set `USE_SYSTEM_LIBZIM` otherwise.") include_dirs.append("include") library_dirs = ["libzim"] runtime_library_dirs = ( [f"@loader_path/libzim/{config.libzim_fname}"] if sysplatform == "Darwin" else ["$ORIGIN/libzim/"] ) wrapper_extension = Extension( name="libzim", sources=["libzim/libzim.pyx", "libzim/libwrapper.cpp"], include_dirs=include_dirs, libraries=["zim"], library_dirs=library_dirs, runtime_library_dirs=runtime_library_dirs, extra_compile_args=["-std=c++11", "-Wall", "-Wextra"], language="c++", define_macros=define_macros, ) return cythonize([wrapper_extension], compiler_directives=compiler_directives) class LibzimBuildExt(build_ext): def finalize_options(self): """Workaround for rpath bug in distutils for macOS""" super().finalize_options() if config.platform == "Darwin": # Special treatment of rpath in case of OSX, to work around python # distutils bug 36353. This constructs proper rpath arguments for clang. # See https://bugs.python.org/issue36353 for path in self.rpath: for ext in self.extensions: ext.extra_link_args.append("-Wl,-rpath," + path) self.rpath[:] = [] def build_extension(self, ext): """Properly set rpath on macOS and optionaly trigger macOS signing""" super().build_extension(ext) if config.platform == "Darwin" and not config.use_system_libzim: # use install_name_tool to properly set the rpath on the wrapper # so it finds libzim in a subfolder # for ext in self.extensions: fpath = self.get_ext_fullpath(ext.name) subprocess.run( [ "/usr/bin/env", "install_name_tool", "-change", config.libzim_fname, f"@loader_path/libzim/{config.libzim_fname}", str(fpath), ], check=True, ) if config.platform == "Darwin" and config.should_sign_apple: self.sign_extension_macos(ext) def sign_extension_macos(self, ext): """sign and notarize extension on macOS""" print("Signing & Notarization of the extension") if not config.can_sign_apple: raise EnvironmentError("Can't sign for apple. Missing information") ext_fpath = pathlib.Path(self.get_ext_fullpath(ext.name)) print("> signing the extension") subprocess.run( [ "/usr/bin/env", "codesign", "--force", "--sign", config.apple_signing_identity, str(ext_fpath), "--deep", "--timestamp", ], check=True, ) print("> create ZIP package for notarization request") ext_zip = ext_fpath.with_name(f"{ext_fpath.name}.zip") subprocess.run( [ "/usr/bin/env", "ditto", "-c", "-k", "--keepParent", str(ext_fpath), str(ext_zip), ] ) print("> request notarization") # security unlock-keychain -p mysecretpassword $(pwd)/build.keychain subprocess.run( [ "/usr/bin/env", "xcrun", "notarytool", "submit", "--keychain", config.apple_signing_keychain, "--keychain-profile", config.apple_signing_keychain_profile, "--wait", ext_zip, ], check=True, ) print("> removing zip file") ext_zip.unlink() print("> displaying request status (should be rejected)") subprocess.run( [ "/usr/bin/env", "spctl", "--assess", "-vv", "--type", "install", str(ext_fpath), ], check=False, ) class DownloadLibzim(Command): """dedicated command to solely download libzim binary""" user_options = [] def initialize_options(self): ... def finalize_options(self): ... def run(self): config.check_platform() config.download_to_dest() if len(sys.argv) == 2 and sys.argv[1] in config.buildless_commands: ext_modules = None else: config.check_platform() ext_modules = get_cython_extension() setup( cmdclass={"build_ext": LibzimBuildExt, "download_libzim": DownloadLibzim}, ext_modules=ext_modules, ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1682955378.0 libzim-3.1.0/tasks.py0000644000175100001730000000360714423756162014121 0ustar00runnerdocker#!/usr/bin/env python3 """ A description file for invoke (https://www.pyinvoke.org/) """ import inspect # temp local fix for https://github.com/pyinvoke/invoke/issues/891 if not hasattr(inspect, "getargspec"): inspect.getargspec = inspect.getfullargspec from invoke import task @task def download_libzim(c, version=""): """download C++ libzim binary""" env = f"LIBZIM_DL_VERSION={version}" if version else "" c.run(f"{env} python setup.py download_libzim") @task def build_ext(c): """build extension to use locally (devel, tests)""" c.run("PROFILE=1 python setup.py build_ext -i") @task def test(c): """run test suite""" c.run("python -m pytest --color=yes --ff -x .") @task def coverage(c): """generate coverage report""" c.run( "python -m pytest --color=yes " "--cov=libzim --cov-config=.coveragerc " "--cov-report=term --cov-report term-missing ." ) @task def clean(c): """remove build folder and generated files""" c.run("rm -rf build") c.run("rm -f *.so") c.run("rm -rf include") c.run("rm -rf libzim/libzim.{so,dylib} libzim/libzim.so.* libzim/libzim.*.dylib") @task def install_dev(c): """install dev requirements""" c.run("pip install -r requirements-dev.txt") @task def check(c): """run Q/A checks""" c.run("isort --check-only .") c.run("black --check .") c.run('echo "one pass for show-stopper syntax errors or undefined names"') c.run("flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics") c.run('echo "one pass for small stylistic things"') c.run("flake8 . --count --statistics") @task def lint(c): """Apply Q/A linting""" c.run("isort .") c.run("black .") c.run("flake8 .") if __name__ == "__main__": print( "This file is not intended to be directly run.\n" "Install invoke and run the `invoke` command line." ) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1682955392.8671632 libzim-3.1.0/tests/0000755000175100001730000000000014423756201013550 5ustar00runnerdocker././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1682955378.0 libzim-3.1.0/tests/test_libzim_creator.py0000644000175100001730000006173714423756162020212 0ustar00runnerdocker#!/usr/bin/env python import base64 import datetime import itertools import os import pathlib import subprocess import sys from typing import Dict import pytest import libzim.writer from libzim.reader import Archive from libzim.search import Query, Searcher from libzim.suggestion import SuggestionSearcher from libzim.writer import ( Blob, ContentProvider, Creator, FileProvider, Hint, IndexData, Item, StringProvider, ) HOME_PATH = "lorem_ipsum" class StaticItem(libzim.writer.Item): def __init__(self, **kwargs): super().__init__() for k, v in kwargs.items(): setattr(self, k, v) def get_path(self) -> str: return getattr(self, "path", "") def get_title(self) -> str: return getattr(self, "title", "") def get_mimetype(self) -> str: return getattr(self, "mimetype", "") def get_contentprovider(self) -> libzim.writer.ContentProvider: if getattr(self, "filepath", None): return FileProvider(filepath=self.filepath) return StringProvider(content=getattr(self, "content", "")) def get_hints(self) -> Dict[Hint, int]: return getattr(self, "hints", {Hint.FRONT_ARTICLE: True}) @pytest.fixture(scope="function") def fpath(tmpdir): return pathlib.Path(tmpdir / "test.zim") @pytest.fixture(scope="module") def favicon_data(): return base64.b64decode( "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQ" + "ImWO4ISn6HwAE2QIGKsd69QAAAABJRU5ErkJggg==" ) @pytest.fixture(scope="module") def lipsum(): return ( "Lorem Ipsum" "

What is Lorem Ipsum?

Lorem Ipsum is" "simply dummy text of the printing and typesetting industry. Lorem" "Ipsum has been the industry's standard dummy text ever since the" "1500s, when an unknown printer took a galley of type and scrambled it" "to make a type specimen book. It has survived not only five centuries," "but also the leap into electronic typesetting, remaining essentially" "unchanged. It was popularised in the 1960s with the release of" "Letraset sheets containing Lorem Ipsum passages, and more recently" "with desktop publishing software like Aldus PageMaker including" "versions of Lorem Ipsum.

Why do we use it?

" "

It is a long established fact that a reader will be distracted by" "the readable content of a page when looking at its layout. The point" "of using Lorem Ipsum is that it has a more-or-less normal distribution" "of letters, as opposed to using 'Content here, content here', making" "it look like readable English. Many desktop publishing packages and" "web page editors now use Lorem Ipsum as their default model text, and" "a search for 'lorem ipsum' will uncover many web sites still in their" "infancy. Various versions have evolved over the years, sometimes by" "accident, sometimes on purpose (injected humour and the like).

" "

Where does it come from?

Contrary to" "popular belief, Lorem Ipsum is not simply random text. It has roots in" "a piece of classical Latin literature from 45 BC, making it over 2000" "years old. Richard McClintock, a Latin professor at Hampden-Sydney" "College in Virginia, looked up one of the more obscure Latin words," "consectetur, from a Lorem Ipsum passage, and going through the cites" "of the word in classical literature, discovered the undoubtable" 'source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de' 'Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero,' "written in 45 BC. This book is a treatise on the theory of ethics," "very popular during the Renaissance. The first line of Lorem Ipsum," '"Lorem ipsum dolor sit amet..", comes from a line in section' "1.10.32.

The standard chunk of Lorem Ipsum used since the 1500s" "is reproduced below for those interested. Sections 1.10.32 and 1.10.33" 'from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in' "their exact original form, accompanied by English versions from the" "1914 translation by H. Rackham.

Where can I get" "some?

There are many variations of passages of Lorem Ipsum" "available, but the majority have suffered alteration in some form, by" "injected humour, or randomised words which don't look even slightly" "believable. If you are going to use a passage of Lorem Ipsum, you need" "to be sure there isn't anything embarrassing hidden in the middle of" "text. All the Lorem Ipsum generators on the Internet tend to repeat" "predefined chunks as necessary, making this the first true generator" "on the Internet. It uses a dictionary of over 200 Latin words," "combined with a handful of model sentence structures, to generate" "Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is" "therefore always free from repetition, injected humour, or" "non-characteristic words etc.

" ) @pytest.fixture(scope="module") def lipsum_item(lipsum): return StaticItem(path=HOME_PATH, content=lipsum, mimetype="text/html") def test_imports(): assert libzim.writer.Compression # noqa assert libzim.writer.Blob # noqa assert libzim.writer.Item # noqa assert libzim.writer.ContentProvider # noqa assert libzim.writer.FileProvider # noqa assert libzim.writer.StringProvider # noqa assert libzim.writer.Creator # noqa def test_creator_filename(fpath): with Creator(fpath) as c: assert c.filename == fpath assert Archive(fpath).filename == fpath def test_creator_repr(fpath): with Creator(fpath) as c: assert str(fpath) in str(c) def get_creator_output(fpath, verbose): """run creator with configVerbose(verbose) and return its stdout as str""" code = """ from libzim.writer import Creator with Creator("{fpath}").config_verbose({verbose}) as creator: pass """.replace( "{fpath}", str(fpath) ).replace( "{verbose}", str(verbose) ) ps = subprocess.run( [sys.executable, "-c", code], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, ) assert ps.returncode == 0 return ps.stdout @pytest.mark.parametrize("verbose", [(True, False)]) def test_creator_verbose(fpath, verbose): output = get_creator_output(fpath, verbose).strip() lines = output.splitlines() if verbose: assert "T:" in output assert len(lines) >= 5 else: assert len(lines) == 2 def test_creator_compression(fpath, lipsum_item): """make sure we can create ZIM files with various compression algorithms also makes sure we're getting different sizes using diffrent alg. based on a piece of text that should give different results""" filesizes = {} for comp in libzim.writer.Compression.__members__.keys(): fpath_str = fpath.with_name(f"{fpath.name}_{comp}_str.zim") with Creator(fpath_str).config_compression(comp) as c: c.add_item(lipsum_item) fpath_val = fpath.with_name(f"{fpath.name}_{comp}_val.zim") comp_val = getattr(libzim.writer.Compression, comp) with Creator(fpath_val).config_compression(comp_val) as c: c.add_item(lipsum_item) assert Archive(fpath_str).checksum assert Archive(fpath_str).filesize == Archive(fpath_val).filesize filesizes[comp] = Archive(fpath_str).filesize for a, b in itertools.combinations(filesizes.keys(), 2): assert filesizes[a] != filesizes[b] # now don't specify with Creator(fpath) as c: c.add_item(lipsum_item) # default should be zstd assert Archive(fpath).filesize == filesizes["zstd"] @pytest.mark.parametrize("cluster_size", [0, 128, 512, 8196, 10240]) def test_creator_clustersize(fpath, cluster_size, lipsum_item): """ensure we can create ZIM with arbitrary min-cluster-size""" with Creator(fpath).config_clustersize(cluster_size) as c: c.add_item(lipsum_item) @pytest.mark.parametrize( "indexing, language, expected", [ (False, "a", 0), (False, "eng", 0), (True, "eng", 1), (True, "en", 1), (True, "fra", 1), (True, "fr", 1), ], ) def test_creator_indexing(fpath, lipsum_item, indexing, language, expected): with Creator(fpath).config_indexing(indexing, language) as c: c.add_item(lipsum_item) zim = Archive(fpath) assert zim.has_fulltext_index == indexing if indexing: query = Query().set_query("standard") searcher = Searcher(zim) search = searcher.search(query) assert search.getEstimatedMatches() == expected @pytest.mark.parametrize("nb_workers", [1, 2, 3, 5]) def test_creator_nbworkers(fpath, lipsum_item, nb_workers): with Creator(fpath).config_nbworkers(nb_workers) as c: c.add_item(lipsum_item) def test_creator_combine_config(fpath, lipsum_item): with Creator(fpath).config_verbose(True).config_compression( "zstd" ).config_clustersize(1024).config_indexing(True, "eng").config_nbworkers(2) as c: c.add_item(lipsum_item) @pytest.mark.parametrize( "name, args", [ ("verbose", (True,)), ("compression", ("zstd",)), ("clustersize", (1024,)), ("indexing", (True, "eng")), ("nbworkers", (2,)), ], ) def test_creator_config_poststart(fpath, name, args): with Creator(fpath) as c: with pytest.raises(RuntimeError, match="started"): getattr(c, f"config_{name}")(*args) def test_creator_nocontext(fpath, lipsum_item): """ensure we can use the creator linearily""" creator = Creator(fpath) exc_type, exc_val, exc_tb = None, None, None creator.__enter__() creator.add_metadata("Name", "name") creator.add_item(lipsum_item) with pytest.raises(RuntimeError): creator.config_verbose(True) creator.__exit__(exc_type, exc_val, exc_tb) # now with an exception creator = Creator(fpath) creator.__enter__() creator.add_item(lipsum_item) try: creator.add_redirection("A", HOME_PATH) except Exception: exc_type, exc_val, exc_tb = sys.exc_info() with pytest.raises(TypeError): raise creator.__exit__(exc_type, exc_val, exc_tb) def test_creator_subclass(fpath, lipsum_item): class ACreator(Creator): def __init__(self, fpath, tata): super().__init__(filename=fpath) self.ready = False def __exit__(self, exc_type, exc_val, exc_tb): super().__exit__(exc_type, exc_val, exc_tb) self.ready = True creator = ACreator(fpath, tata=2) assert creator.ready is False with creator: assert creator.ready is False creator.add_item(lipsum_item) assert creator.ready is True def test_creator_mainpath(fpath, lipsum_item): main_path = HOME_PATH with Creator(fpath).set_mainpath(main_path) as c: c.add_item(lipsum_item) zim = Archive(fpath) assert zim.has_main_entry is True assert zim.main_entry.path == "mainPage" assert zim.main_entry.get_item().path == main_path fpath.unlink() with Creator(fpath) as c: c.add_item(lipsum_item) zim = Archive(fpath) assert zim.has_main_entry is False with pytest.raises(RuntimeError): assert zim.main_entry def test_creator_illustration(fpath, favicon_data): with Creator(fpath) as c: c.add_illustration(48, favicon_data) c.add_illustration(96, favicon_data) zim = Archive(fpath) assert zim.has_illustration() is True assert zim.has_illustration(48) is True assert zim.has_illustration(96) is True assert zim.has_illustration(128) is False assert bytes(zim.get_illustration_item().content) == favicon_data assert bytes(zim.get_illustration_item(96).content) == favicon_data assert zim.get_illustration_sizes() == {48, 96} def test_creator_additem(fpath, lipsum_item): # ensure we can't add if not started c = Creator(fpath) with pytest.raises(RuntimeError, match="not started"): c.add_item(lipsum_item) del c with Creator(fpath) as c: c.add_item(lipsum_item) with pytest.raises(TypeError, match="must not be None"): c.add_item(None) with pytest.raises(RuntimeError): c.add_item("hello") with pytest.raises(TypeError, match="takes no keyword arguments"): c.add_item(mimetype="text/html") def test_creator_metadata(fpath, lipsum_item): metadata = { # kiwix-mandatory "Name": "wikipedia_fr_football", "Title": "English Wikipedia", "Creator": "English speaking Wikipedia contributors", "Publisher": "Wikipedia user Foobar", "Date": "2009-11-21", "Description": "All articles (without images) from the english Wikipedia", "Language": "eng", # optional "Longdescription": ( "This ZIM file contains all articles (without images) " "from the english Wikipedia by 2009-11-10." " The topics are ..." ), "Licence": "CC-BY", "Tags": "wikipedia;_category:wikipedia;_pictures:no;" "_videos:no;_details:yes;_ftindex:yes", "Flavour": "nopic", "Source": "https://en.wikipedia.org/", "Scraper": "sotoki 1.2.3", } # ensure we can't add if not started c = Creator(fpath) with pytest.raises(RuntimeError, match="not started"): key = next(iter(metadata.keys())) c.add_metadata(key, metadata.get(key)) del c with Creator(fpath) as c: c.add_item(lipsum_item) for name, value in metadata.items(): if name == "Date": continue c.add_metadata(name, value) mdate = datetime.date(*[int(x) for x in metadata.get("Date").split("-")]) c.add_metadata("Date", mdate) zim = Archive(fpath) for name, value in metadata.items(): assert zim.get_metadata(name).decode("UTF-8") == value def test_creator_metadata_overwrite(fpath, lipsum_item, favicon_data): """re-adding an Entry (even Metadata) now raises an exception (libzim 7.2+)""" with Creator(fpath) as c: c.add_item(lipsum_item) with pytest.raises(RuntimeError, match="Impossible to add"): c.add_item(lipsum_item) c.add_metadata("Key", "first") with pytest.raises(RuntimeError, match="Impossible to add"): c.add_metadata("Key", "second") c.add_redirection("home", lipsum_item.get_path(), "Home", {}) with pytest.raises(RuntimeError, match="Impossible to add"): c.add_redirection("home", lipsum_item.get_path(), "Home again", {}) c.add_illustration(48, favicon_data) # this currently segfaults but it should not with pytest.raises(RuntimeError, match="Impossible to add"): c.add_illustration(48, favicon_data) zim = Archive(fpath) assert zim.get_metadata("Key").decode("UTF-8") == "first" def test_creator_redirection(fpath, lipsum_item): # ensure we can't add if not started c = Creator(fpath) with pytest.raises(RuntimeError, match="not started"): c.add_redirection("home", "hello", HOME_PATH, {Hint.FRONT_ARTICLE: True}) del c with Creator(fpath) as c: c.add_item(lipsum_item) c.add_redirection("home", "hello", HOME_PATH, {Hint.FRONT_ARTICLE: True}) c.add_redirection("accueil", "bonjour", HOME_PATH, {Hint.FRONT_ARTICLE: True}) zim = Archive(fpath) assert zim.entry_count == 3 assert zim.has_entry_by_path("home") is True assert zim.has_entry_by_path("accueil") is True assert zim.get_entry_by_path("home").is_redirect assert ( zim.get_entry_by_path("home").get_redirect_entry().path == zim.get_entry_by_path(HOME_PATH).path ) assert zim.get_entry_by_path("accueil").get_item().path == HOME_PATH # suggestions sugg_searcher = SuggestionSearcher(zim) sugg_hello = sugg_searcher.suggest("hello") assert "home" in list(sugg_hello.getResults(0, sugg_hello.getEstimatedMatches())) sugg_bonjour = sugg_searcher.suggest("bonjour") assert "accueil" in list( sugg_bonjour.getResults(0, sugg_hello.getEstimatedMatches()) ) def test_item_notimplemented(fpath, lipsum_item): item = Item() for member in ("path", "title", "mimetype", "contentprovider"): with pytest.raises(NotImplementedError): getattr(item, f"get_{member}")() assert HOME_PATH in str(lipsum_item) assert lipsum_item.get_title() in str(lipsum_item) def test_contentprovider(fpath): cp = ContentProvider() for member in ("get_size", "gen_blob"): with pytest.raises(NotImplementedError): getattr(cp, member)() def test_fileprovider(fpath, lipsum): lipsum_fpath = fpath.with_name("lipsum.html") with open(lipsum_fpath, "w") as fh: for _ in range(0, 10): fh.write(lipsum) item = StaticItem(path=HOME_PATH, filepath=lipsum_fpath, mimetype="text/html") assert HOME_PATH in str(item) assert item.get_title() in str(item) with Creator(fpath) as c: c.add_item(item) zim = Archive(fpath) with open(lipsum_fpath, "rb") as fh: assert bytes(zim.get_entry_by_path(HOME_PATH).get_item().content) == fh.read() # test feed streaming cp = item.get_contentprovider() b = cp.feed() while b.size(): assert isinstance(b, Blob) b = cp.feed() def test_stringprovider(fpath, lipsum): item = StaticItem(path=HOME_PATH, content=lipsum, mimetype="text/html") assert HOME_PATH in str(item) assert item.get_title() in str(item) with Creator(fpath) as c: c.add_item(item) zim = Archive(fpath) assert bytes(zim.get_entry_by_path(HOME_PATH).get_item().content) == lipsum.encode( "UTF-8" ) # test feed streaming cp = item.get_contentprovider() b = cp.feed() while b.size(): assert isinstance(b, Blob) b = cp.feed() def test_item_contentprovider_none(fpath): class AnItem: def get_path(self): return "" def get_title(self): return "" def get_mimetype(self): return "" def get_contentprovider(self): return "" def get_hints(self): return {} with Creator(fpath) as c: with pytest.raises(RuntimeError, match="ContentProvider is None"): c.add_item(AnItem()) def test_missing_contentprovider(fpath): class AnItem: def get_path(self): return "" def get_title(self): return "" def get_mimetype(self): return "" def get_hints(self): return {} with Creator(fpath) as c: with pytest.raises(RuntimeError, match="has no attribute"): c.add_item(AnItem()) def test_missing_hints(fpath): class AnItem: def get_path(self): return "" def get_title(self): return "" def get_mimetype(self): return "" with Creator(fpath) as c: with pytest.raises(RuntimeError, match="has no attribute 'get_hints'"): c.add_item(AnItem()) with pytest.raises(RuntimeError, match="must be implemented"): c.add_item(libzim.writer.Item()) def test_nondict_hints(fpath): with Creator(fpath) as c: with pytest.raises(RuntimeError, match="has no attribute 'items'"): c.add_item(StaticItem(path="1", title="", hints=1)) with pytest.raises(TypeError, match="hints"): c.add_redirection("a", "", "b", hints=1) def test_hints_values(fpath): with Creator(fpath) as c: # correct values c.add_item(StaticItem(path="0", title="", hints={})) c.add_item( StaticItem( path="1", title="", hints={Hint.FRONT_ARTICLE: True, Hint.COMPRESS: False}, ) ) # non-expected Hints are ignored c.add_item(StaticItem(path="2", title="", hints={"hello": "world"})) # Hint values are casted to bool c.add_item(StaticItem(path="3", title="", hints={Hint.FRONT_ARTICLE: "world"})) c.add_redirection( path="4", title="", targetPath="0", hints={Hint.COMPRESS: True} ) # filtered-out values c.add_item(StaticItem(path="5", title="", hints={5: True})) c.add_item(StaticItem(path="6", title="", hints={"yolo": True})) c.add_item(StaticItem(path="7", title="", hints={"FRONT_ARTICLE": True})) c.add_item(StaticItem(path="8", title="", hints={0: True})) # non-existent Hint with pytest.raises(AttributeError, match="YOLO"): c.add_item(StaticItem(path="0", title="", hints={Hint.YOLO: True})) with pytest.raises(AttributeError, match="YOLO"): c.add_redirection( path="5", title="", target_path="0", hints={Hint.YOLO: True} ) @pytest.mark.parametrize( "indexData, customContent, search_expected", [ (None, "", [("standard", 1), ("home", 0), ("computer", 0)]), (False, "", [("standard", 1), ("home", 0), ("computer", 0)]), (True, "home", [("standard", 1), ("home", 1), ("computer", 0)]), (True, "computer", [("standard", 1), ("home", 0), ("computer", 1)]), (True, "standard", [("standard", 2), ("home", 0), ("computer", 0)]), ], ) def test_custom_indexdata( fpath, lipsum_item, lipsum, indexData, customContent, search_expected ): item = StaticItem(path=HOME_PATH + "custom", content=lipsum, mimetype="text/html") if indexData is None: item.get_indexdata = lambda: None else: class CustomIndexData(IndexData): def has_indexdata(self): return indexData def get_title(self): return "" def get_content(self): return customContent def get_keywords(self): return "" def get_wordcount(self): return 1 item.get_indexdata = CustomIndexData with Creator(fpath).config_indexing(True, "eng") as c: c.add_item(lipsum_item) c.add_item(item) zim = Archive(fpath) searcher = Searcher(zim) for search_query, expected in search_expected: query = Query().set_query(search_query) search = searcher.search(query) assert search.getEstimatedMatches() == expected def test_indexdata_interface(): default_id = IndexData() assert default_id.has_indexdata() is False for method in ("title", "content", "keywords", "wordcount"): with pytest.raises(NotImplementedError): getattr(default_id, f"get_{method}")() assert default_id.get_geoposition() is None def test_exc_in_indexdata(fpath, lipsum): item = StaticItem(path=HOME_PATH + "custom", content=lipsum, mimetype="text/html") class CustomIndexData(IndexData): def has_indexdata(self): raise IndexError item.get_indexdata = CustomIndexData with pytest.raises(RuntimeError, match="IndexError"): with Creator(fpath).config_indexing(True, "eng") as c: c.add_item(item) def test_reimpfeed(fpath): class AContentProvider: def __init__(self): self.called = False def get_size(self): return 1 def feed(self): if self.called: return Blob("") self.called = True return Blob("1") class AnItem: def get_path(self): return "-" def get_title(self): return "" def get_mimetype(self): return "" def get_hints(self): return {} def get_contentprovider(self): return AContentProvider() with Creator(fpath) as c: c.add_item(AnItem()) item = AnItem() cp = item.get_contentprovider() assert cp.get_size() == 1 assert cp.feed().size() == 1 def test_virtualmethods_int_exc(fpath): class AContentProvider: def get_size(self): return "" def feed(self): return Blob("") class AnItem: def get_path(self): return "" def get_title(self): return "" def get_mimetype(self): return "" def get_hints(self): return {} def get_contentprovider(self): return AContentProvider() with Creator(fpath) as c: with pytest.raises(RuntimeError, match="TypeError: an integer is required"): c.add_item(AnItem()) def test_creator_badfilename(tmpdir): if os.getuid() != 0: # lack of perm with pytest.raises(IOError): Creator("/root/test.zim") # forward slash points to non-existing folder with pytest.raises(IOError): Creator(tmpdir / "test/test.zim") ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1682955378.0 libzim-3.1.0/tests/test_libzim_reader.py0000644000175100001730000004352514423756162020010 0ustar00runnerdocker#!/usr/bin/env python import gc import os import pathlib import uuid from urllib.request import urlretrieve import pytest import libzim.writer from libzim.reader import Archive from libzim.search import Query, Searcher from libzim.suggestion import SuggestionSearcher # expected data for tests ZIMs (see `all_zims`) ZIMS_DATA = { "blank.zim": { "filename": "blank.zim", "filesize": 2197, "new_ns": True, "mutlipart": False, "zim_uuid": None, "metadata_keys": ["Counter"], "test_metadata": None, "test_metadata_value": None, "has_main_entry": False, "has_favicon_entry": False, "has_fulltext_index": False, "has_title_index": False, "has_checksum": True, "checksum": None, "is_valid": True, "entry_count": 0, "all_entry_count": 2, "article_count": 0, "media_count": 0, "suggestion_string": None, "suggestion_count": 0, "suggestion_result": [], "search_string": None, "search_count": 0, "search_result": [], "test_path": None, "test_title": None, "test_mimetype": None, "test_size": None, "test_content_includes": None, "test_redirect": None, "test_redirect_to": None, }, "zimfile.zim": { "filename": "zimfile.zim", "filesize": 569304, "new_ns": False, "mutlipart": False, "zim_uuid": "6f1d19d0633f087bfb557ac324ff9baf", "metadata_keys": [ "Counter", "Creator", "Date", "Description", "Flavour", "Language", "Name", "Publisher", "Scraper", "Tags", "Title", ], "test_metadata": "Name", "test_metadata_value": "wikipedia_en_ray_charles", "has_main_entry": True, "has_favicon_entry": True, "has_fulltext_index": True, "has_title_index": True, "has_checksum": True, "checksum": None, "is_valid": True, "entry_count": 371, "all_entry_count": 371, "article_count": 129, "media_count": 45, "suggestion_string": "lucky", "suggestion_count": 1, "suggestion_result": ["A/That_Lucky_Old_Sun"], "search_string": "lucky", "search_count": 1, "search_result": ["A/That_Lucky_Old_Sun"], "test_path": "A/A_Song_for_You", "test_title": "A Song for You", "test_mimetype": "text/html", "test_size": 7461, "test_content_includes": "which was released in 1970 on Shelter Records", "test_redirect": "A/What_I_Say", "test_redirect_to": "A/What'd_I_Say", }, "example.zim": { "filename": "example.zim", "filesize": 259145, "new_ns": True, "mutlipart": False, "zim_uuid": "5dc0b3af5df20925f0cad2bf75e78af6", "metadata_keys": [ "Counter", "Creator", "Date", "Description", "Language", "Publisher", "Scraper", "Tags", "Title", ], "test_metadata": "Title", "test_metadata_value": "Wikibooks", "has_main_entry": True, "has_favicon_entry": False, "has_fulltext_index": True, "has_title_index": True, "has_checksum": True, "checksum": "abcd818c87079cb29282282b47ee46ec", "is_valid": True, "entry_count": 60, "all_entry_count": 75, "article_count": 0, "media_count": 22, "suggestion_string": "Free", "suggestion_count": 1, "suggestion_result": [ "FreedomBox for Communities_Offline Wikipedia " + "- Wikibooks, open books for an open world.html" ], "search_string": "main", "search_count": 2, "search_result": [ "Wikibooks.html", "FreedomBox for Communities_Offline Wikipedia " + "- Wikibooks, open books for an open world.html", ], "test_path": "FreedomBox for Communities_Offline Wikipedia - Wikibooks, " "open books for an open world.html", "test_title": "FreedomBox for Communities/Offline Wikipedia - Wikibooks, " "open books for an open world", "test_mimetype": "text/html", "test_size": 52771, "test_content_includes": "looking forward to your contributions.", "test_redirect": None, }, "corner_cases%23%26.zim": { "filename": "corner_cases%23%26.zim", "filesize": 35991, "new_ns": True, "mutlipart": False, "zim_uuid": "702abcbe6fe926152f5d451af7986437", "metadata_keys": [ "Counter", "Date", "Illustration_48x48@1", "Language", "Scraper", "Tags", "Title", ], "test_metadata": "Title", "test_metadata_value": "ZIM corner cases", "has_main_entry": True, "has_favicon_entry": True, "has_fulltext_index": False, "has_title_index": True, "has_checksum": True, "checksum": None, "is_valid": True, "entry_count": 7, "all_entry_count": 18, "article_count": 2, "media_count": 1, "suggestion_string": "c#", "suggestion_count": 1, "suggestion_result": ["c#.html"], "search_string": None, "search_count": 0, "search_result": [], "test_path": "empty.html", "test_title": "empty.html", "test_mimetype": "text/html", "test_size": 0, "test_content_includes": "", "test_redirect": None, "test_redirect_to": None, }, "small.zim": { "filename": "small.zim", "filesize": 41155, "new_ns": True, "mutlipart": False, "zim_uuid": "3581ae7eedd57e6cd2f1c0cab073643f", "metadata_keys": [ "Counter", "Creator", "Date", "Description", "Illustration_48x48@1", "Language", "Publisher", "Scraper", "Tags", "Title", ], "test_metadata": "Title", "test_metadata_value": "Test ZIM file", "has_main_entry": True, "has_favicon_entry": True, "has_fulltext_index": False, "has_title_index": True, "has_checksum": True, "checksum": None, "is_valid": True, "entry_count": 2, "all_entry_count": 16, "article_count": 1, "media_count": 1, "suggestion_string": None, "suggestion_count": None, "suggestion_result": None, "search_string": None, "search_count": None, "search_result": None, "test_path": "main.html", "test_title": "Test ZIM file", "test_mimetype": "text/html", "test_size": 207, "test_content_includes": "Test ZIM file", "test_redirect": None, "test_redirect_to": None, }, } skip_if_offline = pytest.mark.skipif( bool(os.getenv("OFFLINE")), reason="OFFLINE environ requested offline-only" ) def get_pytest_param(name, *fields): args = [ZIMS_DATA[name].get(field, f"MISSING-VALUE {field}") for field in fields] return pytest.param(*args) def get_pytest_params_list(*fields): return [get_pytest_param(name, *fields) for name in ZIMS_DATA.keys()] def parametrize_for(fields): return ( ", ".join(fields), get_pytest_params_list(*fields), ) @pytest.fixture(scope="module") def all_zims(tmpdir_factory): """creates a temp dir with all ZIM files inside: - downloaded ones from libzim - blank one created with pylibzim""" temp_dir = tmpdir_factory.mktemp("data") libzim_urls = [ f"https://github.com/kiwix/libkiwix/raw/main/test/data/{name}" for name in ("zimfile.zim", "example.zim", "corner_cases%23%26.zim") ] + ["https://github.com/openzim/zim-testing-suite/raw/main/data/nons/small.zim"] # download libzim tests for url in libzim_urls: urlretrieve(url, temp_dir / os.path.basename(url)) # nosec # create blank using pylibzim creator = libzim.writer.Creator(temp_dir / "blank.zim") with creator: pass return pathlib.Path(temp_dir) def test_open_badfile(tmpdir): fpath = tmpdir / "not-exist.zim" with pytest.raises(RuntimeError): Archive(fpath) fpath = tmpdir / "not-zim.zim" with open(fpath, "w") as fh: fh.write("text file") with pytest.raises(RuntimeError): Archive(fpath) @skip_if_offline def test_content_ref_keep(all_zims): """Get the memoryview on a content and loose the reference on the article. We try to load a lot of other articles to detect possible use of dandling pointer """ archive = Archive(all_zims / "zimfile.zim") content = None def get_content(): nonlocal content entry = archive.get_entry_by_path("A/That_Lucky_Old_Sun") item = entry.get_item() assert isinstance(item.content, memoryview) content = item.content get_content() # Now we have a content but no reference to the entry/item. gc.collect() # Load a lot of content for i in range(0, archive.entry_count, 2): entry = archive._get_entry_by_id(i) if not entry.is_redirect: _ = entry.get_item().content # Check everything is ok assert len(content) == 3559 assert ( bytes(content[:100]) == b'\n\n ' b'\n That Lucky Old Sun<' # noqa ) @skip_if_offline @pytest.mark.parametrize( *parametrize_for(["filename", "filesize", "new_ns", "mutlipart", "zim_uuid"]) ) def test_reader_archive(all_zims, filename, filesize, new_ns, mutlipart, zim_uuid): fpath = all_zims / filename zim = Archive(fpath) # check externaly verifiable data assert zim.filename == fpath assert zim.filesize == os.path.getsize(fpath) if filesize is not None: assert zim.filesize == filesize assert zim.has_new_namespace_scheme is new_ns assert zim.is_multipart is mutlipart assert str(fpath) in str(zim) # ensure uuid is returned assert isinstance(zim.uuid, uuid.UUID) assert len(zim.uuid.hex) == 32 if zim_uuid: assert zim.uuid.hex == zim_uuid @skip_if_offline @pytest.mark.parametrize( *parametrize_for( ["filename", "metadata_keys", "test_metadata", "test_metadata_value"] ) ) def test_reader_metadata( all_zims, filename, metadata_keys, test_metadata, test_metadata_value ): zim = Archive(all_zims / filename) # make sure metadata_keys is empty assert zim.metadata_keys == metadata_keys if test_metadata: assert zim.get_metadata(test_metadata).decode("UTF-8") == test_metadata_value item = zim.get_metadata_item(test_metadata) assert item.mimetype in ("text/plain", "text/plain;charset=utf-8") # newer assert item.size > 1 @skip_if_offline @pytest.mark.parametrize( *parametrize_for(["filename", "new_ns", "has_main_entry", "has_favicon_entry"]) ) def test_reader_main_favicon_entries( all_zims, filename, new_ns, has_main_entry, has_favicon_entry ): zim = Archive(all_zims / filename) # make sure we have no main entry assert zim.has_main_entry is has_main_entry if has_main_entry is False: with pytest.raises(RuntimeError): assert zim.main_entry else: assert zim.main_entry if new_ns: assert zim.main_entry.path == "mainPage" # make sure we have no favicon entry assert zim.has_illustration(48) is has_favicon_entry if has_favicon_entry: assert 48 in zim.get_illustration_sizes() if has_favicon_entry is False: with pytest.raises(KeyError): assert zim.get_illustration_item(48) else: assert zim.get_illustration_item() if new_ns: assert zim.get_illustration_item().path == "Illustration_48x48@1" assert zim.get_illustration_sizes() == {48} assert zim.get_metadata_item("Illustration_48x48@1").mimetype == "image/png" @skip_if_offline @pytest.mark.parametrize( *parametrize_for(["filename", "has_fulltext_index", "has_title_index"]) ) def test_reader_has_index(all_zims, filename, has_fulltext_index, has_title_index): zim = Archive(all_zims / filename) # we should not get a fulltext index but title should assert zim.has_fulltext_index is has_fulltext_index assert zim.has_title_index is has_title_index @skip_if_offline @pytest.mark.parametrize(*parametrize_for(["filename", "has_checksum", "is_valid"])) def test_reader_checksum(all_zims, filename, has_checksum, is_valid): zim = Archive(all_zims / filename) # verify checksum assert zim.has_checksum is has_checksum assert isinstance(zim.checksum, str) assert len(zim.checksum) == 32 if has_checksum else 0 assert zim.checksum != zim.uuid assert zim.check() is is_valid @skip_if_offline @pytest.mark.parametrize( *parametrize_for( [ "filename", "entry_count", "all_entry_count", "article_count", "media_count", "has_fulltext_index", "suggestion_string", "suggestion_count", "suggestion_result", "search_string", "search_count", "search_result", ] ) ) def test_reader_suggest_search( all_zims, filename, entry_count, all_entry_count, article_count, media_count, has_fulltext_index, suggestion_string, suggestion_count, suggestion_result, search_string, search_count, search_result, ): zim = Archive(all_zims / filename) # suggestion and search results assert zim.entry_count == entry_count assert zim.all_entry_count == all_entry_count assert zim.article_count == article_count assert zim.media_count == media_count if has_fulltext_index and search_string is not None: query = Query().set_query(search_string) searcher = Searcher(zim) search = searcher.search(query) assert search.getEstimatedMatches() == search_count assert list(search.getResults(0, search_count)) == search_result if suggestion_string is not None: suggestion_searcher = SuggestionSearcher(zim) suggestion = suggestion_searcher.suggest(suggestion_string) assert suggestion.getEstimatedMatches() == suggestion_count assert list(suggestion.getResults(0, suggestion_count)) == suggestion_result @skip_if_offline @pytest.mark.parametrize( *parametrize_for( [ "filename", "test_path", "test_title", "test_mimetype", "test_size", "test_content_includes", ] ) ) def test_reader_get_entries( all_zims, filename, test_path, test_title, test_mimetype, test_size, test_content_includes, ): zim = Archive(all_zims / filename) # entries with pytest.raises(KeyError): zim.get_entry_by_path("___missing") if test_path: assert zim.has_entry_by_path(test_path) entry = zim.get_entry_by_path(test_path) assert entry.title == test_title assert entry.path == test_path assert test_path in str(entry) assert test_title in str(entry) item = entry.get_item() assert item.title == test_title assert item.path == test_path assert test_path in str(item) assert test_title in str(item) assert item.mimetype == test_mimetype assert item.size == test_size assert isinstance(item.content, memoryview) assert test_content_includes in bytes(item.content).decode("UTF-8") with pytest.raises(KeyError): zim.get_entry_by_title("___missing") # example.zim cannot be queried by title as all its entries have been created # with empty titles but the ZIM contains a v1 title listing. if test_title and filename != "example.zim": assert zim.has_entry_by_title(test_title) assert zim.get_entry_by_title(test_title).path == entry.path @skip_if_offline @pytest.mark.parametrize( *parametrize_for(["filename", "test_redirect", "test_redirect_to"]) ) def test_reader_redirect(all_zims, filename, test_redirect, test_redirect_to): zim = Archive(all_zims / filename) if test_redirect: assert zim.get_entry_by_path(test_redirect).is_redirect if test_redirect_to: target_entry = zim.get_entry_by_path(test_redirect) assert target_entry.get_redirect_entry().path == test_redirect_to # make sure get_item resolves it assert target_entry.get_item().path == test_redirect_to # should be last redirect assert target_entry.get_redirect_entry().is_redirect is False with pytest.raises(RuntimeError): target_entry.get_redirect_entry().get_redirect_entry() @skip_if_offline @pytest.mark.parametrize(*parametrize_for(["filename"])) def test_reader_by_id(all_zims, filename): zim = Archive(all_zims / filename) # test index access for index in range(0, zim.entry_count - 1): assert zim._get_entry_by_id(index)._index == index assert zim._get_entry_by_id(index).get_item()._index >= 0 @skip_if_offline def test_archive_equality(all_zims): class Different: def __init__(self, filename): self.filename = filename class Sub(Archive): pass class Sub2(Archive): @property def filename(self): return 1 fpath1 = all_zims / "zimfile.zim" fpath2 = all_zims / "example.zim" zim = Archive(fpath1) assert zim != Archive(fpath2) assert zim == Archive(fpath1) assert zim != Different(fpath1) assert zim == Sub(fpath1) assert zim != Sub2(fpath1) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������././@PaxHeader��������������������������������������������������������������������������������������0000000�0000000�0000000�00000000026�00000000000�010213� x����������������������������������������������������������������������������������������������������ustar�00�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������22 mtime=1682955378.0 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������libzim-3.1.0/tests/test_libzim_version.py�����������������������������������������������������������0000644�0001751�0000173�00000001564�14423756162�020230� 0����������������������������������������������������������������������������������������������������ustar�00runner��������������������������docker�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������import re import sys from libzim.version import get_libzim_version, get_versions, print_versions def test_version_print_version_with_stdout(capsys): print_versions() print("", file=sys.stdout, flush=True) stdout, stderr = capsys.readouterr() assert len(stdout) != 0 def test_version_print_version_with_stderr(capsys): print_versions(sys.stderr) print("", file=sys.stderr, flush=True) stdout, stderr = capsys.readouterr() assert len(stderr) != 0 def test_get_versions(): versions = get_versions() assert versions assert "libzim" in versions assert len(versions.keys()) > 1 for library, version in versions.items(): assert isinstance(library, str) assert isinstance(version, str) def test_get_libzim_version(): # libzim uses semantic versioning assert re.match(r"\d+\.\d+\.\d+", get_libzim_version()) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������