pax_global_header00006660000000000000000000000064143007035060014510gustar00rootroot0000000000000052 comment=9c79fc155af108b7b859a048021546f4369e50a5 ExportSageNB-3.4/000077500000000000000000000000001430070350600136575ustar00rootroot00000000000000ExportSageNB-3.4/.gitignore000066400000000000000000000001131430070350600156420ustar00rootroot00000000000000*~ *.pyc .\#* \#*\# /.tox MANIFEST /build/ /dist/ /sagenb_export.egg-info/ExportSageNB-3.4/.travis.yml000066400000000000000000000001711430070350600157670ustar00rootroot00000000000000sudo: false language: python python: - 2.7 - 3.5 - 3.6 - 3.7 - 3.8 install: pip install tox-travis script: tox ExportSageNB-3.4/LICENSE000066400000000000000000001044611430070350600146720ustar00rootroot00000000000000GNU 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. {one line to give the program's name and a brief idea of what it does.} Copyright (C) {year} {name of author} 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: {project} Copyright (C) {year} {fullname} 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 . ExportSageNB-3.4/MANIFEST.in000066400000000000000000000002741430070350600154200ustar00rootroot00000000000000exclude .* include README* LICENSE* recursive-include sagenb_export *.py *.css *.html *.js *.svg recursive-exclude sagenb_export /#*.py .\#*.py *~ recursive-exclude test * exclude tox.ini ExportSageNB-3.4/Makefile000066400000000000000000000002301430070350600153120ustar00rootroot00000000000000 tox: tox watch-%: while true ; do \ $(MAKE) $* ; \ inotifywait -e close_write -r . --exclude '.*~' --exclude '#.*' ; \ done .PHONY: tox ExportSageNB-3.4/README.md000066400000000000000000000032371430070350600151430ustar00rootroot00000000000000Convert SageNB Notebooks ======================== This is a tool to convert SageNB notebooks to other formats, in particular IPython/Jupyter notebooks. Install ------- pip install git+https://github.com/vbraun/ExportSageNB.git or sage -pip install git+https://github.com/vbraun/ExportSageNB.git Usage ----- First, you want to list the existing notebooks. Each notebook has a unique id and a not necessarily unique name: $ sagenb-export --list Unique ID | Notebook Name ------------------------------------------------------------------------------- admin:10 | Oxford Seminar (1,1)-Calabi Yau You can specify notebooks by the ID or by name; If the name is not unique, the first notebook found in the filesystem wins. To convert it to a Jupyter/IPython notebook, use the `--ipynb` switch as in $ sagenb-export --ipynb=Output.ipynb admin:10 You can then open the saved `Output.ipynb` via $ sage --notebook=jupyter Output.ipynb Notes ----- * Various output formats are not supported, e.g. no pictures. The simplest solution is to re-evaluate. * SageNB html input cells are converted to Jupyter raw NBConvert cells; In the interactive Jupyter notebook these are not rendered as html but shown as their html source code. If you export to HTML (File -> Download as -> HTML) they are rendered as html, though. Testing and Python Compatibility -------------------------------- * The git-trac command supports Python 2.7, and 3.4+. * Most recent [Travis CI](https://travis-ci.org/vbraun/ExportSageNB) test: [![Build Status](https://travis-ci.org/vbraun/ExportSageNB.svg?branch=master)](https://travis-ci.org/vbraun/ExportSageNB) ExportSageNB-3.4/sagenb_export/000077500000000000000000000000001430070350600165175ustar00rootroot00000000000000ExportSageNB-3.4/sagenb_export/__init__.py000066400000000000000000000000001430070350600206160ustar00rootroot00000000000000ExportSageNB-3.4/sagenb_export/actions.py000066400000000000000000000014341430070350600205330ustar00rootroot00000000000000 import sys from sagenb_export.logger import log from sagenb_export.sagenb_reader import NotebookSageNB def action_list(dot_sage): def tr(unique_id, name): print(u'{0:<15} | {1}'.format(unique_id, name)) tr('Unique ID', 'Notebook Name') print('-' * 79) notebooks = dict( (notebook.sort_key, notebook) for notebook in NotebookSageNB.all_iter(dot_sage) ) for key in sorted(notebooks.keys()): notebook = notebooks[key] tr(notebook.unique_id, notebook.name) def action_print(sagenb): from sagenb_export.text_writer import TextWriter TextWriter(sagenb).write(sys.stdout) def action_convert_ipynb(sagenb, ipynb_filename): from sagenb_export.ipynb_writer import IpynbWriter IpynbWriter(sagenb).write(ipynb_filename) ExportSageNB-3.4/sagenb_export/cmdline.py000066400000000000000000000037161430070350600205130ustar00rootroot00000000000000## -*- encoding: utf-8 -*- """ Handle Command Line Options """ import os import sys import argparse from sagenb_export.defaults import DOT_SAGE from sagenb_export.logger import log from sagenb_export.sagenb_reader import NotebookSageNB from sagenb_export.actions import action_list, action_print, action_convert_ipynb description = \ """ Export SageNB notebooks """ def make_parser(): parser = argparse.ArgumentParser(description=description) parser.add_argument('--log', dest='log', default=None, help='one of [DEBUG, INFO, ERROR, WARNING, CRITICAL]') parser.add_argument('--dot-sage', dest='dot_sage', default=DOT_SAGE, help='location of the .sage directory') parser.add_argument('--list', dest='list', action='store_true', help='list all SageNB notebooks') parser.add_argument('--ipynb', dest='ipynb', default=None, help='output .ipynb notebook filename') parser.add_argument('--print', dest='print_text', action='store_true', help='print notebook') parser.add_argument('sagenb', default=None, nargs='?', help='SageNB notebook name or unique id') return parser def main(): parser = make_parser() args = parser.parse_args() if args.log is not None: import logging level = getattr(logging, args.log) log.setLevel(level=level) dot_sage = os.path.expanduser(args.dot_sage) if args.list: action_list(dot_sage) if not args.sagenb: sys.exit(0) sagenb = NotebookSageNB.find(dot_sage, args.sagenb) if args.print_text: action_print(sagenb) if args.ipynb: ipynb_name = args.ipynb.format(nb=sagenb) if os.path.exists(ipynb_name): raise RuntimeError('file exists: {0}'.format(ipynb_name)) action_convert_ipynb(sagenb, ipynb_name) if __name__ == '__main__': main() ExportSageNB-3.4/sagenb_export/defaults.py000066400000000000000000000001111430070350600206710ustar00rootroot00000000000000## -*- encoding: utf-8 -*- """ Default Values """ DOT_SAGE = '~/.sage' ExportSageNB-3.4/sagenb_export/ipynb_writer.py000066400000000000000000000032411430070350600216060ustar00rootroot00000000000000 from nbformat import write from nbformat.v4 import ( new_code_cell, new_markdown_cell, new_notebook, new_output ) from nbformat.v4.nbbase import new_raw_cell from sagenb_export.logger import log from sagenb_export.sagenb_reader import TextCell, ComputeCell class IpynbWriter(object): def __init__(self, sagenb): self.nb = sagenb @property def cells(self): for cell in self.nb.cells: if isinstance(cell, TextCell): yield new_markdown_cell( source=cell.input, ) elif isinstance(cell, ComputeCell): # SageNB's counting starts at 0 but IPython starts at 1 count = cell.index + 1 yield new_code_cell( source=cell.ipython_input(), execution_count=count, outputs=[ new_output( output_type=u'execute_result', data={ 'text/plain': cell.plain_text_output(), }, execution_count=count, ) ] ) else: log.critical('unknown cell: {0}'.format(cell)) def write(self, filename): ipynb = new_notebook( cells=list(self.cells), metadata=dict( kernelspec=dict( display_name="SageMath", name="sagemath", ), language='python', ) ) write(ipynb, filename) ExportSageNB-3.4/sagenb_export/logger.py000066400000000000000000000001201430070350600203410ustar00rootroot00000000000000 import logging logging.basicConfig() log = logging.getLogger('sagenb-export') ExportSageNB-3.4/sagenb_export/nbextension/000077500000000000000000000000001430070350600210535ustar00rootroot00000000000000ExportSageNB-3.4/sagenb_export/nbextension/__init__.py000066400000000000000000000017131430070350600231660ustar00rootroot00000000000000from notebook.utils import url_path_join from sagenb_export.nbextension.list_handler import ListSageNBHandler from sagenb_export.nbextension.export_handler import ExportSageNBHandler from sagenb_export.nbextension.asset_handler import AssetHandler from sagenb_export.nbextension.start_sagenb_handler import StartSageNBHandler def load_jupyter_server_extension(nb_server_app): """ Called when the extension is loaded. Args: nb_server_app (NotebookWebApplication): handle to the Notebook webserver instance. """ web_app = nb_server_app.web_app host_pattern = '.*$' def url(path): return url_path_join(web_app.settings['base_url'], path) web_app.add_handlers( host_pattern, [ (url(r'/sagenb'), ListSageNBHandler), (url(r'/sagenb/export'), ExportSageNBHandler), (url(r'/sagenb/start'), StartSageNBHandler), (url(r'/sagenb/www/(.*)'), AssetHandler), ] ) ExportSageNB-3.4/sagenb_export/nbextension/asset_handler.py000066400000000000000000000005201430070350600242360ustar00rootroot00000000000000 import os from tornado.web import StaticFileHandler from notebook.base.handlers import FileFindHandler class AssetHandler(FileFindHandler): def initialize(self, **kwds): kwds['path'] = [ os.path.join(os.path.dirname(__file__), 'www'), ] super(AssetHandler, self).initialize(**kwds) ExportSageNB-3.4/sagenb_export/nbextension/export_handler.py000066400000000000000000000032441430070350600244460ustar00rootroot00000000000000import os import string from itertools import count from tornado.web import authenticated from notebook.base.handlers import IPythonHandler from sagenb_export.defaults import DOT_SAGE from sagenb_export.logger import log from sagenb_export.sagenb_reader import NotebookSageNB from sagenb_export.ipynb_writer import IpynbWriter def filename_escape(name): def escape(ch): if ch in string.ascii_letters + string.digits: return ch else: return '_' return ''.join(map(escape, name)) class ExportSageNBHandler(IPythonHandler): """ Return a web page that lists the current SageNB worksheets """ @property def dot_sage(self): return os.path.expanduser(DOT_SAGE) @authenticated def post(self): print('POST', self.request, self.request.body) ipynb_filename = self.safe_filename() IpynbWriter(self.notebook()).write(ipynb_filename) relative_url = '/notebooks/' + ipynb_filename self.finish(relative_url) @property def unique_id(self): return self.request.body def notebook(self): try: nb = self._notebook except AttributeError: nb = self._notebook = NotebookSageNB.find(self.dot_sage, self.unique_id) return nb def safe_filename(self): basename = filename_escape(self.notebook().name) filename = '{0}.ipynb'.format(basename) if not os.path.exists(filename): return filename for i in count(2): filename = '{0} ({1}).ipynb'.format(basename, i) if not os.path.exists(filename): return filename ExportSageNB-3.4/sagenb_export/nbextension/jinja2_env.py000066400000000000000000000003751430070350600234570ustar00rootroot00000000000000# -*- coding: utf-8 -*- """ Jinja2 Environment for Embedded Pages """ import os from jinja2 import Environment, FileSystemLoader jinja2_env = Environment( loader=FileSystemLoader([ os.path.dirname(__file__) ]), autoescape=True, ) ExportSageNB-3.4/sagenb_export/nbextension/list_handler.html000066400000000000000000000044041430070350600244130ustar00rootroot00000000000000 SageMath

Sage Mathematics Software

Use the Jupyter notebook.

Take me to the Jupyter notebook

To skip this page and go directly to the Jupyter notebook, run sage --notebook=jupyter on the command line.

The old notebook is now deprecated.

Starting from version 9.0, Sage is using Python3 by default. The old Sage notebook only works for Sage using Python2 and is now deprecated. The old Sage notebook is still available as an optional package, working only under Python2. You need to install it using sage -i sagenb.

Run the old Sage Notebook

To skip this page and launch directly the old notebook, run sage --notebook=sagenb on the command line.

Convert old notebooks to Jupyter

Click on any of the notebooks below to convert it to a new Jupyter notebook and open it in Jupyter:

ID
Name
{% for nb in notebooks %}
{{ nb.unique_id }}
{{ nb.name }}
{% endfor %}
ExportSageNB-3.4/sagenb_export/nbextension/list_handler.py000066400000000000000000000021571430070350600241020ustar00rootroot00000000000000import os from tornado.web import authenticated from notebook.base.handlers import IPythonHandler from sagenb_export.defaults import DOT_SAGE from sagenb_export.logger import log from sagenb_export.sagenb_reader import NotebookSageNB from sagenb_export.nbextension.jinja2_env import jinja2_env class ListSageNBHandler(IPythonHandler): """ Return a web page that lists the current SageNB worksheets """ def notebook_iter(self): dot_sage = os.path.expanduser(DOT_SAGE) notebooks = dict( (notebook.sort_key, notebook) for notebook in NotebookSageNB.all_iter(dot_sage) ) for key in sorted(notebooks.keys()): # Skip notebooks with owner _sage_ which come from live # documentation and are not real notebooks if key[0] == "_sage_": continue yield notebooks[key] @authenticated def get(self): template = jinja2_env.get_template('list_handler.html') html = template.render(dict( notebooks=tuple(self.notebook_iter()), )) self.finish(html) ExportSageNB-3.4/sagenb_export/nbextension/start_sagenb_handler.py000066400000000000000000000030771430070350600256050ustar00rootroot00000000000000import os import sys from subprocess import Popen from tornado.web import authenticated from notebook.base.handlers import IPythonHandler from sagenb_export.nbextension.jinja2_env import jinja2_env class StartSageNBHandler(IPythonHandler): """ Start the old Sage Notebook server and send its URL. """ @authenticated def get(self): self.set_header("Content-Type", "text/plain") try: url = self.sagenb_url() except Exception as E: self.set_status(500) self.finish(str(E)) else: self.finish(url) def sagenb_url(self): # Run SageNB in a separate process. We create a pipe through # which SageNB will communicate the URL. rfd, wfd = os.pipe() # SageNB will run the command below "$SAGE_BROWSER url" # The definition of SAGE_BROWSER below ensures that the url # (passed as $0) is written to the write end of the pipe and # that both ends of the pipe are then closed. env = dict(os.environ) env["BROWSER"] = "bash -c 'echo >&{1} $0; exec {0}<&- {1}>&-'".format(rfd, wfd) # Actually start the Sage notebook cmd = "from sagenb.notebook.notebook_object import notebook; notebook()" p = Popen([sys.executable, "-c", cmd], stdin=open(os.devnull), env=env) # Read URL through the pipe os.close(wfd) url = os.read(rfd, 1024).strip() os.close(rfd) if url: return url else: raise RuntimeError("The Sage Notebook failed to start :-(") ExportSageNB-3.4/sagenb_export/nbextension/www/000077500000000000000000000000001430070350600216775ustar00rootroot00000000000000ExportSageNB-3.4/sagenb_export/nbextension/www/run-sagenb.html000066400000000000000000000014351430070350600246310ustar00rootroot00000000000000 Starting Sage Notebook

Starting up old Sage Notebook

Please wait a few seconds...

Note that you can directly start the old Sage Notebook by running the command

sage --notebook=sagenb
ExportSageNB-3.4/sagenb_export/nbextension/www/sagemath_icon.svg000066400000000000000000000507611430070350600252320ustar00rootroot00000000000000 image/svg+xml ExportSageNB-3.4/sagenb_export/nbextension/www/sagenb-export.css000066400000000000000000000033711430070350600251730ustar00rootroot00000000000000* { box-sizing: border-box; } html { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; padding: 0; } body { margin: 0; padding: 0; } h1 { text-align: center; font-size: 48px; font-weight: normal; } p { margin: 0; padding: 0; } .header { display: flex; flex-direction: row; justify-content: space-around; align-items: center; height: 128px; } .header h1 { margin: auto; } .header img { margin: auto; height: 64px; width: 64px; } .warn { width: 60%; margin: auto; border: 2px solid #ff7f7f; background: #ffdddd; border-radius: 10px; padding: 1em 3em; } .button { border: 2px solid #8080ff; background: #ddddff; padding: 0.5em; margin: 0.3em; display: inline-block; } .error { background-color: #7f0000; color: #ccffcc; padding: 0 2em; } .old { padding: 0 3em; margin-top: 2em; margin-bottom: 2em; } .old tt { font-size: 130%; } .old pre { font-size: 130%; text-align: center; } .ellipsis { width: 100%; display: inline-block; overflow: hidden; text-overflow: ellipsis; } .nb-row.nb-header { font-weight: bold; text-align: center; background-color: #7f7f7f !important; color: #ffffff; } .nb-row { display: flex; flex-direction: row; line-height: 48px; white-space: nowrap; } .nb-row:nth-child(even) { background: #FFF; } .nb-row:nth-child(odd) { background: #eee; } .nb-row.clickable:hover { background: #aaaaff; cursor: pointer; } .nb-id { padding: 0 1em 0 2em; display: flex; flex: 1 0 0; font-family: "Lucida Console", Monaco, monospace; } .nb-name { padding: 0 2em 0 1em; display: flex; flex: 8 1 0; } ExportSageNB-3.4/sagenb_export/nbextension/www/sagenb-export.js000066400000000000000000000014101430070350600250070ustar00rootroot00000000000000'use strict'; function getCookie(name) { var r = document.cookie.match("\\b" + name + "=([^;]*)\\b"); return r ? r[1] : undefined; } var exportSageNB = function(uniqueId) { console.log('Converting ' + uniqueId); var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (xhttp.readyState == 4 && xhttp.status == 200) { var url = 'http://' + document.location.host + xhttp.responseText; var win = window.open(url, '_blank'); win.focus(); } else { document.querySelector('.error').innerText = xhttp.responseText; } }; xhttp.open('POST', '/sagenb/export', false); xhttp.setRequestHeader('X-Xsrftoken', getCookie("_xsrf")); xhttp.send(uniqueId); }; ExportSageNB-3.4/sagenb_export/nbextension/www/start-sagenb.js000066400000000000000000000007051430070350600246310ustar00rootroot00000000000000'use strict'; var startSageNB = function() { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (xhttp.readyState == 4 && xhttp.status == 200) { var url = xhttp.responseText; window.location.replace(url); } else { document.querySelector('.error').innerText = xhttp.responseText; } }; xhttp.open('GET', '/sagenb/start', false); xhttp.send(); }; ExportSageNB-3.4/sagenb_export/sagenb_reader.py000066400000000000000000000152411430070350600216550ustar00rootroot00000000000000 import os import re try: # Python 2 import cPickle as pickle except ImportError: # Python 3 import pickle from sagenb_export.logger import log from sagenb_export.unescape import unescape CELL_FRONT = re.compile(u'^\{\{\{id=(?P[0-9]*)\|$') CELL_MID = re.compile(u'^///$') CELL_BACK = re.compile(u'^\}\}\}$') class Cell(object): def __init__(self, input): self.input = input def __repr__(self): return '{0}:"{1}"'.format(type(self), self.input.encode('utf-8', 'replace')) class ComputeCell(Cell): def __init__(self, index, input, output): assert index >= 0 super(ComputeCell, self).__init__(input) self.index = index self.output = output def ipython_input(self): """ Convert SageNB input to IPython input. This converts % to %% cell magics and removes some cell magics which have no meaning in IPython. """ # SageNB allows multiple % lines, but IPython doesn't. Still, # in order to preserve as much as possible the meaning of the # input, we convert all magics. # Some magics like %hide which have no meaning in IPython are # simply removed. lines = iter(self.input.splitlines(True)) res = "" for line in lines: if not line.startswith('%'): res += line break line = line.strip() if line in ['%auto', '%hide', '%hideall', '%save_server']: # Remove this directive pass else: res += "%" + line + "\n" for line in lines: res += line return res def plain_text_output(self): """ Return the cell output without ... blocks. The Sage notebook has a peculiar feature where everything in the output which is wrapped in ... is rendered as HTML. This is for example used for interacts. These HTML blocks are most likely meaningless for IPython. """ # Code below based on the parse_html() function from # sagenb/notebook/cell.py s = self.output t = '' while len(s) > 0: i = s.find('') if i == -1: t += s break j = s.find('') if j == -1: t += s[:i] break t += s[:i] s = s[j + 7:] t = t.replace('', '') return t class TextCell(Cell): pass class WorksheetParser(object): def __init__(self, worksheet_html): self.worksheet_lines = worksheet_html.splitlines() self.pos = 0 self.index = -1 log.debug('Worksheet has %s lines', len(self.worksheet_lines)) @property def line(self): return self.worksheet_lines[self.pos] def get_line_and_forward(self): line = self.line self.pos += 1 return line @property def is_finished(self): return self.pos >= len(self.worksheet_lines) @property def is_cell_front(self): match = CELL_FRONT.match(self.line) if match: self.index = int(match.group('index')) return True else: return False @property def is_cell_mid(self): match = CELL_MID.match(self.line) return match != None @property def is_cell_back(self): match = CELL_BACK.match(self.line) return match != None def _try_read_text(self): accumulator = [] while not (self.is_cell_front or self.is_finished): log.debug('Read text: %s', self.line) accumulator.append(self.get_line_and_forward()) accumulator = u'\n'.join(accumulator).strip() if accumulator: return TextCell(unescape(accumulator)) def _read_cell_input(self): assert self.is_cell_front self.pos += 1 accumulator = [] while not (self.is_cell_mid or self.is_finished): log.debug('Read cell input: %s', self.line) accumulator.append(self.get_line_and_forward()) return unescape(u'\n'.join(accumulator).strip()) def _read_cell_output(self): assert self.is_cell_mid self.pos += 1 accumulator = [] while not (self.is_cell_back or self.is_finished): log.debug('Read cell output: %s', self.line) accumulator.append(self.get_line_and_forward()) return unescape(u'\n'.join(accumulator).strip()) def _read_cell(self): input = self._read_cell_input() output = self._read_cell_output() return ComputeCell(self.index, input, output) def __iter__(self): while not self.is_finished: text = self._try_read_text() if text: yield text yield self._read_cell() if not self.is_finished: assert self.is_cell_back self.pos += 1 class NotebookSageNB(object): def __init__(self, path): log.debug('opening notebook root directory: %s', path) self.path = path with open(os.path.join(path, 'worksheet.html'), 'rb') as f: self.ws = f.read().decode('utf-8') with open(os.path.join(path, 'worksheet_conf.pickle'), 'rb') as f: self.conf = pickle.load(f) def __repr__(self): return '{0}:"{1}"'.format(self.unique_id, self.name.encode('utf-8', 'replace')) @classmethod def all_iter(cls, dot_sage): store = os.path.join(dot_sage, 'sage_notebook.sagenb', 'home', '__store__') for path, dirs, files in os.walk(store): worksheet = os.path.join(path, 'worksheet.html') if os.path.isfile(worksheet): yield cls(path) @classmethod def find(cls, dot_sage, name_or_unique_id): for notebook in cls.all_iter(dot_sage): if notebook.unique_id == name_or_unique_id: return notebook if notebook.name == name_or_unique_id: return notebook raise ValueError('no such notebook: {0}'.format(name_or_unique_id)) @property def sort_key(self): return (self.conf['owner'], self.conf['id_number']) def __lt__(lhs, rhs): return lhs.sort_key < rhs.sort_key @property def unique_id(self): return '{0}:{1}'.format(self.conf['owner'], self.conf['id_number']) @property def name(self): return self.conf['name'] @property def cells(self): for cell in WorksheetParser(self.ws): log.debug('Cell: %s', cell) yield cell ExportSageNB-3.4/sagenb_export/text_writer.py000066400000000000000000000016211430070350600214510ustar00rootroot00000000000000 from sagenb_export.logger import log from sagenb_export.sagenb_reader import TextCell, ComputeCell HEADER = u""" Name: {nb.name} """ TEXT_CELL = u""" Text: {cell.input} """ COMPUTE_CELL = u""" In[{cell.index}]: {cell.input} Out[{cell.index}]: {cell.output} """ class TextWriter(object): def __init__(self, sagenb): self.nb = sagenb @property def header(self): return HEADER.format(nb=self.nb) @property def cells(self): for cell in self.nb.cells: if isinstance(cell, TextCell): yield TEXT_CELL.format(cell=cell) elif isinstance(cell, ComputeCell): yield COMPUTE_CELL.format(cell=cell) else: log.critical('unknown cell: {0}'.format(cell)) def write(self, stream): stream.write(self.header) for cell in self.cells: stream.write(cell) ExportSageNB-3.4/sagenb_export/unescape.py000066400000000000000000000002341430070350600206730ustar00rootroot00000000000000 try: # python 3 from html import unescape except ImportError: # python 2 import HTMLParser unescape = HTMLParser.HTMLParser().unescape ExportSageNB-3.4/setup.py000077500000000000000000000010721430070350600153740ustar00rootroot00000000000000#!/usr/bin/env python from setuptools import setup, find_packages setup( name='sagenb_export', description='Export Notebooks from SageNB', author='Volker Braun', author_email='vbraun.name@gmail.com', install_requires=[ 'ipython>=4', 'nbconvert>=4', 'notebook', ], packages=find_packages(), include_package_data=True, entry_points={ 'console_scripts': [ 'sagenb-export = sagenb_export.cmdline:main', ], }, version='3.3', url='https://github.com/vbraun/ExportSageNB', ) ExportSageNB-3.4/test/000077500000000000000000000000001430070350600146365ustar00rootroot00000000000000ExportSageNB-3.4/test/__init__.py000066400000000000000000000000001430070350600167350ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/000077500000000000000000000000001430070350600164235ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/000077500000000000000000000000001430070350600225005ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/000077500000000000000000000000001430070350600234305ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/000077500000000000000000000000001430070350600253605ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/000077500000000000000000000000001430070350600255215ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/000077500000000000000000000000001430070350600257435ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/000077500000000000000000000000001430070350600262475ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/000077500000000000000000000000001430070350600266365ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/000077500000000000000000000000001430070350600277265ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/10/000077500000000000000000000000001430070350600301465ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/10/cells/000077500000000000000000000000001430070350600312505ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/10/cells/1/000077500000000000000000000000001430070350600314105ustar00rootroot00000000000000sage0-size500-249051951.jmol.zip000077500000000000000000000045061430070350600362220ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/10/cells/1PKRN>g9L GSCRIPT\KoFW,PE= AtkT YI@{qcR3)q`1|s^oO6Jnڻ_Jф[wE/}9ߛ;>] uO?z/:l۫|ww8o<ڛuݻv=nxx{ ?o7ͷnAtV4z8D[6W=~uwS+7wBI|Eu!^ś6Gp?Io~G?>V[1(=?gZZ}.*of(_$ҝvɇxUHgQwjN4ru1##q4Pr޳# zbE5) EdnRu 7 5duλlqiKN3j@ˀb!;)ų Fj Ñ o 9/x 8EB8N/ )4Y7EamG-pX~SQjf+ %|~:s~"Ȭ}&)I6A3L3QOuĘT66ti(*{mJ5W/L$E,4:Bjl"p&dck+}a??% %ՐzSrX5*V\.]B|$j9#|_\ƃه%ds_tXP1fYDh6yiN#,1 G, ;6S\h.9[h2cC]G6Xv:'F-QlqguCJR2Ne fH `q0*HRyGR ^FʄO`@eLwd)\_ t9p|OX,8CjO8l捅55N39vnF%e9^P|#}3w>!7qm\^[5Ia!cd&e]JhqfѐmR*a(!JЀ8㥵7YSQa]laTJ5^Ljp 5(Y|jc ќE50"u`5Yk$0#.3 =U6gڀ[P Ӳ *}Y̥To(5.d(`:Et8 P-‹h4V}Բ "_x}ͺ"Y/XPU9 NSB;[uW=Y" LR r!I']3tFkĭ{Dl0Vi 1QaQTZBMX `:ALXHP{dr[xZeR@%.b1w[t*Q!TdM/x* &DOX yLx cgz處s}&kXaP)tNΝ0`@Qy[g92-_rRqiո@ӯ|`= R;KaPM(X!{̹ʊQ( {AM)ev)pB@K81'y[˟y#1Ek|֌08 Gx:Q[~) )? 1@ ɫw:/9DTQgiLƲ dNx}zFq.N )qX_pKԅ;9)`D5} |j cbN}z:Dyp<^ zX9D!4j0R@sH E''m m>e;l+e2j ?$^DVAnJFԋzTѢƙyTEg9L GSCRIPTPK4sage0-size500.jmol000077500000000000000000000001061430070350600344100ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/10/cells/1set defaultdirectory "sage0-size500-249051951.jmol.zip" script SCRIPT ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/10/cells/12/000077500000000000000000000000001430070350600314725ustar00rootroot00000000000000sage0-size500-900865605.jmol.zip000077500000000000000000000021731430070350600363050ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/10/cells/12PKM>sf&Gobj_983616.pmesh3232727V533B.8&$̐˄ DqPKM>ݣ{SCRIPTW[k0}fO1XCa-a+= J)NYN m%%EH,|}t2osoʥ,@n80} X ٶ3lt،fF@B'hϬhvhMv9;<`5׵\FrR*_պ(B粸Y{)[L酾Zou)d[n,320)%DD me}ق|ޔŮ_eH>Th%RfOr)|l@9q/2}?EY5bl]RG-}ûhY*=[yZ%C9,v7 #J-^ 0FiCoba~Jf.3 bG1G&^KU悀/?]} { PPCf"SRA?819oͶ]ʽGs0؇G683 /0u@߯1 !Kin~&0l@ nZ)E{$Mu,4rf%ѿfWs/Sۂޝ 8b52%g><܇g6>ṍ>|fxs'!:ll|(x6:qlpfTy4IX cAsfG4IXcZjv*i^InbCOӜMBzRqds 9atfjTQ( a-ɨN2q̀"E:Nf3G4IXeX`WMu yf"4 jw}i 9%s)Ǯj?PSӲm0E=38h`؃ D;,ҳ,,EeA(PKM>sf&Gobj_983616.pmeshPKM>ݣ{TSCRIPTPKrsage0-size500.jmol000077500000000000000000000001061430070350600344720ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/10/cells/12set defaultdirectory "sage0-size500-900865605.jmol.zip" script SCRIPT ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/10/snapshots/000077500000000000000000000000001430070350600321705ustar00rootroot000000000000001297626260.bz2000066400000000000000000000001441430070350600336170ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/10/snapshotsBZh91AY&SYg 6ۀa%ޮ HjSPdSeLx `z1 8`PYo#XSY@fGEܑN$ͯ1297626396.bz2000066400000000000000000000002421430070350600336300ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/10/snapshotsBZh91AY&SY#ۀ@@ Rh2 hiz4 ~Ɖ1(l'msH[mY\GX`JxJV7ڦdiM+ Cnۿ6D'p[]W.upH?rE8P#1297626546.bz2000066400000000000000000000004451430070350600336320ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/10/snapshotsBZh91AY&SYf]-߀D DP004zOzDdSz= M4MF T=@ U pɃfm^d՗.opz͐Iq+9GXuDz!=C2$jƒ'֕q+b)CqhXt$LWn[3VcbQuX4~n}*Ip$=(2#E`&4Fu%bB7AS.qB 6"(H3o1297637968.bz2000066400000000000000000000011331430070350600336370ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/10/snapshotsBZh91AY&SYܶ_A\,}@TѨ= 3Pj3H4a4zzPI&OQA1%='h412dф14& ͝6VGbjIĐUbgx`OF(ςmuG6S^lgf?0.fSXQ|hOARF)\> ,s35N!䞔fxy7%ŪENrD#^}PYqypJt{[~Lk" hY 3\*ȵm.oOzB ^oe DRYDdVƢB@YJ\ŜX_x<|26G:PH  1297637997.bz2000066400000000000000000000022521430070350600336440ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/10/snapshotsBZh91AY&SYw@߀A\/Pi.Vv5mЙ&BzOQ< hѦM= 51e=LBh@h5'3S4 =M4q&LFF!4i1 "Be&AG' hb 却 0cMr8R` VDj .㈋,L("s--%3 $2LCdG`nU{|VRcVnXokt f|}*AHaLx©r$>y/#J[ BZ(ʼc,Is:QȈ4diݦFHL$MʨY$O_9*EaXAi*(é.sw q vn\Khûkfu\:^ WXgv-7je鲔&TNۙض|7uwcY=)D)Oau9N T0brf,҅;ELEm˦S9sy7@ KXAbILE4Q5$H`W!py%MnT툭.*&V2.^fj.Q9.nLۇ#TfdDB{E-|*< $Җ{⇽JٙW_T~0fA%{5?w$ +U4R`NtMVJ.qKo*ʧW:!AʸCH)$e<}$DHDLI&}a9Bώ4ژuxQ4{3IpePw0dW ,#"$sFљXc_gz50t'ɰH` rΐfR` e: Jb;JcZʐj;Pnuziُ l9M Q6'&G3TAAc((9̵\;yZLuK bm0ݳl=mIB&li?ɫLO' .""޼E5lԦ &6A @஼ߏ32MIIThȆ,,1Ȃ"(ed O"5|޽dliKET8I2sUQDX[Өu*+-`V"7"m 2WOa<|UT?FQy <*|Q,adNUp+w\:.0N&vTSͪuvBv=ddt[p`W.">S7Ҙ&SU+GW!;"q7: >J,sw˷qʻOS.'iMJd{F]h-&\9!QQ25hǮDҽ4j\Sl9Pͭ)n2W=pqՒ=lȒiqX_D,fTtӎͳ?dFea 4էeS6 LTYWUKÈ*2'"X`15tB'O*^A{ĝ:d|&3:e825eh>Pt2 .;o_u5sqEWDkqmcxM*`jWؾ_-'w!.j5xN+| B:1=b&:sQF*"MSkA){K=qD4/HO_Z"RW*C^xȤf>|z6mļ]J}u=aAؘy+s_ڜBHJڥ%P?^U &liRaNM3LIAfsu®"ɰlG<34qi޾t(AѳUJ ̫u ݀j 6)mHBЮdN_W9 = 4hj!x3&=htIa.{ؠ50B!`I浠7adc8N0F) +.Nfq4oETz%ͻl6k2f-U!W@2ل@V͕ٲKҊ> 9H%S^ 2`D=?ګ Fzb?_?U!1 I;E(÷ $#'6[XGGϋ2쮒G_MXJWߡ}/ޕyk{ ;LbTȥ*޲FsAͬ`Bȩn,-B F`eVV^e)͒DG1鶒w{"i3HIB aWh"HhHrZhP6JՒ&}04$6A0]0zPϭ \,<)V<4j\o4:ؑP0'0$26&a;σ xA\YM[:A϶gpbsBѹ0SLL`$LLEC3!3E,Ba") fT&D)V "&h)*"bX$H9r K.P,@CwT!]B@(1297678871.bz2000066400000000000000000000063611430070350600336450ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/10/snapshotsBZh91AY&SY"E@\/o`h(@0l0%HD Sё=4#@L'z&=AbCAI 602442FCM12J$ hQAG#4dhb0ڠҙG4@ @E5 dSO 27=Mh2mGOQ=b,TOxu5LyC`E%HY߁衰|uExe%b{9+gF*#MG!g>7sUE I`<'K yhžvN%򦿫ٗƵm;_xiCs2L'^/AepxFwG\/fipgUMu{L˟fbZ-ӟOyש]fOO;)ì)a_[:)s[vI;fR9Xot# ՓX=)h@ҪkT15iܵIb0Œ!Иd\ $yhxy4Giꟕf(0 ]ݿry#1OQ$Gpgn:'9;?n*1C7|#2nDHPPw COrCI0XgQDyUU.Is:QȈ4diݦFHL$'MVg$q0B$ZE4HJp!ju|Iۺo(pkqJƛ;myT/M5⦰*tHx6ŵ6cỨűM %L{S2pJ 5$ag6)J-*g+n6]2;3ɽnnp& $`1DEbQ$C.\Cʉ[bʝREDRES'7ɛpYB[$jxڬOh%PݧDROrPU T\9x[34jy ,[^ =hHd̓ tuUMƠ4S:U+CFR_JK8/ HTPB oH$:`2ŋ#D(cIqG"ݝwA_f&6ƈod'AXŃYRߴgHD+WtnYDKh*,b\KmYc/~MM "ഘ0Ƿ0DLg&0]"02e@*XL2PDBM$0) y1 0 V *a-=`TAA3Um*xŵX[*4Vb)"M+ +Hp I98KџYyK/V]rE+ "Ts:B4r_;!r"q,L*DK,FZXKnl;Yof{qMw02rՎ;tic운-5+֠\T}X1LT2BM >q&Kh`E6BQܪyR[[,&aVEtDec^^QmD#Y:2RCO8nr*g>]muy\Gl pmS%ly:JE\/(G@:G"\e0E 1hLXij$yFeLf4C|9bJSeg;GW- #BQxR C-_[IleK3nh`ş8d=JUяKL*y*ہ; L -/Ee΃`1}ʉ:46 lb]ƍvUe2tz*+h^ȨfYsU:SD2I_BȮ6]$$k3 ar2N񋴚fV(,D\=ͨ‰)=r΁ iPנv1gXcf}jLq`n\iJpwf e/qwLߝaKB<@Աѿzi^$PsCh =xMisWP{)u!hw:n]vrmXd,soaZt#aؚ 8[AOύSBbyy86I,Taۼ8Bx 0zMŒYSRT7DC!H*_߯+ !,ؑ\ g;nVSM.TP&FV,KA"ٵnٻAe㜼0!NWQS*TL5j%y ila0 V\=.I1tɑK5=kC:dn&Wu LTƖd䭭}'cRJQUvo$N$|MAU~7mQ"T9e~'m\Bp ?DʂFTETH) =Ԟ:|D#2&J3!< -mc,DXbD" KI,V1 0d#`1,a`KE$c$AI(,dQDb2" 02V律nu/Q'̼P*cuҭ2z"(HDH1297680848.bz2000066400000000000000000000051651430070350600336430ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/10/snapshotsBZh91AY&SYQ1E@\/` aI1:j(yl&>NRlc.Y0zGEC"ZAJOפU叱ua"`=n$0^.av&#j4;KݨO# }u+Rb];yu]Y3­SYaI8x>r"+1iNܯSPJԤ^UjrM,QR]@iTHvs;h(¬%Ui5GEYCq{3cʁ4,S[ArQ( 1_D'mʈC_iQBIn=ԟuc Zu8|gʖ C rv..CReTc(WTه"Y@+ +-T!eaStə]C0&N2!>ٸ=ɼcp!tNJQC9Z]YV[Sf\S[F&" ##O{V|N4zҸ,b~gpZn>X|-AێA< J CT87h]Y\y56Xhyb:hcbmʟ+4x&U^LN ^̛1C9 <*\Ic5"DQEVNEOk9be2u2lbm̐>MxH#QhQAŗ} 5 Jv$,AТ=&lPS#hE`p~@072@#B0VMd$DHZXKmG\;s8](:d2$J(~:Az veO;ulNjWH,6X60yt:%^ 66D[dd Ebz.$k`ĎtAG=Qĵ˯İ>^vb 'gyE.fO:Z7Pp1BlXC*(PT/hgd.Ϛ,J[A)rS4 G0“.<@>T p_҄B 5[Y 8HeQ CBo::k}CD"_ >z3Ah[4jʈbf&3Ʀa dfRe(* )fNxL$E!0,ʓȑBSE*DM%RDLKIօBh!~޿WooG8}=T#D#"(HO礼worksheet.html000066400000000000000000000235001430070350600327700ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/10

The 24-Cell

{{{id=4| cell24 = polytopes.twenty_four_cell() cell24.f_vector() # it is self-dual /// (1, 24, 96, 96, 24, 1) }}} {{{id=86| cell24.f_vector? ///

File: /home/vbraun/Sage/sage/local/lib/python2.6/site-packages/sage/geometry/polyhedra.py

Type: <type ‘instancemethod’>

Definition: cell24.f_vector()

Docstring:

Return the f-vector.

OUTPUT:

Returns a vector whose i-th entry is the number of i-dimensional faces of the polytope.

EXAMPLES:

sage: p = Polyhedron(vertices = [[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1], [0, 0, 0]])
sage: p.f_vector()
(1, 7, 12, 7, 1)
}}}

Here is a picture of the 24-cell projected into 3 dimensions:

{{{id=1| cell24.plot() /// }}}

The "round" 24-cell can be $GL(4,\mathbb{Q})$-squished into a lattice polytope:

{{{id=13| cell24 = Polyhedron(vertices=[ (1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,0,1),(1,-1,-1,1),(0,0,-1,1), (0,-1,0,1),(-1,0,0,1),(1,0,0,-1),(0,1,0,-1),(0,0,1,-1),(-1,1,1,-1), (1,-1,-1,0),(0,0,-1,0),(0,-1,0,0),(-1,0,0,0),(1,-1,0,0),(1,0,-1,0), (0,1,1,-1),(-1,1,1,0),(-1,1,0,0),(-1,0,1,0),(0,-1,-1,1),(0,0,0,-1)]) cell24.f_vector() /// (1, 24, 96, 96, 24, 1) }}} {{{id=67| cell24.lattice_polytope().is_reflexive() /// True }}}

Symmetry groups

Here is the symmetry group of the 24-cell

{{{id=27| Aut = cell24.restricted_automorphism_group() Aut.cardinality() /// 1152 }}} {{{id=34| Aut.gens() /// [(3,9)(4,18)(7,13)(8,14)(10,20)(22,24), (2,3)(6,7)(10,11)(14,15)(17,18)(21,22), (2,4)(3,19)(5,18)(7,10)(8,21)(9,17)(12,22)(14,23)(15,24), (2,18)(3,17)(4,5)(8,23)(9,19)(12,24)(13,20)(14,21)(15,22), (2,19)(3,4)(5,17)(6,11)(8,22)(9,18)(12,21)(14,24)(15,23), (1,2,19,10,12,24,16,15,23,7,5,4)(3,18,20,9,21,11,14,22,13,8,17,6), (1,16)(2,21)(3,22)(4,8)(5,23)(9,24)(12,19)(14,18)(15,17)] }}}

Pick the following $G$-permutation action on the vertices of $\nabla$

{{{id=36| G = PermutationGroup([ '(1,14,22)(2,24,7)(3,18,16)(4,10,15)(5,21,11)(6,12,17)(8,19,13)(9,23,20)', '(1,10,16,7)(2,12,15,5)(3,9,14,8)(4,19,24,23)(6,20,11,13)(17,18,21,22)']) G.is_subgroup(Aut) and G.is_isomorphic( SL(2,3).as_matrix_group().as_permutation_group() ) /// True }}} {{{id=85| G.orbits() /// [[1, 10, 14, 16, 15, 8, 22, 7, 3, 5, 4, 19, 17, 2, 9, 18, 21, 24, 13, 6, 12, 23, 11, 20]] }}}

Representatives for the 7 conjugacy classes:

{{{id=44| G.conjugacy_classes_representatives() /// [(), (1,2,21,16,15,17)(3,19,10,14,23,7)(4,20,12,24,13,5)(6,8,22,11,9,18), (1,4,8,16,24,9)(2,6,23,15,11,19)(3,20,21,14,13,17)(5,7,22,12,10,18), (1,6,16,11)(2,14,15,3)(4,21,24,17)(5,8,12,9)(7,20,10,13)(18,23,22,19), (1,8,24)(2,23,11)(3,21,13)(4,16,9)(5,22,10)(6,15,19)(7,12,18)(14,17,20), (1,16)(2,15)(3,14)(4,24)(5,12)(6,11)(7,10)(8,9)(13,20)(17,21)(18,22)(19,23), (1,21,15)(2,16,17)(3,10,23)(4,12,13)(5,20,24)(6,22,9)(7,19,14)(8,11,18)] }}}

Here is the orbit of $1$ under the permutation $g_3$:

{{{id=52| (G.1).orbit(1) /// [1, 14, 22] }}}

The 24-cell toric variety

{{{id=45| fan = FaceFan(cell24.lattice_polytope()) Pnabla = ToricVariety(FaceFan(cell24.lattice_polytope()), coordinate_names='z1, z2, z3, z4, z5, z6, z7, z8, z9, z10, z11, z12, '+ 'z13, z14, z15, z16, z17, z18, z19, z20, z21, z22, z23, z24', base_field=GF(101)) Pnabla /// 4-d toric variety covered by 24 affine patches }}} {{{id=56| Pnabla.Chow_group().degree() /// (Z, Z, C2 x C2 x Z^30, Z^20, Z) }}} {{{id=54| SR = Pnabla.Stanley_Reisner_ideal(); SR /// Ideal (z2*z11, z4*z11, z5*z11, z6*z11, z8*z11, z11*z14, z11*z18, z11*z21, z11*z23, z1*z12, z4*z12, z5*z12, z6*z12, z7*z12, z12*z13, z12*z17, z12*z18, z12*z23, z1*z15, z2*z15, z4*z15, z6*z15, z10*z15, z15*z18, z15*z19, z15*z20, z15*z21, z1*z16, z2*z16, z3*z16, z4*z16, z5*z16, z9*z16, z16*z17, z16*z18, z16*z19, z1*z22, z2*z22, z5*z22, z6*z22, z9*z22, z10*z22, z13*z22, z14*z22, z18*z22, z1*z24, z2*z24, z3*z24, z4*z24, z5*z24, z6*z24, z7*z24, z8*z24, z20*z24, z3*z10, z4*z10, z5*z10, z7*z10, z8*z10, z10*z17, z10*z23, z1*z14, z3*z14, z4*z14, z7*z14, z14*z17, z14*z19, z14*z20, z1*z21, z3*z21, z5*z21, z7*z21, z9*z21, z13*z21, z17*z21, z4*z9, z6*z9, z7*z9, z8*z9, z9*z20, z9*z23, z5*z19, z6*z19, z7*z19, z8*z19, z13*z19, z19*z23, z2*z13, z3*z13, z4*z13, z8*z13, z13*z20, z1*z23, z2*z23, z3*z23, z20*z23, z2*z17, z6*z17, z8*z17, z17*z20, z3*z18, z7*z18, z8*z18, z18*z20, z3*z6, z2*z7, z1*z8, z5*z20, z7*z11*z16, z10*z11*z16, z11*z13*z16, z11*z16*z20, z3*z12*z15, z8*z12*z15, z9*z12*z15, z12*z14*z15, z17*z22*z24, z19*z22*z24, z21*z22*z24, z22*z23*z24, z6*z10*z16, z10*z13*z16, z10*z16*z20, z2*z12*z14, z8*z12*z14, z9*z12*z14, z18*z21*z24, z19*z21*z24, z21*z23*z24, z2*z9*z12, z3*z9*z12, z1*z10*z11, z10*z11*z13, z10*z11*z20, z17*z19*z24, z18*z19*z24, z6*z13*z16, z7*z13*z16, z5*z14*z15, z8*z14*z15, z9*z14*z15, z17*z23*z24, z18*z23*z24, z3*z9*z15, z5*z9*z15, z1*z11*z13, z7*z11*z13, z17*z18*z24, z2*z9*z14, z5*z9*z14, z1*z10*z13, z6*z10*z13, z2*z3*z8, z3*z5*z8, z3*z8*z12, z3*z8*z15, z4*z17*z22, z4*z19*z22, z4*z21*z22, z4*z22*z23, z1*z7*z20, z6*z7*z20, z7*z11*z20, z7*z16*z20, z2*z5*z8, z2*z8*z12, z2*z8*z14, z4*z18*z21, z4*z19*z21, z4*z21*z23, z1*z6*z20, z6*z10*z20, z6*z16*z20, z1*z10*z20, z1*z11*z20, z2*z3*z5, z2*z3*z9, z2*z3*z12, z4*z17*z19, z4*z18*z19, z4*z17*z23, z4*z18*z23, z5*z8*z14, z5*z8*z15, z1*z6*z7, z6*z7*z13, z6*z7*z16, z1*z7*z11, z1*z7*z13, z3*z5*z9, z3*z5*z15, z4*z17*z18, z1*z6*z10, z1*z6*z13, z2*z5*z9, z2*z5*z14, z19*z21*z22, z21*z22*z23, z17*z19*z22, z18*z19*z21, z17*z22*z23, z17*z18*z23, z18*z21*z23, z17*z18*z19) of Multivariate Polynomial Ring in z1, z2, z3, z4, z5, z6, z7, z8, z9, z10, z11, z12, z13, z14, z15, z16, z17, z18, z19, z20, z21, z22, z23, z24 over Rational Field }}} {{{id=55| Pnabla.inject_variables() z1*z16 in SR and z1*z14*z22 in SR /// Defining z1, z2, z3, z4, z5, z6, z7, z8, z9, z10, z11, z12, z13, z14, z15, z16, z17, z18, z19, z20, z21, z22, z23, z24 True }}}

The Calabi-Yau Hypersurface

The polynomial $P=P_0+P_\infty$ is

{{{id=57| anticanonical_bundle = -Pnabla.K() P = sum(anticanonical_bundle.sections_monomials()) P([1]*24) # g_3 and g_4^2-fixed point z_i=1 /// 25 }}}

One of the maximal cones is $\langle p_1,p_2,p_3,p_4,p_{19},p_{20}\rangle$:

{{{id=69| cone = fan.generating_cone(8) cone.ambient_ray_indices() /// (0, 1, 2, 3, 18, 19) }}}

The singularity of $\mathbb{P}_\nabla$ is where the corresponding homogeneous variables vanish:

{{{id=63| P(0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1) /// 1 }}}

Checking Transversality of the Equation

The patches are non-complete intersections: 9 equations in $\mathbb{C}^8$ cutting out a $4$-dimensional affine toric variety

{{{id=71| ambient_patch = Pnabla.affine_algebraic_patch(cone, names='x+') ambient_patch /// Closed subscheme of Affine Space of dimension 8 over Finite Field of size 101 defined by: -x1*x4 + x0*x7, -x1*x5 + x0*x6, -x4*x6 + x5*x7, x0*x4 - x3*x5, -x2*x4 + x3*x7, -x1*x4 + x3*x6, x0*x2 - x1*x3, x2*x6 - x1*x7, -x1*x4 + x2*x5 }}}

Of course there is a singularity at $0\in \mathbb{C}^8$:

{{{id=76| ambient_patch.is_smooth() /// False }}}

Now we throw in the equation $P=0$ and go to the same patch again:

{{{id=70| Xtilde = Pnabla.subscheme(P) patch = Xtilde.affine_algebraic_patch(cone, names='x+') patch /// Closed subscheme of Affine Space of dimension 8 over Finite Field of size 101 defined by: -x1*x4 + x0*x7, -x1*x5 + x0*x6, -x4*x6 + x5*x7, x0*x4 - x3*x5, -x2*x4 + x3*x7, -x1*x4 + x3*x6, x0*x2 - x1*x3, x2*x6 - x1*x7, -x1*x4 + x2*x5, x2^2*x5^2 + x0*x2*x5 + x2^2*x5 + x2*x3*x5 + x2*x4*x5 + x2*x5^2 + x0*x2*x6 + x2*x5*x6 + x2*x5*x7 + x0*x2 + x0*x4 + x2*x4 + x1*x5 + x2*x5 + x2*x6 + x5*x7 + x0 + x1 + x2 + x3 + x4 + x5 + x6 + x7 + 1 }}} {{{id=73| patch.is_smooth() /// True }}} {{{id=81| /// }}}worksheet_conf.pickle000066400000000000000000000007021430070350600342770ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/10(dp1 S'tags' p2 (dp3 S'admin' p4 (lp5 I0 asS'guest' p6 (lp7 I1 assS'id_number' p8 I10 sS'pretty_print' p9 I00 sS'system' p10 S'sage' p11 sS'published_id_number' p12 NsS'owner' p13 S'admin' p14 sS'viewers' p15 (lp16 sS'ratings' p17 (lp18 sS'collaborators' p19 (lp20 sS'name' p21 VOxford Seminar (1,1)-Calabi Yau p22 sS'auto_publish' p23 I00 sS'last_change' p24 (S'admin' p25 F1297684209.597744 tp26 sS'worksheet_that_was_published' p27 (g4 I10 tp28 s.ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/4/000077500000000000000000000000001430070350600300715ustar00rootroot00000000000000worksheet.html000066400000000000000000000014651430070350600327210ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/4

Równanie Newtona

$$\vec F= m\vec a$$ 

Rzut pionowy

$$F= m a$$ 

 

 Krok czasowy: $\Delta t$.

 

  • $  v = \displaystyle\frac{ \Delta  y}{\Delta t}$
  • $  a =  \displaystyle \frac{\Delta  v}{\Delta t}$
 

$$\begin{cases} \quad \displaystyle \frac{\Delta y}{\Delta t} &=& v \\ \quad \displaystyle \frac{\Delta v}{\Delta t} &=& \displaystyle \frac { F}{m} \end{cases} $$

 

 

 $\:y_0\:$  i $\:v_{0}\:$

$$\begin{cases}
\quad y &=&y_0\ +\ v_{0}\:\Delta t\\ 

\quad v &=&v_{0}\ +\  \frac{F}{m}\:\Delta t \end{cases}$$

{{{id=1| /// }}}worksheet_conf.pickle000066400000000000000000000007131430070350600342240ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/4(dp1 S'system' p2 S'sage' p3 sS'saved_by_info' p4 (dp5 sS'tags' p6 (dp7 S'admin' p8 (lp9 I1 assS'id_number' p10 I4 sS'pretty_print' p11 I00 sS'live_3D' p12 I00 sS'published_id_number' p13 NsS'owner' p14 S'admin' p15 sS'viewers' p16 (lp17 sS'ratings' p18 (lp19 sS'collaborators' p20 (lp21 sS'name' p22 VMathJax_problem1 p23 sS'auto_publish' p24 I00 sS'last_change' p25 (S'admin' p26 F1467286221.0016849 tp27 sS'worksheet_that_was_published' p28 (g15 I4 tp29 s.ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/5/000077500000000000000000000000001430070350600300725ustar00rootroot00000000000000worksheet.html000066400000000000000000000000001430070350600327020ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/5worksheet_conf.pickle000066400000000000000000000011141430070350600342210ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/5(dp1 S'system' p2 S'sage' p3 sS'saved_by_info' p4 (dp5 sS'tags' p6 (dp7 Vadmin p8 (lp9 I1 asValeksandra.slapik p10 (lp11 I1 asVmarcin.kostur p12 (lp13 I1 assS'id_number' p14 I44 sS'pretty_print' p15 I00 sS'live_3D' p16 I00 sS'published_id_number' p17 NsS'owner' p18 Valeksandra.slapik p19 sS'viewers' p20 (lp21 sS'ratings' p22 (lp23 sS'collaborators' p24 (lp25 sS'name' p26 VWDI projekt - R\u017cankowski, Kie\u0142pi\u0144ski, Kozok p27 sS'auto_publish' p28 I00 sS'last_change' p29 (S'aleksandra.slapik' p30 F1453628866.7567761 tp31 sS'worksheet_that_was_published' p32 (g10 I44 tp33 s.ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/6/000077500000000000000000000000001430070350600300735ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/6/cells/000077500000000000000000000000001430070350600311755ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/6/cells/1/000077500000000000000000000000001430070350600313355ustar00rootroot0000000000000049be01de15186385365f073df482ef2c1e784c08.paxheader00006660000000000000000000000325143007035060020305xustar00rootroot00000000000000213 path=ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/6/cells/1/__usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx.c 49be01de15186385365f073df482ef2c1e784c08.data000077500000000000000000004147351430070350600171640ustar00rootroot00000000000000/* Generated by Cython 0.25.2 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) #error Cython requires Python 2.6+ or Python 3.2+. #else #define CYTHON_ABI "0_25_2" #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef HAVE_LONG_LONG #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) #define HAVE_LONG_LONG #endif #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #undef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 0 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #undef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 1 #undef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 0 #undef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #elif defined(PYSTON_VERSION) #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif #ifndef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 1 #endif #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #if PY_MAJOR_VERSION < 3 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif #if PY_VERSION_HEX < 0x02070000 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #elif !defined(CYTHON_USE_PYLONG_INTERNALS) #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 1 #endif #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif #if PY_VERSION_HEX < 0x030300F0 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) #define CYTHON_USE_UNICODE_WRITER 1 #endif #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif #ifndef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 1 #endif #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 1 #endif #endif #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #undef SHIFT #undef BASE #undef MASK #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) #define Py_OptimizeFlag 0 #endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyType_Type #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 #endif #ifndef Py_TPFLAGS_HAVE_INDEX #define Py_TPFLAGS_HAVE_INDEX 0 #endif #ifndef Py_TPFLAGS_HAVE_NEWBUFFER #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif #ifndef METH_FASTCALL #define METH_FASTCALL 0x80 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames); #else #define __Pyx_PyCFunctionFast _PyCFunctionFast #endif #if CYTHON_FAST_PYCCALL #define __Pyx_PyFastCFunction_Check(func)\ ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))))) #else #define __Pyx_PyFastCFunction_Check(func) 0 #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) #else #define CYTHON_PEP393_ENABLED 0 #define PyUnicode_1BYTE_KIND 1 #define PyUnicode_2BYTE_KIND 2 #define PyUnicode_4BYTE_KIND 4 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) #else #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif #if CYTHON_COMPILING_IN_PYSTON #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) #else #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) #endif #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) #define PyObject_ASCII(o) PyObject_Repr(o) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) #else #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY #ifndef PyUnicode_InternFromString #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) #endif #endif #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #else #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) #else typedef struct { unaryfunc am_await; unaryfunc am_aiter; unaryfunc am_anext; } __Pyx_PyAsyncMethodsStruct; #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) #endif #else #define __Pyx_PyType_AsAsync(obj) NULL #endif #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict #else #define CYTHON_RESTRICT #endif #endif #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) #ifndef CYTHON_INLINE #if defined(__clang__) #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) #elif defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #ifdef NAN #define __PYX_NAN() ((float) NAN) #else static CYTHON_INLINE float __PYX_NAN() { float value; memset(&value, 0xFF, sizeof(value)); return value; } #endif #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) #define __Pyx_truncl trunc #else #define __Pyx_truncl truncl #endif #define __PYX_ERR(f_index, lineno, Ln_error) \ { \ __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ } #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #define __PYX_HAVE___usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0 #define __PYX_HAVE_API___usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0 #include "struct_signals.h" #include "pxi.h" #include #include #include #include #include "gmp.h" #include #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_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_DEFAULT 0 #define __PYX_DEFAULT_STRING_ENCODING "" #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #define __Pyx_uchar_cast(c) ((unsigned char)c) #define __Pyx_long_cast(x) ((long)x) #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ (sizeof(type) < sizeof(Py_ssize_t)) ||\ (sizeof(type) > sizeof(Py_ssize_t) &&\ likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX) &&\ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ v == (type)PY_SSIZE_T_MIN))) ||\ (sizeof(type) == sizeof(Py_ssize_t) &&\ (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX))) ) #if defined (__cplusplus) && __cplusplus >= 201103L #include #define __Pyx_sst_abs(value) std::abs(value) #elif SIZEOF_INT >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) abs(value) #elif SIZEOF_LONG >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) labs(value) #elif defined (_MSC_VER) && defined (_M_X64) #define __Pyx_sst_abs(value) _abs64(value) #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define __Pyx_sst_abs(value) llabs(value) #elif defined (__GNUC__) #define __Pyx_sst_abs(value) __builtin_llabs(value) #else #define __Pyx_sst_abs(value) ((value<0) ? -value : value) #endif static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) #define __Pyx_PyBytes_FromString PyBytes_FromString #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #if PY_MAJOR_VERSION < 3 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #else #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif #define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) #if PY_MAJOR_VERSION < 3 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } #else #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen #endif #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys; PyObject* default_encoding = NULL; PyObject* ascii_chars_u = NULL; PyObject* ascii_chars_b = NULL; const char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); Py_DECREF(sys); if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; if (strcmp(default_encoding_c, "ascii") == 0) { __Pyx_sys_getdefaultencoding_not_ascii = 0; } else { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { ascii_chars[c] = c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); if (!ascii_chars_u) goto bad; ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { PyErr_Format( PyExc_ValueError, "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", default_encoding_c); goto bad; } Py_DECREF(ascii_chars_u); Py_DECREF(ascii_chars_b); } Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(default_encoding); Py_XDECREF(ascii_chars_u); Py_XDECREF(ascii_chars_b); return -1; } #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) #else #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT static char* __PYX_DEFAULT_STRING_ENCODING; static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys; PyObject* default_encoding = NULL; char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); Py_DECREF(sys); if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(default_encoding); return -1; } #endif #endif /* Test for GCC > 2.95 */ #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* !__GNUC__ or GCC < 2.95 */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_d; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static PyObject *__pyx_empty_unicode; static PyObject *__pyx_i; 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[] = { "memory.pxd", "stdsage.pxd", "_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0.pyx", "type.pxd", "signals.pxi", "stdsage.pxi", }; /*--- Type declarations ---*/ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #endif #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ } while (0) #define __Pyx_DECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_DECREF(tmp);\ } while (0) #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) /* PyObjectGetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_getattro)) return tp->tp_getattro(obj, attr_name); #if PY_MAJOR_VERSION < 3 if (likely(tp->tp_getattr)) return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); #endif return PyObject_GetAttr(obj, attr_name); } #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); /* PyObjectCall.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); #else #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif /* PyThreadStateGet.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; #define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign #endif /* PyErrFetchRestore.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /* CodeObjectCache.proto */ typedef struct { PyCodeObject* code_object; int code_line; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; }; static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* Print.proto */ static int __Pyx_Print(PyObject*, PyObject *, int); #if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3 static PyObject* __pyx_print = 0; static PyObject* __pyx_print_kwargs = 0; #endif /* PrintOne.proto */ static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); /* PyIdentifierFromString.proto */ #if !defined(__Pyx_PyIdentifier_FromString) #if PY_MAJOR_VERSION < 3 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) #else #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) #endif #endif /* ModuleImport.proto */ static PyObject *__Pyx_ImportModule(const char *name); /* TypeImport.proto */ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /* VoidPtrImport.proto */ static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'cysignals.__init__' */ /* Module declarations from 'cysignals' */ /* Module declarations from 'cysignals.signals' */ static cysigs_t *__pyx_vp_9cysignals_7signals_cysigs = 0; #define cysigs (*__pyx_vp_9cysignals_7signals_cysigs) static void (*__pyx_f_9cysignals_7signals_print_backtrace)(void); /*proto*/ static void (*__pyx_f_9cysignals_7signals__sig_on_interrupt_received)(void); /*proto*/ static void (*__pyx_f_9cysignals_7signals__sig_on_recover)(void); /*proto*/ static void (*__pyx_f_9cysignals_7signals__sig_off_warning)(char const *, int); /*proto*/ /* Module declarations from 'cython' */ /* Module declarations from 'libc.string' */ /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'cysignals.memory' */ static CYTHON_INLINE void *sig_malloc(size_t); /*proto*/ static CYTHON_INLINE void *sig_realloc(void *, size_t); /*proto*/ static CYTHON_INLINE void *sig_calloc(size_t, size_t); /*proto*/ static CYTHON_INLINE void sig_free(void *); /*proto*/ static CYTHON_INLINE size_t __pyx_f_9cysignals_6memory_mul_overflowcheck(size_t, size_t); /*proto*/ static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_allocarray(size_t, size_t); /*proto*/ static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_reallocarray(void *, size_t, size_t); /*proto*/ static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_malloc(size_t); /*proto*/ static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_realloc(void *, size_t); /*proto*/ static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_calloc(size_t, size_t); /*proto*/ /* 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 'sage.ext.stdsage' */ static CYTHON_INLINE PyObject *__pyx_f_4sage_3ext_7stdsage_PY_NEW(PyTypeObject *); /*proto*/ static CYTHON_INLINE int __pyx_f_4sage_3ext_7stdsage_HAS_DICTIONARY(PyObject *); /*proto*/ /* Module declarations from 'libc.math' */ /* Module declarations from 'sage.libs.gmp.types' */ /* Module declarations from 'sage.libs.gmp.random' */ /* Module declarations from 'libc.stdint' */ /* Module declarations from 'sage.libs.gmp.mpz' */ /* Module declarations from 'sage.libs.gmp.mpq' */ /* Module declarations from 'sage.libs.gmp.pylong' */ /* Module declarations from 'sage.libs.gmp.all' */ /* Module declarations from '_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0' */ static PyObject *__pyx_v_105_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0_x = 0; #define __Pyx_MODULE_NAME "_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0" int __pyx_module_is_main__usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0 = 0; /* Implementation of '_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0' */ static PyObject *__pyx_builtin_MemoryError; static const char __pyx_k_end[] = "end"; static const char __pyx_k_file[] = "file"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_print[] = "print"; static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_Hello_World[] = "Hello World"; static const char __pyx_k_MemoryError[] = "MemoryError"; static const char __pyx_k_sage_ext_memory[] = "sage.ext.memory"; static const char __pyx_k_init_memory_functions[] = "init_memory_functions"; static const char __pyx_k_failed_to_allocate_s_bytes[] = "failed to allocate %s bytes"; static const char __pyx_k_failed_to_allocate_s_s_bytes[] = "failed to allocate %s * %s bytes"; static const char __pyx_k_File__usr_local_src_sage_config[] = "File: _usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0.pyx (starting at line 2)"; static PyObject *__pyx_kp_s_Hello_World; static PyObject *__pyx_n_s_MemoryError; static PyObject *__pyx_n_s_end; static PyObject *__pyx_kp_s_failed_to_allocate_s_bytes; static PyObject *__pyx_kp_s_failed_to_allocate_s_s_bytes; static PyObject *__pyx_n_s_file; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_init_memory_functions; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_print; static PyObject *__pyx_n_s_sage_ext_memory; static PyObject *__pyx_n_s_test; /* "cysignals/memory.pxd":40 * * * cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil: # <<<<<<<<<<<<<< * sig_block() * cdef void* ret = malloc(n) */ static CYTHON_INLINE void *sig_malloc(size_t __pyx_v_n) { void *__pyx_v_ret; void *__pyx_r; /* "cysignals/memory.pxd":41 * * cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil: * sig_block() # <<<<<<<<<<<<<< * cdef void* ret = malloc(n) * sig_unblock() */ sig_block(); /* "cysignals/memory.pxd":42 * cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil: * sig_block() * cdef void* ret = malloc(n) # <<<<<<<<<<<<<< * sig_unblock() * return ret */ __pyx_v_ret = malloc(__pyx_v_n); /* "cysignals/memory.pxd":43 * sig_block() * cdef void* ret = malloc(n) * sig_unblock() # <<<<<<<<<<<<<< * return ret * */ sig_unblock(); /* "cysignals/memory.pxd":44 * cdef void* ret = malloc(n) * sig_unblock() * return ret # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_ret; goto __pyx_L0; /* "cysignals/memory.pxd":40 * * * cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil: # <<<<<<<<<<<<<< * sig_block() * cdef void* ret = malloc(n) */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "cysignals/memory.pxd":47 * * * cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil: # <<<<<<<<<<<<<< * sig_block() * cdef void* ret = realloc(ptr, size) */ static CYTHON_INLINE void *sig_realloc(void *__pyx_v_ptr, size_t __pyx_v_size) { void *__pyx_v_ret; void *__pyx_r; /* "cysignals/memory.pxd":48 * * cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil: * sig_block() # <<<<<<<<<<<<<< * cdef void* ret = realloc(ptr, size) * sig_unblock() */ sig_block(); /* "cysignals/memory.pxd":49 * cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil: * sig_block() * cdef void* ret = realloc(ptr, size) # <<<<<<<<<<<<<< * sig_unblock() * return ret */ __pyx_v_ret = realloc(__pyx_v_ptr, __pyx_v_size); /* "cysignals/memory.pxd":50 * sig_block() * cdef void* ret = realloc(ptr, size) * sig_unblock() # <<<<<<<<<<<<<< * return ret * */ sig_unblock(); /* "cysignals/memory.pxd":51 * cdef void* ret = realloc(ptr, size) * sig_unblock() * return ret # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_ret; goto __pyx_L0; /* "cysignals/memory.pxd":47 * * * cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil: # <<<<<<<<<<<<<< * sig_block() * cdef void* ret = realloc(ptr, size) */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "cysignals/memory.pxd":54 * * * cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil: # <<<<<<<<<<<<<< * sig_block() * cdef void* ret = calloc(nmemb, size) */ static CYTHON_INLINE void *sig_calloc(size_t __pyx_v_nmemb, size_t __pyx_v_size) { void *__pyx_v_ret; void *__pyx_r; /* "cysignals/memory.pxd":55 * * cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil: * sig_block() # <<<<<<<<<<<<<< * cdef void* ret = calloc(nmemb, size) * sig_unblock() */ sig_block(); /* "cysignals/memory.pxd":56 * cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil: * sig_block() * cdef void* ret = calloc(nmemb, size) # <<<<<<<<<<<<<< * sig_unblock() * return ret */ __pyx_v_ret = calloc(__pyx_v_nmemb, __pyx_v_size); /* "cysignals/memory.pxd":57 * sig_block() * cdef void* ret = calloc(nmemb, size) * sig_unblock() # <<<<<<<<<<<<<< * return ret * */ sig_unblock(); /* "cysignals/memory.pxd":58 * cdef void* ret = calloc(nmemb, size) * sig_unblock() * return ret # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_ret; goto __pyx_L0; /* "cysignals/memory.pxd":54 * * * cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil: # <<<<<<<<<<<<<< * sig_block() * cdef void* ret = calloc(nmemb, size) */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "cysignals/memory.pxd":61 * * * cdef inline void sig_free "sig_free"(void* ptr) nogil: # <<<<<<<<<<<<<< * sig_block() * free(ptr) */ static CYTHON_INLINE void sig_free(void *__pyx_v_ptr) { /* "cysignals/memory.pxd":62 * * cdef inline void sig_free "sig_free"(void* ptr) nogil: * sig_block() # <<<<<<<<<<<<<< * free(ptr) * sig_unblock() */ sig_block(); /* "cysignals/memory.pxd":63 * cdef inline void sig_free "sig_free"(void* ptr) nogil: * sig_block() * free(ptr) # <<<<<<<<<<<<<< * sig_unblock() * */ free(__pyx_v_ptr); /* "cysignals/memory.pxd":64 * sig_block() * free(ptr) * sig_unblock() # <<<<<<<<<<<<<< * * */ sig_unblock(); /* "cysignals/memory.pxd":61 * * * cdef inline void sig_free "sig_free"(void* ptr) nogil: # <<<<<<<<<<<<<< * sig_block() * free(ptr) */ /* function exit code */ } /* "cysignals/memory.pxd":68 * * @cython.cdivision(True) * cdef inline size_t mul_overflowcheck(size_t a, size_t b) nogil: # <<<<<<<<<<<<<< * """ * Return a*b, checking for overflow. Assume that a > 0. */ static CYTHON_INLINE size_t __pyx_f_9cysignals_6memory_mul_overflowcheck(size_t __pyx_v_a, size_t __pyx_v_b) { size_t __pyx_v_MUL_NO_OVERFLOW; size_t __pyx_r; int __pyx_t_1; int __pyx_t_2; /* "cysignals/memory.pxd":75 * """ * # If a and b both less than MUL_NO_OVERFLOW, no overflow can occur * cdef size_t MUL_NO_OVERFLOW = ((1) << (4*sizeof(size_t))) # <<<<<<<<<<<<<< * if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW: * if unlikely(b > (-1) // a): */ __pyx_v_MUL_NO_OVERFLOW = (((size_t)1) << (4 * (sizeof(size_t)))); /* "cysignals/memory.pxd":76 * # If a and b both less than MUL_NO_OVERFLOW, no overflow can occur * cdef size_t MUL_NO_OVERFLOW = ((1) << (4*sizeof(size_t))) * if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW: # <<<<<<<<<<<<<< * if unlikely(b > (-1) // a): * return (-1) */ __pyx_t_2 = ((__pyx_v_a >= __pyx_v_MUL_NO_OVERFLOW) != 0); if (!__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } __pyx_t_2 = ((__pyx_v_b >= __pyx_v_MUL_NO_OVERFLOW) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { /* "cysignals/memory.pxd":77 * cdef size_t MUL_NO_OVERFLOW = ((1) << (4*sizeof(size_t))) * if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW: * if unlikely(b > (-1) // a): # <<<<<<<<<<<<<< * return (-1) * return a*b */ __pyx_t_1 = (unlikely((__pyx_v_b > (((size_t)-1L) / __pyx_v_a))) != 0); if (__pyx_t_1) { /* "cysignals/memory.pxd":78 * if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW: * if unlikely(b > (-1) // a): * return (-1) # <<<<<<<<<<<<<< * return a*b * */ __pyx_r = ((size_t)-1L); goto __pyx_L0; /* "cysignals/memory.pxd":77 * cdef size_t MUL_NO_OVERFLOW = ((1) << (4*sizeof(size_t))) * if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW: * if unlikely(b > (-1) // a): # <<<<<<<<<<<<<< * return (-1) * return a*b */ } /* "cysignals/memory.pxd":76 * # If a and b both less than MUL_NO_OVERFLOW, no overflow can occur * cdef size_t MUL_NO_OVERFLOW = ((1) << (4*sizeof(size_t))) * if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW: # <<<<<<<<<<<<<< * if unlikely(b > (-1) // a): * return (-1) */ } /* "cysignals/memory.pxd":79 * if unlikely(b > (-1) // a): * return (-1) * return a*b # <<<<<<<<<<<<<< * * */ __pyx_r = (__pyx_v_a * __pyx_v_b); goto __pyx_L0; /* "cysignals/memory.pxd":68 * * @cython.cdivision(True) * cdef inline size_t mul_overflowcheck(size_t a, size_t b) nogil: # <<<<<<<<<<<<<< * """ * Return a*b, checking for overflow. Assume that a > 0. */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "cysignals/memory.pxd":82 * * * cdef inline void* check_allocarray(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<< * """ * Allocate memory for ``nmemb`` elements of size ``size``. */ static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_allocarray(size_t __pyx_v_nmemb, size_t __pyx_v_size) { size_t __pyx_v_n; void *__pyx_v_ret; void *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("check_allocarray", 0); /* "cysignals/memory.pxd":86 * Allocate memory for ``nmemb`` elements of size ``size``. * """ * if nmemb == 0: # <<<<<<<<<<<<<< * return NULL * cdef size_t n = mul_overflowcheck(nmemb, size) */ __pyx_t_1 = ((__pyx_v_nmemb == 0) != 0); if (__pyx_t_1) { /* "cysignals/memory.pxd":87 * """ * if nmemb == 0: * return NULL # <<<<<<<<<<<<<< * cdef size_t n = mul_overflowcheck(nmemb, size) * cdef void* ret = sig_malloc(n) */ __pyx_r = NULL; goto __pyx_L0; /* "cysignals/memory.pxd":86 * Allocate memory for ``nmemb`` elements of size ``size``. * """ * if nmemb == 0: # <<<<<<<<<<<<<< * return NULL * cdef size_t n = mul_overflowcheck(nmemb, size) */ } /* "cysignals/memory.pxd":88 * if nmemb == 0: * return NULL * cdef size_t n = mul_overflowcheck(nmemb, size) # <<<<<<<<<<<<<< * cdef void* ret = sig_malloc(n) * if unlikely(ret == NULL): */ __pyx_v_n = __pyx_f_9cysignals_6memory_mul_overflowcheck(__pyx_v_nmemb, __pyx_v_size); /* "cysignals/memory.pxd":89 * return NULL * cdef size_t n = mul_overflowcheck(nmemb, size) * cdef void* ret = sig_malloc(n) # <<<<<<<<<<<<<< * if unlikely(ret == NULL): * raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) */ __pyx_v_ret = sig_malloc(__pyx_v_n); /* "cysignals/memory.pxd":90 * cdef size_t n = mul_overflowcheck(nmemb, size) * cdef void* ret = sig_malloc(n) * if unlikely(ret == NULL): # <<<<<<<<<<<<<< * raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) * return ret */ __pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0); if (__pyx_t_1) { /* "cysignals/memory.pxd":91 * cdef void* ret = sig_malloc(n) * if unlikely(ret == NULL): * raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) # <<<<<<<<<<<<<< * return ret * */ __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_nmemb); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_s_bytes, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 91, __pyx_L1_error) /* "cysignals/memory.pxd":90 * cdef size_t n = mul_overflowcheck(nmemb, size) * cdef void* ret = sig_malloc(n) * if unlikely(ret == NULL): # <<<<<<<<<<<<<< * raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) * return ret */ } /* "cysignals/memory.pxd":92 * if unlikely(ret == NULL): * raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) * return ret # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_ret; goto __pyx_L0; /* "cysignals/memory.pxd":82 * * * cdef inline void* check_allocarray(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<< * """ * Allocate memory for ``nmemb`` elements of size ``size``. */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("cysignals.memory.check_allocarray", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cysignals/memory.pxd":95 * * * cdef inline void* check_reallocarray(void* ptr, size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<< * """ * Re-allocate memory at ``ptr`` to hold ``nmemb`` elements of size */ static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_reallocarray(void *__pyx_v_ptr, size_t __pyx_v_nmemb, size_t __pyx_v_size) { size_t __pyx_v_n; void *__pyx_v_ret; void *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("check_reallocarray", 0); /* "cysignals/memory.pxd":103 * When ``nmemb`` equals 0, then free the memory at ``ptr``. * """ * if nmemb == 0: # <<<<<<<<<<<<<< * sig_free(ptr) * return NULL */ __pyx_t_1 = ((__pyx_v_nmemb == 0) != 0); if (__pyx_t_1) { /* "cysignals/memory.pxd":104 * """ * if nmemb == 0: * sig_free(ptr) # <<<<<<<<<<<<<< * return NULL * cdef size_t n = mul_overflowcheck(nmemb, size) */ sig_free(__pyx_v_ptr); /* "cysignals/memory.pxd":105 * if nmemb == 0: * sig_free(ptr) * return NULL # <<<<<<<<<<<<<< * cdef size_t n = mul_overflowcheck(nmemb, size) * cdef void* ret = sig_realloc(ptr, n) */ __pyx_r = NULL; goto __pyx_L0; /* "cysignals/memory.pxd":103 * When ``nmemb`` equals 0, then free the memory at ``ptr``. * """ * if nmemb == 0: # <<<<<<<<<<<<<< * sig_free(ptr) * return NULL */ } /* "cysignals/memory.pxd":106 * sig_free(ptr) * return NULL * cdef size_t n = mul_overflowcheck(nmemb, size) # <<<<<<<<<<<<<< * cdef void* ret = sig_realloc(ptr, n) * if unlikely(ret == NULL): */ __pyx_v_n = __pyx_f_9cysignals_6memory_mul_overflowcheck(__pyx_v_nmemb, __pyx_v_size); /* "cysignals/memory.pxd":107 * return NULL * cdef size_t n = mul_overflowcheck(nmemb, size) * cdef void* ret = sig_realloc(ptr, n) # <<<<<<<<<<<<<< * if unlikely(ret == NULL): * raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) */ __pyx_v_ret = sig_realloc(__pyx_v_ptr, __pyx_v_n); /* "cysignals/memory.pxd":108 * cdef size_t n = mul_overflowcheck(nmemb, size) * cdef void* ret = sig_realloc(ptr, n) * if unlikely(ret == NULL): # <<<<<<<<<<<<<< * raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) * return ret */ __pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0); if (__pyx_t_1) { /* "cysignals/memory.pxd":109 * cdef void* ret = sig_realloc(ptr, n) * if unlikely(ret == NULL): * raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) # <<<<<<<<<<<<<< * return ret * */ __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_nmemb); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_s_bytes, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 109, __pyx_L1_error) /* "cysignals/memory.pxd":108 * cdef size_t n = mul_overflowcheck(nmemb, size) * cdef void* ret = sig_realloc(ptr, n) * if unlikely(ret == NULL): # <<<<<<<<<<<<<< * raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) * return ret */ } /* "cysignals/memory.pxd":110 * if unlikely(ret == NULL): * raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) * return ret # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_ret; goto __pyx_L0; /* "cysignals/memory.pxd":95 * * * cdef inline void* check_reallocarray(void* ptr, size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<< * """ * Re-allocate memory at ``ptr`` to hold ``nmemb`` elements of size */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("cysignals.memory.check_reallocarray", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cysignals/memory.pxd":113 * * * cdef inline void* check_malloc(size_t n) except? NULL: # <<<<<<<<<<<<<< * """ * Allocate ``n`` bytes of memory. */ static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_malloc(size_t __pyx_v_n) { void *__pyx_v_ret; void *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("check_malloc", 0); /* "cysignals/memory.pxd":117 * Allocate ``n`` bytes of memory. * """ * if n == 0: # <<<<<<<<<<<<<< * return NULL * cdef void* ret = sig_malloc(n) */ __pyx_t_1 = ((__pyx_v_n == 0) != 0); if (__pyx_t_1) { /* "cysignals/memory.pxd":118 * """ * if n == 0: * return NULL # <<<<<<<<<<<<<< * cdef void* ret = sig_malloc(n) * if unlikely(ret == NULL): */ __pyx_r = NULL; goto __pyx_L0; /* "cysignals/memory.pxd":117 * Allocate ``n`` bytes of memory. * """ * if n == 0: # <<<<<<<<<<<<<< * return NULL * cdef void* ret = sig_malloc(n) */ } /* "cysignals/memory.pxd":119 * if n == 0: * return NULL * cdef void* ret = sig_malloc(n) # <<<<<<<<<<<<<< * if unlikely(ret == NULL): * raise MemoryError("failed to allocate %s bytes" % n) */ __pyx_v_ret = sig_malloc(__pyx_v_n); /* "cysignals/memory.pxd":120 * return NULL * cdef void* ret = sig_malloc(n) * if unlikely(ret == NULL): # <<<<<<<<<<<<<< * raise MemoryError("failed to allocate %s bytes" % n) * return ret */ __pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0); if (__pyx_t_1) { /* "cysignals/memory.pxd":121 * cdef void* ret = sig_malloc(n) * if unlikely(ret == NULL): * raise MemoryError("failed to allocate %s bytes" % n) # <<<<<<<<<<<<<< * return ret * */ __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_bytes, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 121, __pyx_L1_error) /* "cysignals/memory.pxd":120 * return NULL * cdef void* ret = sig_malloc(n) * if unlikely(ret == NULL): # <<<<<<<<<<<<<< * raise MemoryError("failed to allocate %s bytes" % n) * return ret */ } /* "cysignals/memory.pxd":122 * if unlikely(ret == NULL): * raise MemoryError("failed to allocate %s bytes" % n) * return ret # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_ret; goto __pyx_L0; /* "cysignals/memory.pxd":113 * * * cdef inline void* check_malloc(size_t n) except? NULL: # <<<<<<<<<<<<<< * """ * Allocate ``n`` bytes of memory. */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("cysignals.memory.check_malloc", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cysignals/memory.pxd":125 * * * cdef inline void* check_realloc(void* ptr, size_t n) except? NULL: # <<<<<<<<<<<<<< * """ * Re-allocate memory at ``ptr`` to hold ``n`` bytes. */ static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_realloc(void *__pyx_v_ptr, size_t __pyx_v_n) { void *__pyx_v_ret; void *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("check_realloc", 0); /* "cysignals/memory.pxd":130 * If ``ptr`` equals ``NULL``, this behaves as ``check_malloc``. * """ * if n == 0: # <<<<<<<<<<<<<< * sig_free(ptr) * return NULL */ __pyx_t_1 = ((__pyx_v_n == 0) != 0); if (__pyx_t_1) { /* "cysignals/memory.pxd":131 * """ * if n == 0: * sig_free(ptr) # <<<<<<<<<<<<<< * return NULL * cdef void* ret = sig_realloc(ptr, n) */ sig_free(__pyx_v_ptr); /* "cysignals/memory.pxd":132 * if n == 0: * sig_free(ptr) * return NULL # <<<<<<<<<<<<<< * cdef void* ret = sig_realloc(ptr, n) * if unlikely(ret == NULL): */ __pyx_r = NULL; goto __pyx_L0; /* "cysignals/memory.pxd":130 * If ``ptr`` equals ``NULL``, this behaves as ``check_malloc``. * """ * if n == 0: # <<<<<<<<<<<<<< * sig_free(ptr) * return NULL */ } /* "cysignals/memory.pxd":133 * sig_free(ptr) * return NULL * cdef void* ret = sig_realloc(ptr, n) # <<<<<<<<<<<<<< * if unlikely(ret == NULL): * raise MemoryError("failed to allocate %s bytes" % n) */ __pyx_v_ret = sig_realloc(__pyx_v_ptr, __pyx_v_n); /* "cysignals/memory.pxd":134 * return NULL * cdef void* ret = sig_realloc(ptr, n) * if unlikely(ret == NULL): # <<<<<<<<<<<<<< * raise MemoryError("failed to allocate %s bytes" % n) * return ret */ __pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0); if (__pyx_t_1) { /* "cysignals/memory.pxd":135 * cdef void* ret = sig_realloc(ptr, n) * if unlikely(ret == NULL): * raise MemoryError("failed to allocate %s bytes" % n) # <<<<<<<<<<<<<< * return ret * */ __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_bytes, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 135, __pyx_L1_error) /* "cysignals/memory.pxd":134 * return NULL * cdef void* ret = sig_realloc(ptr, n) * if unlikely(ret == NULL): # <<<<<<<<<<<<<< * raise MemoryError("failed to allocate %s bytes" % n) * return ret */ } /* "cysignals/memory.pxd":136 * if unlikely(ret == NULL): * raise MemoryError("failed to allocate %s bytes" % n) * return ret # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_ret; goto __pyx_L0; /* "cysignals/memory.pxd":125 * * * cdef inline void* check_realloc(void* ptr, size_t n) except? NULL: # <<<<<<<<<<<<<< * """ * Re-allocate memory at ``ptr`` to hold ``n`` bytes. */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("cysignals.memory.check_realloc", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cysignals/memory.pxd":139 * * * cdef inline void* check_calloc(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<< * """ * Allocate memory for ``nmemb`` elements of size ``size``. The */ static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_calloc(size_t __pyx_v_nmemb, size_t __pyx_v_size) { void *__pyx_v_ret; void *__pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("check_calloc", 0); /* "cysignals/memory.pxd":144 * resulting memory is zeroed. * """ * if nmemb == 0: # <<<<<<<<<<<<<< * return NULL * cdef void* ret = sig_calloc(nmemb, size) */ __pyx_t_1 = ((__pyx_v_nmemb == 0) != 0); if (__pyx_t_1) { /* "cysignals/memory.pxd":145 * """ * if nmemb == 0: * return NULL # <<<<<<<<<<<<<< * cdef void* ret = sig_calloc(nmemb, size) * if unlikely(ret == NULL): */ __pyx_r = NULL; goto __pyx_L0; /* "cysignals/memory.pxd":144 * resulting memory is zeroed. * """ * if nmemb == 0: # <<<<<<<<<<<<<< * return NULL * cdef void* ret = sig_calloc(nmemb, size) */ } /* "cysignals/memory.pxd":146 * if nmemb == 0: * return NULL * cdef void* ret = sig_calloc(nmemb, size) # <<<<<<<<<<<<<< * if unlikely(ret == NULL): * raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) */ __pyx_v_ret = sig_calloc(__pyx_v_nmemb, __pyx_v_size); /* "cysignals/memory.pxd":147 * return NULL * cdef void* ret = sig_calloc(nmemb, size) * if unlikely(ret == NULL): # <<<<<<<<<<<<<< * raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) * return ret */ __pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0); if (__pyx_t_1) { /* "cysignals/memory.pxd":148 * cdef void* ret = sig_calloc(nmemb, size) * if unlikely(ret == NULL): * raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) # <<<<<<<<<<<<<< * return ret */ __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_nmemb); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_s_bytes, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 148, __pyx_L1_error) /* "cysignals/memory.pxd":147 * return NULL * cdef void* ret = sig_calloc(nmemb, size) * if unlikely(ret == NULL): # <<<<<<<<<<<<<< * raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) * return ret */ } /* "cysignals/memory.pxd":149 * if unlikely(ret == NULL): * raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) * return ret # <<<<<<<<<<<<<< */ __pyx_r = __pyx_v_ret; goto __pyx_L0; /* "cysignals/memory.pxd":139 * * * cdef inline void* check_calloc(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<< * """ * Allocate memory for ``nmemb`` elements of size ``size``. The */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("cysignals.memory.check_calloc", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "sage/ext/stdsage.pxd":16 * * * cdef inline PY_NEW(type t): # <<<<<<<<<<<<<< * """ * Return ``t.__new__(t)``. This works even for types like */ static CYTHON_INLINE PyObject *__pyx_f_4sage_3ext_7stdsage_PY_NEW(PyTypeObject *__pyx_v_t) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PY_NEW", 0); /* "sage/ext/stdsage.pxd":22 * optimizations assume that ``tp_new`` doesn't change). * """ * return (t).tp_new(t, NULL, NULL) # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((PyTypeObject *)__pyx_v_t)->tp_new(((PyTypeObject *)__pyx_v_t), ((PyObject *)NULL), ((PyObject *)NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "sage/ext/stdsage.pxd":16 * * * cdef inline PY_NEW(type t): # <<<<<<<<<<<<<< * """ * Return ``t.__new__(t)``. This works even for types like */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("sage.ext.stdsage.PY_NEW", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "sage/ext/stdsage.pxd":25 * * * cdef inline void PY_SET_TP_NEW(type dst, type src): # <<<<<<<<<<<<<< * """ * Manually set ``dst.__new__`` to ``src.__new__``. This is used to */ static CYTHON_INLINE void __pyx_f_4sage_3ext_7stdsage_PY_SET_TP_NEW(PyTypeObject *__pyx_v_dst, PyTypeObject *__pyx_v_src) { __Pyx_RefNannyDeclarations newfunc __pyx_t_1; __Pyx_RefNannySetupContext("PY_SET_TP_NEW", 0); /* "sage/ext/stdsage.pxd":31 * irrelevant base class ``tp_new`` methods. * """ * (dst).tp_new = (src).tp_new # <<<<<<<<<<<<<< * * */ __pyx_t_1 = ((PyTypeObject *)__pyx_v_src)->tp_new; ((PyTypeObject *)__pyx_v_dst)->tp_new = __pyx_t_1; /* "sage/ext/stdsage.pxd":25 * * * cdef inline void PY_SET_TP_NEW(type dst, type src): # <<<<<<<<<<<<<< * """ * Manually set ``dst.__new__`` to ``src.__new__``. This is used to */ /* function exit code */ __Pyx_RefNannyFinishContext(); } /* "sage/ext/stdsage.pxd":34 * * * cdef inline bint HAS_DICTIONARY(obj): # <<<<<<<<<<<<<< * """ * Test whether the given object has a Python dictionary. */ static CYTHON_INLINE int __pyx_f_4sage_3ext_7stdsage_HAS_DICTIONARY(PyObject *__pyx_v_obj) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("HAS_DICTIONARY", 0); /* "sage/ext/stdsage.pxd":38 * Test whether the given object has a Python dictionary. * """ * return Py_TYPE(obj).tp_dictoffset != 0 # <<<<<<<<<<<<<< */ __pyx_r = (Py_TYPE(__pyx_v_obj)->tp_dictoffset != 0); goto __pyx_L0; /* "sage/ext/stdsage.pxd":34 * * * cdef inline bint HAS_DICTIONARY(obj): # <<<<<<<<<<<<<< * """ * Test whether the given object has a Python dictionary. */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "cysignals/signals.pxd":35 * # (PyErr_Occurred() is non-NULL). To Cython, it will look like * # cython_check_exception() actually raised the exception. * cdef inline void cython_check_exception() nogil except *: # <<<<<<<<<<<<<< * pass * */ static CYTHON_INLINE void __pyx_f_9cysignals_7signals_cython_check_exception(void) { /* function exit code */ } static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { #if PY_VERSION_HEX < 0x03020000 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, #else PyModuleDef_HEAD_INIT, #endif "_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0", __pyx_k_File__usr_local_src_sage_config, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_Hello_World, __pyx_k_Hello_World, sizeof(__pyx_k_Hello_World), 0, 0, 1, 0}, {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1}, {&__pyx_kp_s_failed_to_allocate_s_bytes, __pyx_k_failed_to_allocate_s_bytes, sizeof(__pyx_k_failed_to_allocate_s_bytes), 0, 0, 1, 0}, {&__pyx_kp_s_failed_to_allocate_s_s_bytes, __pyx_k_failed_to_allocate_s_s_bytes, sizeof(__pyx_k_failed_to_allocate_s_s_bytes), 0, 0, 1, 0}, {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_init_memory_functions, __pyx_k_init_memory_functions, sizeof(__pyx_k_init_memory_functions), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, {&__pyx_n_s_sage_ext_memory, __pyx_k_sage_ext_memory, sizeof(__pyx_k_sage_ext_memory), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 91, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(2, 2, __pyx_L1_error); return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC init_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0(void); /*proto*/ PyMODINIT_FUNC init_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0(void) #else PyMODINIT_FUNC PyInit__usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0(void); /*proto*/ PyMODINIT_FUNC PyInit__usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0(void) #endif { PyObject *__pyx_t_1 = NULL; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0(void)", 0); if (__Pyx_check_binary_version() < 0) __PYX_ERR(2, 2, __pyx_L1_error) __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(2, 2, __pyx_L1_error) __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(2, 2, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(2, 2, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED if (__pyx_CyFunction_init() < 0) __PYX_ERR(2, 2, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) __PYX_ERR(2, 2, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED if (__pyx_Coroutine_init() < 0) __PYX_ERR(2, 2, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) __PYX_ERR(2, 2, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(2, 2, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4("_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0", __pyx_methods, __pyx_k_File__usr_local_src_sage_config, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) __PYX_ERR(2, 2, __pyx_L1_error) __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(2, 2, __pyx_L1_error) Py_INCREF(__pyx_d); __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(2, 2, __pyx_L1_error) #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(2, 2, __pyx_L1_error); __pyx_i = PyImport_AddModule("sage.all"); if (unlikely(!__pyx_i)) __PYX_ERR(2, 2, __pyx_L1_error) /*--- Initialize various global constants etc. ---*/ if (__Pyx_InitGlobals() < 0) __PYX_ERR(2, 2, __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(2, 2, __pyx_L1_error) #endif if (__pyx_module_is_main__usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0) { if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(2, 2, __pyx_L1_error) } #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(2, 2, __pyx_L1_error) if (!PyDict_GetItemString(modules, "_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0")) { if (unlikely(PyDict_SetItemString(modules, "_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0", __pyx_m) < 0)) __PYX_ERR(2, 2, __pyx_L1_error) } } #endif /*--- Builtin init code ---*/ if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(2, 2, __pyx_L1_error) /*--- Constants init code ---*/ if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(2, 2, __pyx_L1_error) /*--- Global init code ---*/ __pyx_v_105_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0_x = ((PyObject*)Py_None); Py_INCREF(Py_None); /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", #if CYTHON_COMPILING_IN_PYPY sizeof(PyTypeObject), #else sizeof(PyHeapTypeObject), #endif 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(3, 9, __pyx_L1_error) /*--- Variable import code ---*/ __pyx_t_1 = __Pyx_ImportModule("cysignals.signals"); if (!__pyx_t_1) __PYX_ERR(2, 2, __pyx_L1_error) if (__Pyx_ImportVoidPtr(__pyx_t_1, "cysigs", (void **)&__pyx_vp_9cysignals_7signals_cysigs, "cysigs_t") < 0) __PYX_ERR(2, 2, __pyx_L1_error) Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*--- Function import code ---*/ /*--- Execution code ---*/ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) if (__Pyx_patch_abc() < 0) __PYX_ERR(2, 2, __pyx_L1_error) #endif /* "../../../../../../../../local/lib/python2.7/site-packages/cysignals/signals.pxi":24 * # This *must* be done for every module using interrupt functions * # otherwise you will get segmentation faults. * import_cysignals__signals() # <<<<<<<<<<<<<< */ __pyx_t_2 = import_cysignals__signals(); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(4, 24, __pyx_L1_error) /* "../../../../../../../../local/lib/python2.7/site-packages/cysignals/signals.pxi":19 * from cysignals.signals cimport * * * cdef extern from 'pxi.h': # <<<<<<<<<<<<<< * int import_cysignals__signals() except -1 * */ __pyx_t_2 = import_cysignals__signals(); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(4, 24, __pyx_L1_error) /* "../../../../../../../../local/lib/python2.7/site-packages/sage/ext/stdsage.pxi":24 * * from sage.ext.stdsage cimport PY_NEW, HAS_DICTIONARY * from sage.ext.memory import init_memory_functions # <<<<<<<<<<<<<< */ __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_n_s_init_memory_functions); __Pyx_GIVEREF(__pyx_n_s_init_memory_functions); PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_init_memory_functions); __pyx_t_4 = __Pyx_Import(__pyx_n_s_sage_ext_memory, __pyx_t_3, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_init_memory_functions); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_init_memory_functions, __pyx_t_3) < 0) __PYX_ERR(5, 24, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0.pyx":6 * * include "cdefs.pxi" * cdef str x = "Hello World" # <<<<<<<<<<<<<< * print(x) */ __Pyx_INCREF(__pyx_kp_s_Hello_World); __Pyx_XGOTREF(__pyx_v_105_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0_x); __Pyx_DECREF_SET(__pyx_v_105_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0_x, __pyx_kp_s_Hello_World); __Pyx_GIVEREF(__pyx_kp_s_Hello_World); /* "_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0.pyx":7 * include "cdefs.pxi" * cdef str x = "Hello World" * print(x) # <<<<<<<<<<<<<< */ if (__Pyx_PrintOne(0, __pyx_v_105_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0_x) < 0) __PYX_ERR(2, 7, __pyx_L1_error) /* "_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0.pyx":2 * * include "cysignals/signals.pxi" # ctrl-c interrupt block support # <<<<<<<<<<<<<< * include "stdsage.pxi" * */ __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_4) < 0) __PYX_ERR(2, 2, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "cysignals/signals.pxd":35 * # (PyErr_Occurred() is non-NULL). To Cython, it will look like * # cython_check_exception() actually raised the exception. * cdef inline void cython_check_exception() nogil except *: # <<<<<<<<<<<<<< * pass * */ /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); if (__pyx_m) { if (__pyx_d) { __Pyx_AddTraceback("init _usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0", __pyx_clineno, __pyx_lineno, __pyx_filename); } Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init _usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* --- Runtime support code --- */ /* Refnanny */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); if (unlikely(!result)) { PyErr_Format(PyExc_NameError, #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); #else "name '%.200s' is not defined", PyString_AS_STRING(name)); #endif } return result; } /* PyObjectCall */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *result; ternaryfunc call = func->ob_type->tp_call; if (unlikely(!call)) return PyObject_Call(func, arg, kw); if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) return NULL; result = (*call)(func, arg, kw); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* PyErrFetchRestore */ #if CYTHON_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 /* RaiseException */ #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { __Pyx_PyThreadState_declare Py_XINCREF(type); if (!value || value == Py_None) value = NULL; else Py_INCREF(value); if (!tb || tb == Py_None) tb = NULL; else { Py_INCREF(tb); if (!PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } } if (PyType_Check(type)) { #if CYTHON_COMPILING_IN_PYPY if (!value) { Py_INCREF(Py_None); value = Py_None; } #endif PyErr_NormalizeException(&type, &value, &tb); } else { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } value = type; type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } } __Pyx_PyThreadState_assign __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *instance_class = NULL; if (value && PyExceptionInstance_Check(value)) { instance_class = (PyObject*) Py_TYPE(value); if (instance_class != type) { int is_subclass = PyObject_IsSubclass(instance_class, type); if (!is_subclass) { instance_class = NULL; } else if (unlikely(is_subclass == -1)) { goto bad; } else { type = instance_class; } } } if (!instance_class) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyObject_Call(type, args, NULL); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } #if PY_VERSION_HEX >= 0x03030000 if (cause) { #else if (cause && cause != Py_None) { #endif PyObject *fixed_cause; if (cause == Py_None) { fixed_cause = NULL; } else if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { #if CYTHON_COMPILING_IN_PYPY PyObject *tmp_type, *tmp_value, *tmp_tb; PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); Py_INCREF(tb); PyErr_Restore(tmp_type, tmp_value, tb); Py_XDECREF(tmp_tb); #else PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } #endif } bad: Py_XDECREF(owned_instance); return; } #endif /* Import */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; #if PY_VERSION_HEX < 0x03030000 PyObject *py_import; py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); if (!py_import) goto bad; #endif if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if (strchr(__Pyx_MODULE_NAME, '.')) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(1); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); #endif if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; PyErr_Clear(); } } level = 0; } #endif if (!module) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, level); #endif } } bad: #if PY_VERSION_HEX < 0x03030000 Py_XDECREF(py_import); #endif Py_XDECREF(empty_list); Py_XDECREF(empty_dict); return module; } /* ImportFrom */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Format(PyExc_ImportError, #if PY_MAJOR_VERSION < 3 "cannot import name %.230s", PyString_AS_STRING(name)); #else "cannot import name %S", name); #endif } return value; } /* CodeObjectCache */ static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; } while (start < end) { mid = start + (end - start) / 2; if (code_line < entries[mid].code_line) { end = mid; } else if (code_line > entries[mid].code_line) { start = mid + 1; } else { return mid; } } if (code_line <= entries[mid].code_line) { return mid; } else { return mid + 1; } } static PyCodeObject *__pyx_find_code_object(int code_line) { PyCodeObject* code_object; int pos; if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { return NULL; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { return NULL; } code_object = __pyx_code_cache.entries[pos].code_object; Py_INCREF(code_object); return code_object; } static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = 64; __pyx_code_cache.count = 1; entries[0].code_line = code_line; entries[0].code_object = code_object; Py_INCREF(code_object); } return; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { PyCodeObject* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_DECREF(tmp); return; } if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = new_max; } for (i=__pyx_code_cache.count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; __pyx_code_cache.count++; Py_INCREF(code_object); } /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(filename); #else py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_code = __Pyx_PyCode_New( 0, 0, 0, 0, 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ py_line, __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); Py_DECREF(py_funcname); return py_code; bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; py_code = __pyx_find_code_object(c_line ? c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; __pyx_insert_code_object(c_line ? c_line : py_line, py_code); } py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ __pyx_d, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; __Pyx_PyFrame_SetLineNumber(py_frame, py_line); PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } /* Print */ #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 static PyObject *__Pyx_GetStdout(void) { PyObject *f = PySys_GetObject((char *)"stdout"); if (!f) { PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); } return f; } static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { int i; if (!f) { if (!(f = __Pyx_GetStdout())) return -1; } Py_INCREF(f); for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { PyObject* v; if (PyFile_SoftSpace(f, 1)) { if (PyFile_WriteString(" ", f) < 0) goto error; } v = PyTuple_GET_ITEM(arg_tuple, i); if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) goto error; if (PyString_Check(v)) { char *s = PyString_AsString(v); Py_ssize_t len = PyString_Size(v); if (len > 0) { switch (s[len-1]) { case ' ': break; case '\f': case '\r': case '\n': case '\t': case '\v': PyFile_SoftSpace(f, 0); break; default: break; } } } } if (newline) { if (PyFile_WriteString("\n", f) < 0) goto error; PyFile_SoftSpace(f, 0); } Py_DECREF(f); return 0; error: Py_DECREF(f); return -1; } #else static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { PyObject* kwargs = 0; PyObject* result = 0; PyObject* end_string; if (unlikely(!__pyx_print)) { __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print); if (!__pyx_print) return -1; } if (stream) { kwargs = PyDict_New(); if (unlikely(!kwargs)) return -1; if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0)) goto bad; if (!newline) { end_string = PyUnicode_FromStringAndSize(" ", 1); if (unlikely(!end_string)) goto bad; if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) { Py_DECREF(end_string); goto bad; } Py_DECREF(end_string); } } else if (!newline) { if (unlikely(!__pyx_print_kwargs)) { __pyx_print_kwargs = PyDict_New(); if (unlikely(!__pyx_print_kwargs)) return -1; end_string = PyUnicode_FromStringAndSize(" ", 1); if (unlikely(!end_string)) return -1; if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) { Py_DECREF(end_string); return -1; } Py_DECREF(end_string); } kwargs = __pyx_print_kwargs; } result = PyObject_Call(__pyx_print, arg_tuple, kwargs); if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs)) Py_DECREF(kwargs); if (!result) return -1; Py_DECREF(result); return 0; bad: if (kwargs != __pyx_print_kwargs) Py_XDECREF(kwargs); return -1; } #endif /* PrintOne */ #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 static int __Pyx_PrintOne(PyObject* f, PyObject *o) { if (!f) { if (!(f = __Pyx_GetStdout())) return -1; } Py_INCREF(f); if (PyFile_SoftSpace(f, 0)) { if (PyFile_WriteString(" ", f) < 0) goto error; } if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0) goto error; if (PyFile_WriteString("\n", f) < 0) goto error; Py_DECREF(f); return 0; error: Py_DECREF(f); return -1; /* the line below is just to avoid C compiler * warnings about unused functions */ return __Pyx_Print(f, NULL, 0); } #else static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { int res; PyObject* arg_tuple = PyTuple_Pack(1, o); if (unlikely(!arg_tuple)) return -1; res = __Pyx_Print(stream, arg_tuple, 1); Py_DECREF(arg_tuple); return res; } #endif /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(long) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(long) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); } } /* 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;\ } /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(long) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (long) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) case 2: if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 3: if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 4: if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (long) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(long) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) case -2: if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 2: if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -3: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 3: if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -4: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 4: if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; } #endif if (sizeof(long) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (long) -1; } } else { long val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (long) -1; val = __Pyx_PyInt_As_long(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); return (long) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long) -1; } /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(int) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (int) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) case 2: if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; case 3: if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; case 4: if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (int) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(int) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) case -2: if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 2: if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -3: if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 3: if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -4: if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 4: if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; } #endif if (sizeof(int) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (int) -1; } } else { int val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (int) -1; val = __Pyx_PyInt_As_int(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); return (int) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to int"); return (int) -1; } /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); } return 0; } /* ModuleImport */ #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; py_name = __Pyx_PyIdentifier_FromString(name); if (!py_name) goto bad; py_module = PyImport_Import(py_name); Py_DECREF(py_name); return py_module; bad: Py_XDECREF(py_name); return 0; } #endif /* TypeImport */ #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; Py_ssize_t basicsize; #ifdef Py_LIMITED_API PyObject *py_basicsize; #endif py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); Py_DECREF(py_name); py_name = 0; Py_DECREF(py_module); py_module = 0; if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%.200s.%.200s is not a type object", module_name, class_name); goto bad; } #ifndef Py_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; #else py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); if (!py_basicsize) goto bad; basicsize = PyLong_AsSsize_t(py_basicsize); Py_DECREF(py_basicsize); py_basicsize = 0; if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; #endif if (!strict && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd", module_name, class_name, basicsize, size); if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; } else if ((size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd", module_name, class_name, basicsize, size); goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(py_module); Py_XDECREF(result); return NULL; } #endif /* VoidPtrImport */ #ifndef __PYX_HAVE_RT_ImportVoidPtr #define __PYX_HAVE_RT_ImportVoidPtr static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) { PyObject *d = 0; PyObject *cobj = 0; d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); if (!d) goto bad; cobj = PyDict_GetItemString(d, name); if (!cobj) { PyErr_Format(PyExc_ImportError, "%.200s does not export expected C variable %.200s", PyModule_GetName(module), name); goto bad; } #if PY_VERSION_HEX >= 0x02070000 if (!PyCapsule_IsValid(cobj, sig)) { PyErr_Format(PyExc_TypeError, "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj)); goto bad; } *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 variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", PyModule_GetName(module), name, sig, desc); goto bad; } *p = PyCObject_AsVoidPtr(cobj);} #endif if (!(*p)) goto bad; Py_DECREF(d); return 0; bad: Py_XDECREF(d); return -1; } #endif /* InitStrings */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); } static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if ( #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII __Pyx_sys_getdefaultencoding_not_ascii && #endif PyUnicode_Check(o)) { #if PY_VERSION_HEX < 0x03030000 char* defenc_c; PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); if (!defenc) return NULL; defenc_c = PyBytes_AS_STRING(defenc); #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII { char* end = defenc_c + PyBytes_GET_SIZE(defenc); char* c; for (c = defenc_c; c < end; c++) { if ((unsigned char) (*c) >= 128) { PyUnicode_AsASCIIString(o); return NULL; } } } #endif *length = PyBytes_GET_SIZE(defenc); return defenc_c; #else if (__Pyx_PyUnicode_READY(o) == -1) return NULL; #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (PyUnicode_IS_ASCII(o)) { *length = PyUnicode_GET_LENGTH(o); return PyUnicode_AsUTF8(o); } else { PyUnicode_AsASCIIString(o); return NULL; } #else return PyUnicode_AsUTF8AndSize(o, length); #endif #endif } else #endif #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); } else #endif { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); if (unlikely(r < 0)) { return NULL; } else { return result; } } } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { #if CYTHON_USE_TYPE_SLOTS PyNumberMethods *m; #endif const char *name = NULL; PyObject *res = NULL; #if PY_MAJOR_VERSION < 3 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return __Pyx_NewRef(x); #if CYTHON_USE_TYPE_SLOTS m = Py_TYPE(x)->tp_as_number; #if PY_MAJOR_VERSION < 3 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif #else res = PyNumber_Int(x); #endif if (res) { #if PY_MAJOR_VERSION < 3 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%.4s__ returned non-%.4s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject *x; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(b))) { if (sizeof(Py_ssize_t) >= sizeof(long)) return PyInt_AS_LONG(b); else return PyInt_AsSsize_t(x); } #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)b)->ob_digit; const Py_ssize_t size = Py_SIZE(b); if (likely(__Pyx_sst_abs(size) <= 1)) { ival = likely(size) ? digits[0] : 0; if (size == -1) ival = -ival; return ival; } else { switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case 3: if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -3: if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case 4: if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -4: if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; } } #endif return PyLong_AsSsize_t(b); } x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); } #endif /* Py_PYTHON_H */ 1b07bfec32aced54a2b1f67651519f04ec38cd80.paxheader00006660000000000000000000000330143007035060020631xustar00rootroot00000000000000216 path=ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/6/cells/1/__usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx.html 1b07bfec32aced54a2b1f67651519f04ec38cd80.data000077500000000000000000000475251430070350600175130ustar00rootroot00000000000000 Cython: _usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0.pyx

Generated by Cython 0.25.2

Yellow lines hint at Python interaction.
Click on a line that starts with a "+" to see the C code that Cython generated for it.

Raw output: _usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0.c

 1: 
+2: include "cysignals/signals.pxi"  # ctrl-c interrupt block support
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_4) < 0) __PYX_ERR(2, 2, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 3: include "stdsage.pxi"
 4: 
 5: include "cdefs.pxi"
+6: cdef str x = "Hello World"
  __Pyx_INCREF(__pyx_kp_s_Hello_World);
  __Pyx_XGOTREF(__pyx_v_105_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0_x);
  __Pyx_DECREF_SET(__pyx_v_105_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0_x, __pyx_kp_s_Hello_World);
  __Pyx_GIVEREF(__pyx_kp_s_Hello_World);
+7: print(x)
  if (__Pyx_PrintOne(0, __pyx_v_105_usr_local_src_sage_config_ExportSageNB_test_dot_sage_sage_notebook_sagenb_home_admin_6_code_sage4_spyx_0_x) < 0) __PYX_ERR(2, 7, __pyx_L1_error)
ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/6/code/000077500000000000000000000000001430070350600310055ustar00rootroot00000000000000sage4.spyx000066400000000000000000000000431430070350600326530ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/6/codecdef str x = "Hello World" print(x)ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/6/snapshots/000077500000000000000000000000001430070350600321155ustar00rootroot000000000000001488453006.bz2000066400000000000000000000001661430070350600335460ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/6/snapshotsBZh91AY&SY.% ߀R`@en T%PF4i?Tښl@irܪ k3>*V 0J,R64y,BWnRegx"(Hnworksheet.html000066400000000000000000000001431430070350600327130ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/6 {{{id=1| %hide %cython cdef str x = "Hello World" print(x) /// Hello World }}} {{{id=2| /// }}}worksheet_conf.pickle000066400000000000000000000007361430070350600342330ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/2/21/212/2123/admin/6(dp1 S'system' p2 S'sage' p3 sS'saved_by_info' p4 (dp5 S'1488453006' p6 S'admin' p7 ssS'tags' p8 (dp9 S'admin' p10 (lp11 I1 assS'id_number' p12 I6 sS'pretty_print' p13 I00 sS'live_3D' p14 I00 sS'published_id_number' p15 NsS'owner' p16 g10 sS'viewers' p17 (lp18 sS'ratings' p19 (lp20 sS'collaborators' p21 (lp22 sS'name' p23 VTest %cython p24 sS'auto_publish' p25 I00 sS'last_change' p26 (S'admin' p27 F1488452967.4795661 tp28 sS'worksheet_that_was_published' p29 (g10 I6 tp30 s.ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/9/000077500000000000000000000000001430070350600255305ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/9/9b/000077500000000000000000000000001430070350600260425ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/9/9b/9bb/000077500000000000000000000000001430070350600265165ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/9/9b/9bb/9bbe/000077500000000000000000000000001430070350600273375ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/9/9b/9bb/9bbe/_sage_/000077500000000000000000000000001430070350600305545ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/9/9b/9bb/9bbe/_sage_/4/000077500000000000000000000000001430070350600307175ustar00rootroot00000000000000worksheet.html000066400000000000000000000353121430070350600335450ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/9/9b/9bb/9bbe/_sage_/4

Welcome to the Sage Tutorial!

Sage is free, open-source math software that supports research and teaching in algebra, geometry, number theory, cryptography, numerical computation, and related areas. Both the Sage development model and the technology in Sage itself are distinguished by an extremely strong emphasis on openness, community, cooperation, and collaboration: we are building the car, not reinventing the wheel. The overall goal of Sage is to create a viable, free, open-source alternative to Maple, Mathematica, Magma, and MATLAB.

This tutorial is the best way to become familiar with Sage in only a few hours. You can read it in HTML or PDF versions, or from the Sage notebook (click Help, then click Tutorial to interactively work through the tutorial from within Sage).

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.

Indices and tables

Table Of Contents

Next topic

Introduction

This Page

{{{id=1| /// }}}worksheet_conf.pickle000066400000000000000000000010011430070350600350410ustar00rootroot00000000000000ExportSageNB-3.4/test/dot_sage/sage_notebook.sagenb/home/__store__/9/9b/9bb/9bbe/_sage_/4(dp1 S'system' p2 S'sage' p3 sS'saved_by_info' p4 (dp5 sS'tags' p6 (dp7 S'admin' p8 (lp9 I1 asS'_sage_' p10 (lp11 I1 assS'id_number' p12 I4 sS'pretty_print' p13 I00 sS'live_3D' p14 I00 sS'published_id_number' p15 NsS'owner' p16 S'_sage_' p17 sS'viewers' p18 (lp19 sS'ratings' p20 (lp21 sS'collaborators' p22 (lp23 sS'name' p24 VWelcome to the Sage Tutorial! -- Sage Tutorial v6.4.rc1 p25 sS'auto_publish' p26 I00 sS'last_change' p27 (g10 F1415283547.06429 tp28 sS'worksheet_that_was_published' p29 (g10 I4 tp30 s.ExportSageNB-3.4/test/test_sagenb_list.py000066400000000000000000000017261430070350600205470ustar00rootroot00000000000000# import os import unittest from sagenb_export.sagenb_reader import ( NotebookSageNB, TextCell, ComputeCell, ) DOT_SAGE = os.path.join(os.path.dirname(__file__), 'dot_sage') class ListSageNB(unittest.TestCase): def test_list(self): nbks = list(NotebookSageNB.all_iter(DOT_SAGE)) self.assertEqual(len(nbks), 5) sage_4, admin_4, admin_6, admin_10, aleks = sorted(nbks) self.assertEqual(sage_4.unique_id, '_sage_:4') self.assertEqual(sage_4.name, u'Welcome to the Sage Tutorial! -- Sage Tutorial v6.4.rc1') self.assertEqual(admin_4.unique_id, 'admin:4') self.assertEqual(admin_4.name, u'MathJax_problem1') self.assertEqual(admin_10.unique_id, 'admin:10') self.assertEqual(admin_10.name, u'Oxford Seminar (1,1)-Calabi Yau') self.assertEqual(aleks.unique_id, 'aleksandra.slapik:44') self.assertEqual(aleks.name, u'WDI projekt - R\xf3\u017cankowski, Kie\u0142pi\u0144ski, Kozok') ExportSageNB-3.4/test/test_sagenb_reader.py000066400000000000000000000103131430070350600210260ustar00rootroot00000000000000 import os import unittest from sagenb_export.sagenb_reader import ( NotebookSageNB, TextCell, ComputeCell, ) try: string_type = unicode # py2 except NameError: string_type = str # py3 DOT_SAGE = os.path.join(os.path.dirname(__file__), 'dot_sage') class ReadSageNB(unittest.TestCase): """ Test various sample notebooks """ def test_admin_10(self): notebook = NotebookSageNB.find(DOT_SAGE, 'admin:10') self.assertEqual(notebook.unique_id, 'admin:10') self.assertEqual(notebook.name, 'Oxford Seminar (1,1)-Calabi Yau') cell = list(notebook.cells) self.assertEqual(len(cell), 37) # First cell self.assertIsInstance(cell[0], TextCell) self.assertEqual(cell[0].input, '

The 24-Cell

') # Second cell self.assertIsInstance(cell[1], ComputeCell) self.assertEqual(cell[1].index, 4) self.assertEqual( cell[1].input, 'cell24 = polytopes.twenty_four_cell()\ncell24.f_vector() # it is self-dual') self.assertEqual(cell[1].input, cell[1].ipython_input()) self.assertEqual(cell[1].output, '(1, 24, 96, 96, 24, 1)') self.assertEqual(cell[1].plain_text_output(), '(1, 24, 96, 96, 24, 1)') # Third cell (containing HTML) self.assertIsInstance(cell[2], ComputeCell) self.assertEqual(cell[2].index, 86) self.assertEqual( cell[2].input, 'cell24.f_vector?') self.assertEqual(cell[2].input, cell[2].ipython_input()) self.assertIn('\n\n
', cell[2].output) self.assertEqual(cell[2].plain_text_output(), '') def test_sage_4(self): notebook = NotebookSageNB.find(DOT_SAGE, '_sage_:4') self.assertEqual(notebook.unique_id, '_sage_:4') self.assertEqual(notebook.name, 'Welcome to the Sage Tutorial! -- Sage Tutorial v6.4.rc1') cell = list(notebook.cells) self.assertEqual(len(cell), 2) self.assertEqual(type(cell[0].input), string_type) self.assertEqual(type(cell[1].input), string_type) self.assertEqual(type(cell[1].output), string_type) def test_admin_4(self): notebook = NotebookSageNB.find(DOT_SAGE, 'admin:4') self.assertEqual(notebook.unique_id, 'admin:4') self.assertEqual(notebook.name, u'MathJax_problem1') cell_list = list(notebook.cells) self.assertEqual(len(cell_list), 2) # First cell cell0 = cell_list[0] self.assertIsInstance(cell0, TextCell) self.assertEqual(cell0.input, u'

R\xf3wnanie Newtona

\n

$$\\vec F= m\\vec a$$\xa0

\n

Rzut pionowy

\n

$$F= m a$$\xa0

\n

\xa0

\n

\xa0Krok czasowy: $\\Delta t$.

\n

\xa0

\n
    \n
  • $ \xa0v\xa0=\xa0\\displaystyle\\frac{ \\Delta \xa0y}{\\Delta t}$
  • \n
\n
    \n
  • $ \xa0a\xa0=\xa0 \\displaystyle \\frac{\\Delta \xa0v}{\\Delta t}$
  • \n
\n
\xa0
\n

$$\\begin{cases} \\quad \\displaystyle \\frac{\\Delta y}{\\Delta t} &=& v \\\\ \\quad \\displaystyle \\frac{\\Delta v}{\\Delta t} &=& \\displaystyle \\frac { F}{m} \\end{cases} $$

\n

\xa0

\n

\xa0

\n
\xa0$\\:y_0\\:$ \xa0i $\\:v_{0}\\:$
\n

$$\\begin{cases}
\\quad y &=&y_0\\ +\\ v_{0}\\:\\Delta t\\\\\xa0

\\quad v &=&v_{0}\\ +\\ \xa0\\frac{F}{m}\\:\\Delta t \\end{cases}$$

') # Second cell cell1 = cell_list[1] self.assertIsInstance(cell1, ComputeCell) self.assertEqual(cell1.index, 1) self.assertEqual(cell1.input, '') self.assertEqual(cell1.output, '') self.assertEqual(cell1.plain_text_output(), '') def test_admin_6(self): notebook = NotebookSageNB.find(DOT_SAGE, 'admin:6') self.assertEqual(notebook.unique_id, 'admin:6') self.assertEqual(notebook.name, 'Test %cython') cell_list = list(notebook.cells) self.assertEqual(len(cell_list), 2) # First cell cell0 = cell_list[0] self.assertIsInstance(cell0, ComputeCell) self.assertEqual(cell0.input, '%hide\n%cython\ncdef str x = "Hello World"\nprint(x)') self.assertEqual(cell0.ipython_input(), '%%cython\ncdef str x = "Hello World"\nprint(x)') ExportSageNB-3.4/test/test_sagenb_writer.py000066400000000000000000000021441430070350600211030ustar00rootroot00000000000000 import os import unittest import tempfile import shutil from sagenb_export.sagenb_reader import ( NotebookSageNB, TextCell, ComputeCell, ) from sagenb_export.ipynb_writer import IpynbWriter DOT_SAGE = os.path.join(os.path.dirname(__file__), 'dot_sage') class ReadSageNB(unittest.TestCase): """ Test various sample notebooks """ def setUp(self): self.tmp = tempfile.mkdtemp(prefix='sagenb_export_') def tearDown(self): shutil.rmtree(self.tmp, ignore_errors=True) def tmp_filename(self, name): return os.path.join(self.tmp, name) def test_sage_4(self): notebook = NotebookSageNB.find(DOT_SAGE, '_sage_:4') ipynb = IpynbWriter(notebook) ipynb.write(self.tmp_filename('sage:4.ipynb')) def test_aleksandra_slapik_44(self): notebook = NotebookSageNB.find(DOT_SAGE, 'aleksandra.slapik:44') ipynb = IpynbWriter(notebook) ipynb.write(self.tmp_filename('aleksandra_slapik_44.ipynb')) ipynb.write(self.tmp_filename(u'WDI projekt - R\xf3\u017cankowski, Kie\u0142pi\u0144ski, Kozok.ipynb')) ExportSageNB-3.4/tox.ini000066400000000000000000000006371430070350600152000ustar00rootroot00000000000000[tox] envlist = py35, py36, py37, py38, py39, py310 [testenv] deps=notebook [testenv:py35] commands=python3.5 -m unittest discover [testenv:py36] commands=python3.6 -m unittest discover [testenv:py37] commands=python3.7 -m unittest discover [testenv:py38] commands=python3.8 -m unittest discover [testenv:py39] commands=python3.9 -m unittest discover [testenv:py310] commands=python3.10 -m unittest discover