pax_global_header00006660000000000000000000000064152205714400014512gustar00rootroot0000000000000052 comment=08d7b51a5453238b1f620a6526a6940e98ccac2f graph-algorithms-planarity-08d7b51/000077500000000000000000000000001522057144000173175ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/.github/000077500000000000000000000000001522057144000206575ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/.github/ISSUE_TEMPLATE/000077500000000000000000000000001522057144000230425ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/.github/ISSUE_TEMPLATE/bug_report.md000066400000000000000000000017611522057144000255410ustar00rootroot00000000000000--- name: Bug report about: Create a report to help us improve title: '' labels: bug assignees: '' type: Bug --- ## Describe the bug _A clear and concise description of the defect._ ## Reproduction steps 1. _Update with reproduction steps_ ## Expected behavior _A clear and concise description of what you expected to happen._ ## Terminal logs _If applicable, upload a logfile of your terminal output to help explain your problem._ ## Environment - OS: [e.g. Debian Linux Trixie 13.4] - Python Version [e.g. 3.14.3] - Installation mechanism: - [ ] PyPI via `pip` - [ ] Built from Source - Paste result of `pip freeze` here: ``` > pip freeze ... ``` - Paste **compiler version information** here: ``` > gcc --version ... ``` ## Additional context _Add any other context about the problem here, including issues or bugs on related projects and supporting documentation._ graph-algorithms-planarity-08d7b51/.github/ISSUE_TEMPLATE/config.yml000066400000000000000000000000341522057144000250270ustar00rootroot00000000000000blank_issues_enabled: false graph-algorithms-planarity-08d7b51/.github/ISSUE_TEMPLATE/feature_request.md000066400000000000000000000011051522057144000265640ustar00rootroot00000000000000--- name: Feature request about: Suggest an idea for this project title: '' labels: '' assignees: '' type: Feature --- ## Problem statement _A clear and concise description of the problem._ ## Proposed solution _A clear and concise description of a proposed solution and how it resolves the problem._ ### Alternative solutions _A clear and concise description of any alternative solutions or features you've considered to resolve the problem._ ## Additional context _Add any other context, links to documentation, logs, or screenshots about the feature request here._ graph-algorithms-planarity-08d7b51/.github/pull_request_template.md000066400000000000000000000022211522057144000256150ustar00rootroot00000000000000Resolves #__**ISSUE NUMBER**__ ## Type of change Please check only relevant options: - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ## Changes ### Added * _Replace with paths to files added, and brief summary of the purpose these new files satisfy with respect to the original Issue_ ### Updated * _Replace with paths to files updated, and brief summary of the purpose these changes satisfy with respect to the original Issue_ ### Removed * _Replace with paths to files removed, and brief summary of the why these files were removed with respect to the original Issue_ ## Testing - [ ] Outline manual or automated tests performed and how it relates to the particular feature added or functionality changed - [ ] Upload logs or provide relevant snippets of terminal output to demo functionality
Replace with high-level description of log snippets ``` Paste terminal log snippets here ```
graph-algorithms-planarity-08d7b51/.github/workflows/000077500000000000000000000000001522057144000227145ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/.github/workflows/main.yaml000066400000000000000000000015771522057144000245360ustar00rootroot00000000000000name: Python package on: workflow_dispatch: pull_request: branches: [ '**' ] paths-ignore: - '**/*.md' jobs: build: runs-on: ["ubuntu-latest"] strategy: matrix: python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | sudo apt-get update -qq sudo apt install -y build-essential python3-dev - name: Install python dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt python --version python -m pip install -vvv . - name: Test with pytest run: | pytest -vv graph-algorithms-planarity-08d7b51/.gitignore000066400000000000000000000002341522057144000213060ustar00rootroot00000000000000*.pyc __pycache__ *~ .DS_Store build/* .coverage *.class dist/ planarity.egg-info/ *.so # Vim's swap files *.sw[op] #Spyder project file .spyderproject graph-algorithms-planarity-08d7b51/LICENSE.txt000066400000000000000000000041671522057144000211520ustar00rootroot00000000000000License ======= Planarity (the 'planarity' Python package; the software) is released under the following BSD-3-Clause license. :: Copyright (c) 2016-2026, Planarity Developers John M. Boyer Wanda B. K. Boyer Aric Hagberg All rights reserved. Planarity includes the Edge Addition Planarity Suite, which is Copyright (c) 1997-2026, John M. Boyer. The BSD-3-Clause license for the Edge Additional Planarity Suite included in Planarity appears here: https://github.com/graph-algorithms/planarity/blob/master/planarity/src/LICENSE.TXT Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the names of the Planarity Developers nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. graph-algorithms-planarity-08d7b51/MANIFEST.in000066400000000000000000000014251522057144000210570ustar00rootroot00000000000000include MANIFEST.in include setup.py include LICENSE.txt include planarity/c/LICENSE.TXT include README.md include planarity/c/README recursive-include planarity/c/ *.h include planarity/classic/cplanarity.pxd include planarity/classic/planarity.c include planarity/classic/planarity.pyx include planarity/full/cgraphLib.pxd include planarity/full/graphLib.pxd include planarity/full/graph.pxd include planarity/full/graphLib.c include planarity/full/graph.c include planarity/full/g6IterationUtils.c include planarity/full/graphLib.pyx include planarity/full/graph.pyx include planarity/full/g6IterationUtils.pyx recursive-include examples *.py *.gz recursive-include doc *.py *.rst Makefile *.html *.txt global-exclude *~ global-exclude *.pyc global-exclude .git prune doc/build graph-algorithms-planarity-08d7b51/README.md000066400000000000000000000056471522057144000206120ustar00rootroot00000000000000# Planarity The [`planarity` repository](https://github.com/graph-algorithms/planarity) provides the source code for the [`planarity` Python package](https://pypi.org/project/planarity/). The `planarity` package was originally developed to provide Python and [NetworkX](https://pypi.org/project/networkx/) developers with a Python API to access planar graph testing, embedding, drawing, and forbidden subgraph isolation algorithms from the [Edge Addition Planarity Suite (EAPS)](https://github.com/graph-algorithms/edge-addition-planarity-suite). The `planarity` repository has now been transferred to the [Github Graph Algorithms Organization](https://github.com/graph-algorithms). The `planarity` repository and Python package have been updated with the full set of planarity-related algorithms from [EAPS](https://github.com/graph-algorithms/edge-addition-planarity-suite) as well as all public methods from its generalized graph library to enable development of a wide range of high-performance graph algorithms and applications. ## Example ```python In [1]: # Example of the complete graph of 5 nodes, K5 In [2]: # K5 is not planar In [3]: import planarity In [4]: edgelist = [('a', 'b'), ('a', 'c'), ('a', 'd'), ('a', 'e'), ...: ('b', 'c'),('b', 'd'),('b', 'e'), ...: ('c', 'd'), ('c', 'e'), ...: ('d', 'e')] In [5]: print(planarity.is_planar(edgelist)) False In [6]: # remove an edge to make the graph planar In [7]: edgelist.remove(('a','b')) In [8]: print(planarity.is_planar(edgelist)) True In [9]: # make an ascii text drawing In [10]: print(planarity.ascii(edgelist)) ```
----1----
| | |   |
| | -3--|
| |  ||||
| -2--|||
|  |  |||
---4---||
 |     ||
 ---5----
```python In [11]: # Shows correspondence between vertex labels and indices In [12]: print(planarity.mapping(edgelist)) {1: 'd', 2: 'c', 3: 'e', 4: 'a', 5: 'b'} ``` See [here](https://github.com/graph-algorithms/planarity/tree/master/examples) for more examples. For further details on development setup and installation, please see [this](https://github.com/graph-algorithms/planarity/wiki/1.-Setup-Instructions) wiki page on the [`planarity` repository](https://github.com/graph-algorithms/planarity). ## License Planarity (the 'planarity' Python package; the software) is released under [this BSD-3-Clause license](https://github.com/graph-algorithms/planarity/blob/master/LICENSE.txt). Copyright (c) 2016-2026, Planarity Developers
John M. Boyer
Wanda B. K. Boyer
Aric Hagberg
All rights reserved.
Planarity includes the Edge Addition Planarity Suite, which is
Copyright (c) 1997-2026, John M. Boyer.
The BSD-3-Clause license for the Edge Additional Planarity Suite included in Planarity appears [here](https://github.com/graph-algorithms/planarity/blob/master/planarity/c/LICENSE.TXT). graph-algorithms-planarity-08d7b51/doc/000077500000000000000000000000001522057144000200645ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/doc/Makefile000066400000000000000000000127161522057144000215330ustar00rootroot00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/planarity.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/planarity.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/planarity" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/planarity" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." make -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." graph-algorithms-planarity-08d7b51/doc/build/000077500000000000000000000000001522057144000211635ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/doc/build/doctrees/000077500000000000000000000000001522057144000227735ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/doc/build/doctrees/environment.pickle000066400000000000000000000400251522057144000265310ustar00rootroot00000000000000€(csphinx.environment BuildEnvironment qoq}q(Udlfilesqcsphinx.util FilenameUniqDict q)�qc__builtin__ set q]…RqbUintersphinx_named_inventoryq }Uappq NU _warnfuncq NUtitlesq }q (Xindexqcdocutils.nodes title q)�q}q(U rawsourceqUU attributesq}q(Udupnamesq]Uclassesq]Ubackrefsq]Uidsq]Unamesq]uUchildrenq]qcdocutils.nodes Text qX Planarityq…�q}q(hX Planarityq Uparentq!hubaUtagnameq"Utitleq#ubXreference/indexq$h)�q%}q&(hUh}q'(h]h]h]h]h]uh]q(hX Referenceq)…�q*}q+(hX Referenceq,h!h%ubah"h#ubuU domaindataq-}q.(Ustdq/}q0(Uversionq1KU anonlabelsq2}q3(Umodindexq4U py-modindexU†Ugenindexq5h5U†Usearchq6UsearchU†uUlabelsq7}q8(h4U py-modindexUcsphinx.locale _TranslationProxy q9csphinx.locale mygettext q:U Module Indexq;†�q†�q?h:h>…q@†b‡h6h6Uh9h:U Search PageqA†�qBh:hA…qC†b‡uU progoptionsqD}qEUobjectsqF}qGuUc}qH(hF}qIh1KuUpyqJ}qK(hF}qL(X)planarity.planarity_networkx.pgraph_graphqMh$XfunctionqN†X#planarity.planarity_functions.asciiqOh$XfunctionqP†X!planarity.planarity_networkx.drawqQh$XfunctionqR†X%planarity.planarity_functions.mappingqSh$XfunctionqT†X'planarity.planarity_functions.is_planarqUh$XfunctionqV†X#planarity.planarity_functions.writeqWh$XfunctionqX†X0planarity.planarity_networkx.kuratowski_subgraphqYh$XfunctionqZ†X.planarity.planarity_functions.kuratowski_edgesq[h$Xfunctionq\†Xplanarity.PGraphq]h$Xclassq^†X+planarity.planarity_networkx.networkx_graphq_h$Xfunctionq`†Xplanarity.planarity_functionsqah$Umoduleqb†Xplanarity.planarity_networkxqch$hb†uUmodulesqd}qe(ha(h$UU‰thc(h$UU‰tuh1KuUnp-cqf}qg(hFhIh1KuUjsqh}qi(hF}qjh1KuUrstqk}ql(hF}qmh1KuUcppqn}qo(hF}qph1KuuU glob_toctreesqqh]…RqrU reread_alwaysqsh]…RqtU doctreedirquX9/home/aric/Software/Projects/planarity/doc/build/doctreesqvUversioning_conditionqw‰U citationsqx}h1K)Utodo_all_todosqy]Uintersphinx_inventoryqz}Usrcdirq{X1/home/aric/Software/Projects/planarity/doc/sourceq|Uconfigq}csphinx.config Config q~)�q}q€(U source_suffixq�U.rstUtexinfo_documentsq‚]qƒ(Uindexq„U planarityq…Xplanarity Documentationq†X Aric Hagbergq‡h…U One line description of project.U Miscellaneousqˆtq‰aU copyrightqŠU2013, Aric HagbergUtemplates_pathq‹]qŒU _templatesq�aUlatex_documentsqŽ]q�(h„U planarity.texh†h‡Umanualq�tq‘aU overridesq’}Upygments_styleq“Usphinxq”Uexclude_patternsq•]Uprojectq–h…Ureleaseq—U0.3q˜Uhtmlhelp_basenameq™U planaritydoch1h˜U extensionsqš]q›(Usphinx.ext.autodocqœUsphinx.ext.doctestq�Usphinx.ext.intersphinxqžUsphinx.ext.todoqŸUsphinx.ext.coverageq Usphinx.ext.pngmathq¡Usphinx.ext.ifconfigq¢Usphinx.ext.viewcodeq£Usphinx.ext.autosummaryq¤Unumpydocq¥eUhtml_static_pathq¦]q§U_staticq¨aU html_themeq©UdefaultqªU man_pagesq«]q¬(Uindexq­h…h†]q®h‡aKtq¯aU master_docq°h­Uintersphinx_mappingq±}q²Uhttp://docs.python.org/NsUsetupq³NubUintersphinx_cacheq´}Umetadataqµ}q¶(h}h$}uUversionchangesq·}U_viewcode_modulesq¸}q¹(cdocutils.nodes reprunicode qºX planarityq»…�q¼}q½bX®from __future__ import absolute_import from .planarity import PGraph from .planarity_functions import * from .planarity_networkx import * from .tests.test import run as test q¾}q¿}‡hºXplanarity.planarity_functionsqÀ…�qÁ}qÂbX """Functional interface to planarity.""" import planarity __all__ = ['is_planar', 'kuratowski_edges', 'ascii', 'write', 'mapping'] def is_planar(graph): """Test planarity of graph.""" return planarity.PGraph(graph).is_planar() def kuratowski_edges(graph): """Return edges of forbidden subgraph of non-planar graph.""" return planarity.PGraph(graph).kuratowski_edges() def ascii(graph): """Draw text representation of a planar graph.""" return planarity.PGraph(graph).ascii() def write(graph, path='stdout'): """Write an adjacency list representation of graph to path.""" planarity.PGraph(graph).write(path) def mapping(graph): """Return dictionary of internal mapping of nodes to integers.""" return planarity.PGraph(graph).mapping() qÃ}qÄ(XwriteqÅXdefqÆKK‡X is_planarqÇXdefqÈKK ‡XasciiqÉXdefqÊKK‡Xkuratowski_edgesqËXdefqÌK K‡XmappingqÍXdefqÎKK‡u}qÏ(XwriteqÐh$X is_planarqÑh$XasciiqÒh$Xkuratowski_edgesqÓh$XmappingqÔh$u‡hºXplanarity.planarity_networkxqÕ…�qÖ}q×bX """NetworkX interface to planarity.""" import planarity __all__ = ['kuratowski_subgraph', 'pgraph_graph', 'networkx_graph', 'draw'] def kuratowski_subgraph(graph): """Return forbidden subgraph of nonplanar graph G.""" try: import networkx as nx except ImportError: raise ImportError("NetworkX required for kuratowski_subgraph()") pgraph = planarity.PGraph(graph) edges = pgraph.kuratowski_edges() return nx.Graph(edges) def networkx_graph(pgraph): """Return NetworkX graph built from planarity pgraph.""" try: import networkx as nx except ImportError: raise ImportError("NetworkX required for networkx_graph()") graph = nx.Graph() graph.add_nodes_from(pgraph.nodes(data=True)) graph.add_edges_from(pgraph.edges(data=True)) return graph def pgraph_graph(graph): """Return pgraph graph built from NetworkX graph.""" return planarity.PGraph(graph) def draw(graph, labels=True): """Draw planar graph with Matplotlib.""" try: import matplotlib.pyplot as plt from matplotlib.patches import Circle from matplotlib.collections import PatchCollection except ImportError: raise ImportError("Matplotlib is required for draw()") pgraph = planarity.PGraph(graph) pgraph.embed_drawplanar() hgraph = networkx_graph(pgraph) patches = [] node_labels = {} xs = [] ys = [] for node, data in hgraph.nodes(data=True): y = data['pos'] xb = data['start'] xe = data['end'] x = int((xe+xb)/2) node_labels[node] = (x, y) patches += [Circle((x, y), 0.25)]#,0.5,fc='w')] xs.extend([xb, xe]) ys.append(y) plt.hlines([y], [xb], [xe]) for (_, _, data) in hgraph.edges(data=True): x = data['pos'] yb = data['start'] ye = data['end'] ys.extend([yb, ye]) xs.append(x) plt.vlines([x], [yb], [ye]) # labels if labels: for n, (x, y) in node_labels.items(): plt.text(x, y, n, horizontalalignment='center', verticalalignment='center', bbox = dict(boxstyle='round', ec=(0.0, 0.0, 0.0), fc=(1.0, 1.0, 1.0), ) ) p = PatchCollection(patches) ax = plt.gca() ax.add_collection(p) plt.axis('equal') plt.xlim(min(xs)-1, max(xs)+1) plt.ylim(min(ys)-1, max(ys)+1) qØ}qÙ(Xnetworkx_graphqÚXdefqÛKK‡XdrawqÜXdefqÝK KS‡Xkuratowski_subgraphqÞXdefqßKK‡X pgraph_graphqàXdefqáKK ‡u}qâ(Xnetworkx_graphqãh$Xdrawqäh$Xkuratowski_subgraphqåh$X pgraph_graphqæh$u‡uUtoc_num_entriesqç}qè(hKh$KuUimagesqéh)�qêh]…RqëbUnumbered_toctreesqìh]…RqíU found_docsqîh]qï(hh$e…RqðU longtitlesqñ}qò(hhh$h%uU dependenciesqó}qô(hh]qõ(Um../../../../../.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/__init__.pycqöUv../../../../../.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_networkx.pyq÷Uw../../../../../.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_functions.pyqøe…Rqùh$h]qú(Um../../../../../.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/__init__.pycqûUv../../../../../.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_networkx.pyqüUw../../../../../.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_functions.pyqýe…RqþuUtoctree_includesqÿ}r(h]r(XasciirXedgesrXembed_drawplanarrX embed_planarrX is_planarrXkuratowski_edgesrXmappingrXnodesr Xwriter eh$]r (Xreference/asciir Xreference/edgesr Xreference/embed_drawplanarrXreference/embed_planarrXreference/is_planarrXreference/kuratowski_edgesrXreference/mappingrXreference/nodesrXreference/writereuU temp_datar}Utocsr}r(hcdocutils.nodes bullet_list r)�r}r(hUh}r(h]h]h]h]h]uh]r(cdocutils.nodes list_item r)�r}r(hUh}r (h]h]h]h]h]uh!jh]r!(csphinx.addnodes compact_paragraph r")�r#}r$(hUh}r%(h]h]h]h]h]uh!jh]r&cdocutils.nodes reference r')�r(}r)(hUh}r*(U anchornameUUrefurihh]h]h]h]h]Uinternalˆuh!j#h]r+hX Planarityr,…�r-}r.(hh h!j(ubah"U referencer/ubah"Ucompact_paragraphr0ubj)�r1}r2(hUh}r3(h]h]h]h]h]uh!jh]r4(j)�r5}r6(hUh}r7(h]h]h]h]h]uh!j1h]r8j")�r9}r:(hUh}r;(h]h]h]h]h]uh!j5h]r<j')�r=}r>(hUh}r?(U anchornameX%#module-planarity.planarity_functionsUrefurihh]h]h]h]h]Uinternalˆuh!j9h]r@hX FunctionsrA…�rB}rC(hX FunctionsrDh!j=ubah"j/ubah"j0ubah"U list_itemrEubj)�rF}rG(hUh}rH(h]h]h]h]h]uh!j1h]rIj")�rJ}rK(hUh}rL(h]h]h]h]h]uh!jFh]rMj')�rN}rO(hUh}rP(U anchornameX$#module-planarity.planarity_networkxUrefurihh]h]h]h]h]Uinternalˆuh!jJh]rQhXNetworkX InterfacerR…�rS}rT(hXNetworkX InterfacerUh!jNubah"j/ubah"j0ubah"jEubj)�rV}rW(hUh}rX(h]h]h]h]h]uh!j1h]rY(j")�rZ}r[(hUh}r\(h]h]h]h]h]uh!jVh]r]j')�r^}r_(hUh}r`(U anchornameU#wrapper-classUrefurihh]h]h]h]h]Uinternalˆuh!jZh]rahX Wrapper Classrb…�rc}rd(hX Wrapper Classreh!j^ubah"j/ubah"j0ubj)�rf}rg(hUh}rh(h]h]h]h]h]uh!jVh]ricsphinx.addnodes toctree rj)�rk}rl(hUh}rm(UglobNh]h]h]h]h]Uentries]rn(Nj†roNj†rpNj†rqNj†rrNj†rsNj†rtNj†ruNj †rvNj †rweU includefiles]rx(jjjjjjjj j eUmaxdepthJÿÿÿÿuh!jfh]h"Utoctreeryubah"U bullet_listrzubeh"jEubeh"jzubeh"jEubj)�r{}r|(hUh}r}(h]h]h]h]h]uh!jh]r~j")�r}r€(hUh}r�(h]h]h]h]h]uh!j{h]r‚j')�rƒ}r„(hUh}r…(U anchornameU#indices-and-tablesUrefurihh]h]h]h]h]Uinternalˆuh!jh]r†hXIndices and tablesr‡…�rˆ}r‰(hXIndices and tablesrŠh!jƒubah"j/ubah"j0ubah"jEubeh"jzubh$j)�r‹}rŒ(hUh}r�(h]h]h]h]h]uh]rŽj)�r�}r�(hUh}r‘(h]h]h]h]h]uh!j‹h]r’(j")�r“}r”(hUh}r•(h]h]h]h]h]uh!j�h]r–j')�r—}r˜(hUh}r™(U anchornameUUrefurih$h]h]h]h]h]Uinternalˆuh!j“h]ršhX Referencer›…�rœ}r�(hh,h!j—ubah"j/ubah"j0ubj)�rž}rŸ(hUh}r (h]h]h]h]h]uh!j�h]r¡(j)�r¢}r£(hUh}r¤(h]h]h]h]h]uh!jžh]r¥j")�r¦}r§(hUh}r¨(h]h]h]h]h]uh!j¢h]r©j')�rª}r«(hUh}r¬(U anchornameX%#module-planarity.planarity_functionsUrefurih$h]h]h]h]h]Uinternalˆuh!j¦h]r­hX Functionsr®…�r¯}r°(hX Functionsr±h!jªubah"j/ubah"j0ubah"jEubj)�r²}r³(hUh}r´(h]h]h]h]h]uh!jžh]rµj")�r¶}r·(hUh}r¸(h]h]h]h]h]uh!j²h]r¹j')�rº}r»(hUh}r¼(U anchornameX$#module-planarity.planarity_networkxUrefurih$h]h]h]h]h]Uinternalˆuh!j¶h]r½hXNetworkX Interfacer¾…�r¿}rÀ(hXNetworkX InterfacerÁh!jºubah"j/ubah"j0ubah"jEubj)�rÂ}rÃ(hUh}rÄ(h]h]h]h]h]uh!jžh]rÅ(j")�rÆ}rÇ(hUh}rÈ(h]h]h]h]h]uh!jÂh]rÉj')�rÊ}rË(hUh}rÌ(U anchornameU#wrapper-classUrefurih$h]h]h]h]h]Uinternalˆuh!jÆh]rÍhX Wrapper ClassrÎ…�rÏ}rÐ(hX Wrapper ClassrÑh!jÊubah"j/ubah"j0ubj)�rÒ}rÓ(hUh}rÔ(h]h]h]h]h]uh!jÂh]rÕjj)�rÖ}r×(hUh}rØ(UglobNh]h]h]h]h]Uentries]rÙ(Nj †rÚNj †rÛNj†rÜNj†rÝNj†rÞNj†rßNj†ràNj†ráNj†râeU includefiles]rã(j j jjjjjjjeUmaxdepthJÿÿÿÿuh!jÒh]h"jyubah"jzubeh"jEubeh"jzubeh"jEubah"jzubuU indexentriesrä}rå(h]ræ((UsinglerçX&planarity.planarity_functions (module)X$module-planarity.planarity_functionsUtrè(jçX5is_planar() (in module planarity.planarity_functions)hUUtré(jçX<kuratowski_edges() (in module planarity.planarity_functions)h[Utrê(jçX1ascii() (in module planarity.planarity_functions)hOUtrë(jçX1write() (in module planarity.planarity_functions)hWUtrì(jçX3mapping() (in module planarity.planarity_functions)hSUtrí(jçX%planarity.planarity_networkx (module)X#module-planarity.planarity_networkxUtrî(jçX>kuratowski_subgraph() (in module planarity.planarity_networkx)hYUtrï(jçX7pgraph_graph() (in module planarity.planarity_networkx)hMUtrð(jçX9networkx_graph() (in module planarity.planarity_networkx)h_Utrñ(jçX/draw() (in module planarity.planarity_networkx)hQUtrò(jçXPGraph (class in planarity)h]Utróeh$]rô((jçX&planarity.planarity_functions (module)X$module-planarity.planarity_functionsUtrõ(jçX5is_planar() (in module planarity.planarity_functions)X'planarity.planarity_functions.is_planarröUtr÷(jçX<kuratowski_edges() (in module planarity.planarity_functions)X.planarity.planarity_functions.kuratowski_edgesrøUtrù(jçX1ascii() (in module planarity.planarity_functions)X#planarity.planarity_functions.asciirúUtrû(jçX1write() (in module planarity.planarity_functions)X#planarity.planarity_functions.writerüUtrý(jçX3mapping() (in module planarity.planarity_functions)X%planarity.planarity_functions.mappingrþUtrÿ(jçX%planarity.planarity_networkx (module)X#module-planarity.planarity_networkxUtr(jçX>kuratowski_subgraph() (in module planarity.planarity_networkx)X0planarity.planarity_networkx.kuratowski_subgraphrUtr(jçX7pgraph_graph() (in module planarity.planarity_networkx)X)planarity.planarity_networkx.pgraph_graphrUtr(jçX9networkx_graph() (in module planarity.planarity_networkx)X+planarity.planarity_networkx.networkx_graphrUtr(jçX/draw() (in module planarity.planarity_networkx)X!planarity.planarity_networkx.drawrUtr(jçXPGraph (class in planarity)Xplanarity.PGraphr Utr euUall_docsr }r (hGAÔm3À':Íh$GAÔm3À, XuUsettingsr }r(Ucloak_email_addressesrˆUtrim_footnote_reference_spacer‰U halt_levelrKUsectsubtitle_xformr‰Uembed_stylesheetr‰U pep_base_urlrUhttp://www.python.org/dev/peps/rUdoctitle_xformr‰Uwarning_streamrcsphinx.util.nodes WarningStream r)�r}r(U_rercre _compile rU+\((DEBUG|INFO|WARNING|ERROR|SEVERE)/[0-4]\)rK†RrUwarnfuncrNubUenvr hU rfc_base_urlr!Uhttp://tools.ietf.org/html/r"Ufile_insertion_enabledr#ˆUgettext_compactr$ˆUinput_encodingr%U utf-8-sigr&uUfiles_to_rebuildr'}r((jh]r)h$a…Rr*jh]r+ha…Rr,j h]r-h$a…Rr.jh]r/h$a…Rr0jh]r1ha…Rr2jh]r3h$a…Rr4j h]r5ha…Rr6jh]r7ha…Rr8jh]r9ha…Rr:jh]r;ha…Rr<jh]r=h$a…Rr>jh]r?h$a…Rr@j h]rAh$a…RrBjh]rCha…RrDjh]rEha…RrFj h]rGha…RrHjh]rIh$a…RrJjh]rKh$a…RrLuUtoc_secnumbersrM}U_nitpick_ignorerNh]…RrOub.graph-algorithms-planarity-08d7b51/doc/build/doctrees/index.doctree000066400000000000000000001234471522057144000254640ustar00rootroot00000000000000€cdocutils.nodes document q)�q}q(U nametypesq}q(X planarityqNX functionsqNX)planarity.planarity_networkx.pgraph_graphqKX wrapper classq NX#planarity.planarity_functions.asciiq KX!planarity.planarity_networkx.drawq KX%planarity.planarity_functions.mappingq KX'planarity.planarity_functions.is_planarq KX#planarity.planarity_functions.writeqKXnetworkx interfaceqNX0planarity.planarity_networkx.kuratowski_subgraphqKX.planarity.planarity_functions.kuratowski_edgesqKXplanarity.PGraphqKXindices and tablesqNX+planarity.planarity_networkx.networkx_graphqKuUsubstitution_defsq}qUparse_messagesq]q(cdocutils.nodes system_message q)�q}q(U rawsourceqUUparentqcsphinx.addnodes desc_content q)�q}q (hUhcsphinx.addnodes desc q!)�q"}q#(hUhcdocutils.nodes section q$)�q%}q&(hUhh$)�q'}q((hUhhUsourceq)cdocutils.nodes reprunicode q*X;/home/aric/Software/Projects/planarity/doc/source/index.rstq+…�q,}q-bUtagnameq.Usectionq/U attributesq0}q1(Udupnamesq2]Uclassesq3]Ubackrefsq4]Uidsq5]q6U planarityq7aUnamesq8]q9hauUlineq:KUdocumentq;hUchildrenq<]q=(cdocutils.nodes title q>)�q?}q@(hX PlanarityqAhh'h)h,h.UtitleqBh0}qC(h2]h3]h4]h5]h8]uh:Kh;hh<]qDcdocutils.nodes Text qEX PlanarityqF…�qG}qH(hhAhh?ubaubcdocutils.nodes paragraph qI)�qJ}qK(hX1A Python interface to graph planarity algorithms.qLhh'h)h,h.U paragraphqMh0}qN(h2]h3]h4]h5]h8]uh:K h;hh<]qOhEX1A Python interface to graph planarity algorithms.qP…�qQ}qR(hhLhhJubaubhI)�qS}qT(hXaThis provides a wrapper for Boyer's (C) planarity algorithms: http://code.google.com/p/planarity/hh'h)h,h.hMh0}qU(h2]h3]h4]h5]h8]uh:K h;hh<]qV(hEX>This provides a wrapper for Boyer's (C) planarity algorithms: qW…�qX}qY(hX>This provides a wrapper for Boyer's (C) planarity algorithms: hhSubcdocutils.nodes reference qZ)�q[}q\(hX#http://code.google.com/p/planarity/q]h0}q^(Urefurih]h5]h4]h2]h3]h8]uhhSh<]q_hEX#http://code.google.com/p/planarity/q`…�qa}qb(hUhh[ubah.U referenceqcubeubcdocutils.nodes field_list qd)�qe}qf(hUhh'h)h,h.U field_listqgh0}qh(h2]h3]h4]h5]h8]uh:Kh;hh<]qi(cdocutils.nodes field qj)�qk}ql(hUhheh)h,h.Ufieldqmh0}qn(h2]h3]h4]h5]h8]uh:Kh;hh<]qo(cdocutils.nodes field_name qp)�qq}qr(hXReleaseqsh0}qt(h2]h3]h4]h5]h8]uhhkh<]quhEXReleaseqv…�qw}qx(hhshhqubah.U field_nameqyubcdocutils.nodes field_body qz)�q{}q|(hX |version|q}h0}q~(h2]h3]h4]h5]h8]uhhkh<]qhI)�q€}q�(hh}hh{h)h,h.hMh0}q‚(h2]h3]h4]h5]h8]uh:Kh<]qƒhEX0.3q„…�q…}q†(hU0.3q‡hh€ubaubah.U field_bodyqˆubeubhj)�q‰}qŠ(hUhheh)h,h.hmh0}q‹(h2]h3]h4]h5]h8]uh:Kh;hh<]qŒ(hp)�q�}qŽ(hXDateq�h0}q�(h2]h3]h4]h5]h8]uhh‰h<]q‘hEXDateq’…�q“}q”(hh�hh�ubah.hyubhz)�q•}q–(hX |today| h0}q—(h2]h3]h4]h5]h8]uhh‰h<]q˜hI)�q™}qš(hX|today|q›hh•h)h,h.hMh0}qœ(h2]h3]h4]h5]h8]uh:Kh<]q�hEX June 09, 2013qž…�qŸ}q (hX June 09, 2013hh™ubaubah.hˆubeubeubh$)�q¡}q¢(hUhh'h)h,h.h/h0}q£(h2]h3]h4]h5]q¤(X$module-planarity.planarity_functionsq¥U functionsq¦eh8]q§hauh:Kh;hh<]q¨(h>)�q©}qª(hX Functionsq«hh¡h)h,h.hBh0}q¬(h2]h3]h4]h5]h8]uh:Kh;hh<]q­hEX Functionsq®…�q¯}q°(hh«hh©ubaubcsphinx.addnodes index q±)�q²}q³(hUhh¡h)U q´h.Uindexqµh0}q¶(h5]h4]h2]h3]h8]Uentries]q·(Usingleq¸X&planarity.planarity_functions (module)X$module-planarity.planarity_functionsUtq¹auh:Kh;hh<]ubhI)�qº}q»(hX"Functional interface to planarity.q¼hh¡h)Xž/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_functions.py:docstring of planarity.planarity_functionsh.hMh0}q½(h2]h3]h4]h5]h8]uh:Kh;hh<]q¾hEX"Functional interface to planarity.q¿…�qÀ}qÁ(hh¼hhºubaubh±)�qÂ}qÃ(hUhh¡h)X¨/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_functions.py:docstring of planarity.planarity_functions.is_planarqÄh.hµh0}qÅ(h5]h4]h2]h3]h8]Uentries]qÆ(h¸X5is_planar() (in module planarity.planarity_functions)h UtqÇauh:Nh;hh<]ubh!)�qÈ}qÉ(hUhh¡h)hÄh.UdescqÊh0}qË(Unoindexq̉UdomainqÍXpyh5]h4]h2]h3]h8]UobjtypeqÎXfunctionqÏUdesctypeqÐhÏuh:Nh;hh<]qÑ(csphinx.addnodes desc_signature qÒ)�qÓ}qÔ(hXis_planar(graph)hhÈh)U qÕh.Udesc_signatureqÖh0}q×(h5]qØh aUmoduleqÙh*Xplanarity.planarity_functionsqÚ…�qÛ}qÜbh4]h2]h3]h8]qÝh aUfullnameqÞX is_planarqßUclassqàUUfirstqá‰uh:Nh;hh<]qâ(csphinx.addnodes desc_addname qã)�qä}qå(hXplanarity.planarity_functions.hhÓh)hÕh.U desc_addnameqæh0}qç(h2]h3]h4]h5]h8]uh:Nh;hh<]qèhEXplanarity.planarity_functions.qé…�qê}që(hUhhäubaubcsphinx.addnodes desc_name qì)�qí}qî(hhßhhÓh)hÕh.U desc_nameqïh0}qð(h2]h3]h4]h5]h8]uh:Nh;hh<]qñhEX is_planarqò…�qó}qô(hUhhíubaubcsphinx.addnodes desc_parameterlist qõ)�qö}q÷(hUhhÓh)hÕh.Udesc_parameterlistqøh0}qù(h2]h3]h4]h5]h8]uh:Nh;hh<]qúcsphinx.addnodes desc_parameter qû)�qü}qý(hXgraphh0}qþ(h2]h3]h4]h5]h8]uhhöh<]qÿhEXgraphr…�r}r(hUhhüubah.Udesc_parameterrubaubcsphinx.addnodes only r)�r}r(hUhhÓh)Nh.Uonlyrh0}r(UexprUhtmlr h5]h4]h2]h3]h8]uh:Nh;hh<]r csphinx.addnodes pending_xref r )�r }r (hUh0}r(UreftypeUviewcoderUrefdocXindexrU refdomainUstdrh5]h4]U refexplicit‰h2]h3]h8]U reftargetX&_modules/planarity/planarity_functionsUrefidhßuhjh<]rcdocutils.nodes inline r)�r}r(hUh0}r(h2]h3]rU viewcode-linkrah4]h5]h8]uhj h<]rhEX[source]r…�r}r(hUhjubah.Uinlinerubah.U pending_xrefrubaubeubh)�r}r (hUhhÈh)hÕh.U desc_contentr!h0}r"(h2]h3]h4]h5]h8]uh:Nh;hh<]r#hI)�r$}r%(hXTest planarity of graph.r&hjh)hÄh.hMh0}r'(h2]h3]h4]h5]h8]uh:Kh;hh<]r(hEXTest planarity of graph.r)…�r*}r+(hj&hj$ubaubaubeubh±)�r,}r-(hUhh¡h)X¯/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_functions.py:docstring of planarity.planarity_functions.kuratowski_edgesr.h.hµh0}r/(h5]h4]h2]h3]h8]Uentries]r0(h¸X<kuratowski_edges() (in module planarity.planarity_functions)hUtr1auh:Nh;hh<]ubh!)�r2}r3(hUhh¡h)j.h.hÊh0}r4(h̉hÍXpyh5]h4]h2]h3]h8]hÎXfunctionr5hÐj5uh:Nh;hh<]r6(hÒ)�r7}r8(hXkuratowski_edges(graph)hj2h)hÕh.hÖh0}r9(h5]r:hahÙh*Xplanarity.planarity_functionsr;…�r<}r=bh4]h2]h3]h8]r>hahÞXkuratowski_edgesr?hàUhá‰uh:Nh;hh<]r@(hã)�rA}rB(hXplanarity.planarity_functions.hj7h)hÕh.hæh0}rC(h2]h3]h4]h5]h8]uh:Nh;hh<]rDhEXplanarity.planarity_functions.rE…�rF}rG(hUhjAubaubhì)�rH}rI(hj?hj7h)hÕh.hïh0}rJ(h2]h3]h4]h5]h8]uh:Nh;hh<]rKhEXkuratowski_edgesrL…�rM}rN(hUhjHubaubhõ)�rO}rP(hUhj7h)hÕh.høh0}rQ(h2]h3]h4]h5]h8]uh:Nh;hh<]rRhû)�rS}rT(hXgraphh0}rU(h2]h3]h4]h5]h8]uhjOh<]rVhEXgraphrW…�rX}rY(hUhjSubah.jubaubj)�rZ}r[(hUhj7h)Nh.jh0}r\(Uexprj h5]h4]h2]h3]h8]uh:Nh;hh<]r]j )�r^}r_(hUh0}r`(UreftypejUrefdocjU refdomainjh5]h4]U refexplicit‰h2]h3]h8]U reftargetX&_modules/planarity/planarity_functionsUrefidj?uhjZh<]raj)�rb}rc(hUh0}rd(h2]h3]rejah4]h5]h8]uhj^h<]rfhEX[source]rg…�rh}ri(hUhjbubah.jubah.jubaubeubh)�rj}rk(hUhj2h)hÕh.j!h0}rl(h2]h3]h4]h5]h8]uh:Nh;hh<]rmhI)�rn}ro(hX7Return edges of forbidden subgraph of non-planar graph.rphjjh)j.h.hMh0}rq(h2]h3]h4]h5]h8]uh:Kh;hh<]rrhEX7Return edges of forbidden subgraph of non-planar graph.rs…�rt}ru(hjphjnubaubaubeubh±)�rv}rw(hUhh¡h)X¤/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_functions.py:docstring of planarity.planarity_functions.asciirxh.hµh0}ry(h5]h4]h2]h3]h8]Uentries]rz(h¸X1ascii() (in module planarity.planarity_functions)h Utr{auh:Nh;hh<]ubh!)�r|}r}(hUhh¡h)jxh.hÊh0}r~(h̉hÍXpyh5]h4]h2]h3]h8]hÎXfunctionrhÐjuh:Nh;hh<]r€(hÒ)�r�}r‚(hX ascii(graph)hj|h)hÕh.hÖh0}rƒ(h5]r„h ahÙh*Xplanarity.planarity_functionsr……�r†}r‡bh4]h2]h3]h8]rˆh ahÞXasciir‰hàUhá‰uh:Nh;hh<]rŠ(hã)�r‹}rŒ(hXplanarity.planarity_functions.hj�h)hÕh.hæh0}r�(h2]h3]h4]h5]h8]uh:Nh;hh<]rŽhEXplanarity.planarity_functions.r�…�r�}r‘(hUhj‹ubaubhì)�r’}r“(hj‰hj�h)hÕh.hïh0}r”(h2]h3]h4]h5]h8]uh:Nh;hh<]r•hEXasciir–…�r—}r˜(hUhj’ubaubhõ)�r™}rš(hUhj�h)hÕh.høh0}r›(h2]h3]h4]h5]h8]uh:Nh;hh<]rœhû)�r�}rž(hXgraphh0}rŸ(h2]h3]h4]h5]h8]uhj™h<]r hEXgraphr¡…�r¢}r£(hUhj�ubah.jubaubj)�r¤}r¥(hUhj�h)Nh.jh0}r¦(Uexprj h5]h4]h2]h3]h8]uh:Nh;hh<]r§j )�r¨}r©(hUh0}rª(UreftypejUrefdocjU refdomainjh5]h4]U refexplicit‰h2]h3]h8]U reftargetX&_modules/planarity/planarity_functionsUrefidj‰uhj¤h<]r«j)�r¬}r­(hUh0}r®(h2]h3]r¯jah4]h5]h8]uhj¨h<]r°hEX[source]r±…�r²}r³(hUhj¬ubah.jubah.jubaubeubh)�r´}rµ(hUhj|h)hÕh.j!h0}r¶(h2]h3]h4]h5]h8]uh:Nh;hh<]r·hI)�r¸}r¹(hX+Draw text representation of a planar graph.rºhj´h)jxh.hMh0}r»(h2]h3]h4]h5]h8]uh:Kh;hh<]r¼hEX+Draw text representation of a planar graph.r½…�r¾}r¿(hjºhj¸ubaubaubeubh±)�rÀ}rÁ(hUhh¡h)X¤/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_functions.py:docstring of planarity.planarity_functions.writerÂh.hµh0}rÃ(h5]h4]h2]h3]h8]Uentries]rÄ(h¸X1write() (in module planarity.planarity_functions)hUtrÅauh:Nh;hh<]ubh!)�rÆ}rÇ(hUhh¡h)jÂh.hÊh0}rÈ(h̉hÍXpyh5]h4]h2]h3]h8]hÎXfunctionrÉhÐjÉuh:Nh;hh<]rÊ(hÒ)�rË}rÌ(hXwrite(graph, path='stdout')hjÆh)hÕh.hÖh0}rÍ(h5]rÎhahÙh*Xplanarity.planarity_functionsrÏ…�rÐ}rÑbh4]h2]h3]h8]rÒhahÞXwriterÓhàUhá‰uh:Nh;hh<]rÔ(hã)�rÕ}rÖ(hXplanarity.planarity_functions.hjËh)hÕh.hæh0}r×(h2]h3]h4]h5]h8]uh:Nh;hh<]rØhEXplanarity.planarity_functions.rÙ…�rÚ}rÛ(hUhjÕubaubhì)�rÜ}rÝ(hjÓhjËh)hÕh.hïh0}rÞ(h2]h3]h4]h5]h8]uh:Nh;hh<]rßhEXwriterà…�rá}râ(hUhjÜubaubhõ)�rã}rä(hUhjËh)hÕh.høh0}rå(h2]h3]h4]h5]h8]uh:Nh;hh<]ræ(hû)�rç}rè(hXgraphh0}ré(h2]h3]h4]h5]h8]uhjãh<]rêhEXgraphrë…�rì}rí(hUhjçubah.jubhû)�rî}rï(hX path='stdout'h0}rð(h2]h3]h4]h5]h8]uhjãh<]rñhEX path='stdout'rò…�ró}rô(hUhjîubah.jubeubj)�rõ}rö(hUhjËh)Nh.jh0}r÷(Uexprj h5]h4]h2]h3]h8]uh:Nh;hh<]røj )�rù}rú(hUh0}rû(UreftypejUrefdocjU refdomainjh5]h4]U refexplicit‰h2]h3]h8]U reftargetX&_modules/planarity/planarity_functionsUrefidjÓuhjõh<]rüj)�rý}rþ(hUh0}rÿ(h2]h3]rjah4]h5]h8]uhjùh<]rhEX[source]r…�r}r(hUhjýubah.jubah.jubaubeubh)�r}r(hUhjÆh)hÕh.j!h0}r(h2]h3]h4]h5]h8]uh:Nh;hh<]rhI)�r }r (hX8Write an adjacency list representation of graph to path.r hjh)jÂh.hMh0}r (h2]h3]h4]h5]h8]uh:Kh;hh<]r hEX8Write an adjacency list representation of graph to path.r…�r}r(hj hj ubaubaubeubh±)�r}r(hUhh¡h)X¦/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_functions.py:docstring of planarity.planarity_functions.mappingrh.hµh0}r(h5]h4]h2]h3]h8]Uentries]r(h¸X3mapping() (in module planarity.planarity_functions)h Utrauh:Nh;hh<]ubh!)�r}r(hUhh¡h)jh.hÊh0}r(h̉hÍXpyh5]h4]h2]h3]h8]hÎXfunctionrhÐjuh:Nh;hh<]r(hÒ)�r}r(hXmapping(graph)hjh)hÕh.hÖh0}r(h5]rh ahÙh*Xplanarity.planarity_functionsr …�r!}r"bh4]h2]h3]h8]r#h ahÞXmappingr$hàUhá‰uh:Nh;hh<]r%(hã)�r&}r'(hXplanarity.planarity_functions.hjh)hÕh.hæh0}r((h2]h3]h4]h5]h8]uh:Nh;hh<]r)hEXplanarity.planarity_functions.r*…�r+}r,(hUhj&ubaubhì)�r-}r.(hj$hjh)hÕh.hïh0}r/(h2]h3]h4]h5]h8]uh:Nh;hh<]r0hEXmappingr1…�r2}r3(hUhj-ubaubhõ)�r4}r5(hUhjh)hÕh.høh0}r6(h2]h3]h4]h5]h8]uh:Nh;hh<]r7hû)�r8}r9(hXgraphh0}r:(h2]h3]h4]h5]h8]uhj4h<]r;hEXgraphr<…�r=}r>(hUhj8ubah.jubaubj)�r?}r@(hUhjh)Nh.jh0}rA(Uexprj h5]h4]h2]h3]h8]uh:Nh;hh<]rBj )�rC}rD(hUh0}rE(UreftypejUrefdocjU refdomainjh5]h4]U refexplicit‰h2]h3]h8]U reftargetX&_modules/planarity/planarity_functionsUrefidj$uhj?h<]rFj)�rG}rH(hUh0}rI(h2]h3]rJjah4]h5]h8]uhjCh<]rKhEX[source]rL…�rM}rN(hUhjGubah.jubah.jubaubeubh)�rO}rP(hUhjh)hÕh.j!h0}rQ(h2]h3]h4]h5]h8]uh:Nh;hh<]rRhI)�rS}rT(hX;Return dictionary of internal mapping of nodes to integers.rUhjOh)jh.hMh0}rV(h2]h3]h4]h5]h8]uh:Kh;hh<]rWhEX;Return dictionary of internal mapping of nodes to integers.rX…�rY}rZ(hjUhjSubaubaubeubeubh$)�r[}r\(hUhh'h)h,h.h/h0}r](h2]h3]h4]h5]r^(X#module-planarity.planarity_networkxr_Unetworkx-interfacer`eh8]rahauh:Kh;hh<]rb(h>)�rc}rd(hXNetworkX Interfacerehj[h)h,h.hBh0}rf(h2]h3]h4]h5]h8]uh:Kh;hh<]rghEXNetworkX Interfacerh…�ri}rj(hjehjcubaubh±)�rk}rl(hUhj[h)h´h.hµh0}rm(h5]h4]h2]h3]h8]Uentries]rn(h¸X%planarity.planarity_networkx (module)X#module-planarity.planarity_networkxUtroauh:Kh;hh<]ubhI)�rp}rq(hX NetworkX interface to planarity.rrhj[h)Xœ/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_networkx.py:docstring of planarity.planarity_networkxrsh.hMh0}rt(h2]h3]h4]h5]h8]uh:Kh;hh<]ruhEX NetworkX interface to planarity.rv…�rw}rx(hjrhjpubaubh±)�ry}rz(hUhj[h)X°/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_networkx.py:docstring of planarity.planarity_networkx.kuratowski_subgraphr{h.hµh0}r|(h5]h4]h2]h3]h8]Uentries]r}(h¸X>kuratowski_subgraph() (in module planarity.planarity_networkx)hUtr~auh:Nh;hh<]ubh!)�r}r€(hUhj[h)j{h.hÊh0}r�(h̉hÍXpyh5]h4]h2]h3]h8]hÎXfunctionr‚hÐj‚uh:Nh;hh<]rƒ(hÒ)�r„}r…(hXkuratowski_subgraph(graph)hjh)hÕh.hÖh0}r†(h5]r‡hahÙh*Xplanarity.planarity_networkxrˆ…�r‰}rŠbh4]h2]h3]h8]r‹hahÞXkuratowski_subgraphrŒhàUhá‰uh:Nh;hh<]r�(hã)�rŽ}r�(hXplanarity.planarity_networkx.hj„h)hÕh.hæh0}r�(h2]h3]h4]h5]h8]uh:Nh;hh<]r‘hEXplanarity.planarity_networkx.r’…�r“}r”(hUhjŽubaubhì)�r•}r–(hjŒhj„h)hÕh.hïh0}r—(h2]h3]h4]h5]h8]uh:Nh;hh<]r˜hEXkuratowski_subgraphr™…�rš}r›(hUhj•ubaubhõ)�rœ}r�(hUhj„h)hÕh.høh0}rž(h2]h3]h4]h5]h8]uh:Nh;hh<]rŸhû)�r }r¡(hXgraphh0}r¢(h2]h3]h4]h5]h8]uhjœh<]r£hEXgraphr¤…�r¥}r¦(hUhj ubah.jubaubj)�r§}r¨(hUhj„h)Nh.jh0}r©(Uexprj h5]h4]h2]h3]h8]uh:Nh;hh<]rªj )�r«}r¬(hUh0}r­(UreftypejUrefdocjU refdomainjh5]h4]U refexplicit‰h2]h3]h8]U reftargetX%_modules/planarity/planarity_networkxUrefidjŒuhj§h<]r®j)�r¯}r°(hUh0}r±(h2]h3]r²jah4]h5]h8]uhj«h<]r³hEX[source]r´…�rµ}r¶(hUhj¯ubah.jubah.jubaubeubh)�r·}r¸(hUhjh)hÕh.j!h0}r¹(h2]h3]h4]h5]h8]uh:Nh;hh<]rºhI)�r»}r¼(hX/Return forbidden subgraph of nonplanar graph G.r½hj·h)j{h.hMh0}r¾(h2]h3]h4]h5]h8]uh:Kh;hh<]r¿hEX/Return forbidden subgraph of nonplanar graph G.rÀ…�rÁ}rÂ(hj½hj»ubaubaubeubh±)�rÃ}rÄ(hUhj[h)X©/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_networkx.py:docstring of planarity.planarity_networkx.pgraph_graphrÅh.hµh0}rÆ(h5]h4]h2]h3]h8]Uentries]rÇ(h¸X7pgraph_graph() (in module planarity.planarity_networkx)hUtrÈauh:Nh;hh<]ubh!)�rÉ}rÊ(hUhj[h)jÅh.hÊh0}rË(h̉hÍXpyh5]h4]h2]h3]h8]hÎXfunctionrÌhÐjÌuh:Nh;hh<]rÍ(hÒ)�rÎ}rÏ(hXpgraph_graph(graph)hjÉh)hÕh.hÖh0}rÐ(h5]rÑhahÙh*Xplanarity.planarity_networkxrÒ…�rÓ}rÔbh4]h2]h3]h8]rÕhahÞX pgraph_graphrÖhàUhá‰uh:Nh;hh<]r×(hã)�rØ}rÙ(hXplanarity.planarity_networkx.hjÎh)hÕh.hæh0}rÚ(h2]h3]h4]h5]h8]uh:Nh;hh<]rÛhEXplanarity.planarity_networkx.rÜ…�rÝ}rÞ(hUhjØubaubhì)�rß}rà(hjÖhjÎh)hÕh.hïh0}rá(h2]h3]h4]h5]h8]uh:Nh;hh<]râhEX pgraph_graphrã…�rä}rå(hUhjßubaubhõ)�ræ}rç(hUhjÎh)hÕh.høh0}rè(h2]h3]h4]h5]h8]uh:Nh;hh<]réhû)�rê}rë(hXgraphh0}rì(h2]h3]h4]h5]h8]uhjæh<]ríhEXgraphrî…�rï}rð(hUhjêubah.jubaubj)�rñ}rò(hUhjÎh)Nh.jh0}ró(Uexprj h5]h4]h2]h3]h8]uh:Nh;hh<]rôj )�rõ}rö(hUh0}r÷(UreftypejUrefdocjU refdomainjh5]h4]U refexplicit‰h2]h3]h8]U reftargetX%_modules/planarity/planarity_networkxUrefidjÖuhjñh<]røj)�rù}rú(hUh0}rû(h2]h3]rüjah4]h5]h8]uhjõh<]rýhEX[source]rþ…�rÿ}r(hUhjùubah.jubah.jubaubeubh)�r}r(hUhjÉh)hÕh.j!h0}r(h2]h3]h4]h5]h8]uh:Nh;hh<]rhI)�r}r(hX.Return pgraph graph built from NetworkX graph.rhjh)jÅh.hMh0}r(h2]h3]h4]h5]h8]uh:Kh;hh<]r hEX.Return pgraph graph built from NetworkX graph.r …�r }r (hjhjubaubaubeubh±)�r }r(hUhj[h)X«/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_networkx.py:docstring of planarity.planarity_networkx.networkx_graphrh.hµh0}r(h5]h4]h2]h3]h8]Uentries]r(h¸X9networkx_graph() (in module planarity.planarity_networkx)hUtrauh:Nh;hh<]ubh!)�r}r(hUhj[h)jh.hÊh0}r(h̉hÍXpyh5]h4]h2]h3]h8]hÎXfunctionrhÐjuh:Nh;hh<]r(hÒ)�r}r(hXnetworkx_graph(pgraph)hjh)hÕh.hÖh0}r(h5]rhahÙh*Xplanarity.planarity_networkxr…�r}rbh4]h2]h3]h8]rhahÞXnetworkx_graphr hàUhá‰uh:Nh;hh<]r!(hã)�r"}r#(hXplanarity.planarity_networkx.hjh)hÕh.hæh0}r$(h2]h3]h4]h5]h8]uh:Nh;hh<]r%hEXplanarity.planarity_networkx.r&…�r'}r((hUhj"ubaubhì)�r)}r*(hj hjh)hÕh.hïh0}r+(h2]h3]h4]h5]h8]uh:Nh;hh<]r,hEXnetworkx_graphr-…�r.}r/(hUhj)ubaubhõ)�r0}r1(hUhjh)hÕh.høh0}r2(h2]h3]h4]h5]h8]uh:Nh;hh<]r3hû)�r4}r5(hXpgraphh0}r6(h2]h3]h4]h5]h8]uhj0h<]r7hEXpgraphr8…�r9}r:(hUhj4ubah.jubaubj)�r;}r<(hUhjh)Nh.jh0}r=(Uexprj h5]h4]h2]h3]h8]uh:Nh;hh<]r>j )�r?}r@(hUh0}rA(UreftypejUrefdocjU refdomainjh5]h4]U refexplicit‰h2]h3]h8]U reftargetX%_modules/planarity/planarity_networkxUrefidj uhj;h<]rBj)�rC}rD(hUh0}rE(h2]h3]rFjah4]h5]h8]uhj?h<]rGhEX[source]rH…�rI}rJ(hUhjCubah.jubah.jubaubeubh)�rK}rL(hUhjh)hÕh.j!h0}rM(h2]h3]h4]h5]h8]uh:Nh;hh<]rNhI)�rO}rP(hX2Return NetworkX graph built from planarity pgraph.rQhjKh)jh.hMh0}rR(h2]h3]h4]h5]h8]uh:Kh;hh<]rShEX2Return NetworkX graph built from planarity pgraph.rT…�rU}rV(hjQhjOubaubaubeubh±)�rW}rX(hUhj[h)X¡/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_networkx.py:docstring of planarity.planarity_networkx.drawrYh.hµh0}rZ(h5]h4]h2]h3]h8]Uentries]r[(h¸X/draw() (in module planarity.planarity_networkx)h Utr\auh:Nh;hh<]ubh!)�r]}r^(hUhj[h)jYh.hÊh0}r_(h̉hÍXpyh5]h4]h2]h3]h8]hÎXfunctionr`hÐj`uh:Nh;hh<]ra(hÒ)�rb}rc(hXdraw(graph, labels=True)hj]h)hÕh.hÖh0}rd(h5]reh ahÙh*Xplanarity.planarity_networkxrf…�rg}rhbh4]h2]h3]h8]rih ahÞXdrawrjhàUhá‰uh:Nh;hh<]rk(hã)�rl}rm(hXplanarity.planarity_networkx.hjbh)hÕh.hæh0}rn(h2]h3]h4]h5]h8]uh:Nh;hh<]rohEXplanarity.planarity_networkx.rp…�rq}rr(hUhjlubaubhì)�rs}rt(hjjhjbh)hÕh.hïh0}ru(h2]h3]h4]h5]h8]uh:Nh;hh<]rvhEXdrawrw…�rx}ry(hUhjsubaubhõ)�rz}r{(hUhjbh)hÕh.høh0}r|(h2]h3]h4]h5]h8]uh:Nh;hh<]r}(hû)�r~}r(hXgraphh0}r€(h2]h3]h4]h5]h8]uhjzh<]r�hEXgraphr‚…�rƒ}r„(hUhj~ubah.jubhû)�r…}r†(hX labels=Trueh0}r‡(h2]h3]h4]h5]h8]uhjzh<]rˆhEX labels=Truer‰…�rŠ}r‹(hUhj…ubah.jubeubj)�rŒ}r�(hUhjbh)Nh.jh0}rŽ(Uexprj h5]h4]h2]h3]h8]uh:Nh;hh<]r�j )�r�}r‘(hUh0}r’(UreftypejUrefdocjU refdomainjh5]h4]U refexplicit‰h2]h3]h8]U reftargetX%_modules/planarity/planarity_networkxUrefidjjuhjŒh<]r“j)�r”}r•(hUh0}r–(h2]h3]r—jah4]h5]h8]uhj�h<]r˜hEX[source]r™…�rš}r›(hUhj”ubah.jubah.jubaubeubh)�rœ}r�(hUhj]h)hÕh.j!h0}rž(h2]h3]h4]h5]h8]uh:Nh;hh<]rŸhI)�r }r¡(hX"Draw planar graph with Matplotlib.r¢hjœh)jYh.hMh0}r£(h2]h3]h4]h5]h8]uh:Kh;hh<]r¤hEX"Draw planar graph with Matplotlib.r¥…�r¦}r§(hj¢hj ubaubaubeubeubh%eubh)h,h.h/h0}r¨(h2]h3]h4]h5]r©U wrapper-classrªah8]r«h auh:Kh;hh<]r¬(h>)�r­}r®(hX Wrapper Classr¯hh%h)h,h.hBh0}r°(h2]h3]h4]h5]h8]uh:Kh;hh<]r±hEX Wrapper Classr²…�r³}r´(hj¯hj­ubaubh±)�rµ}r¶(hUhh%h)Nh.hµh0}r·(h5]h4]h2]h3]h8]Uentries]r¸(h¸XPGraph (class in planarity)hUtr¹auh:Nh;hh<]ubh"eubh)Nh.hÊh0}rº(h̉hÍXpyh5]h4]h2]h3]h8]hÎXclassr»hÐj»uh:Nh;hh<]r¼(hÒ)�r½}r¾(hXPGraphr¿hh"h)hÕh.hÖh0}rÀ(h5]rÁhahÙh*X planarityrÂ…�rÃ}rÄbh4]h2]h3]h8]rÅhahÞj¿hàUhá‰uh:Nh;hh<]rÆ(csphinx.addnodes desc_annotation rÇ)�rÈ}rÉ(hXclass hj½h)hÕh.Udesc_annotationrÊh0}rË(h2]h3]h4]h5]h8]uh:Nh;hh<]rÌhEXclass rÍ…�rÎ}rÏ(hUhjÈubaubhã)�rÐ}rÑ(hX planarity.hj½h)hÕh.hæh0}rÒ(h2]h3]h4]h5]h8]uh:Nh;hh<]rÓhEX planarity.rÔ…�rÕ}rÖ(hUhjÐubaubhì)�r×}rØ(hj¿hj½h)hÕh.hïh0}rÙ(h2]h3]h4]h5]h8]uh:Nh;hh<]rÚhEXPGraphrÛ…�rÜ}rÝ(hUhj×ubaubeubheubh)hÕh.j!h0}rÞ(h2]h3]h4]h5]h8]uh:Nh;hh<]rß(cdocutils.nodes rubric rà)�rá}râ(hXMethodsrãhhh)Xdocstring of planarity.PGraphräh.Urubricråh0}ræ(h2]h3]h4]h5]h8]uh:Kh;hh<]rçhEXMethodsrè…�ré}rê(hjãhjáubaubcsphinx.addnodes tabular_col_spec rë)�rì}rí(hUhhh)U rîh.Utabular_col_specrïh0}rð(h5]h4]h2]h3]h8]UspecrñUllròuh:Nh;hh<]ubcsphinx.ext.autosummary autosummary_table ró)�rô}rõ(hUhhh)jîh.Uautosummary_tableröh0}r÷(U xml:spacerøUpreserverùh5]h4]h2]h3]h8]uh:Nh;hh<]rúcdocutils.nodes table rû)�rü}rý(hUh0}rþ(h2]h3]rÿU longtablerah4]h5]h8]uhjôh<]rcdocutils.nodes tgroup r)�r}r(hUh0}r(h5]h4]h2]h3]h8]UcolsKuhjüh<]r(cdocutils.nodes colspec r)�r}r (hUh0}r (h5]h4]h2]h3]h8]UcolwidthK uhjh<]h.Ucolspecr ubj)�r }r (hUh0}r(h5]h4]h2]h3]h8]UcolwidthKZuhjh<]h.j ubcdocutils.nodes tbody r)�r}r(hUh0}r(h2]h3]h4]h5]h8]uhjh<]r(cdocutils.nodes row r)�r}r(hUh0}r(h2]h3]h4]h5]h8]uhjh<]r(cdocutils.nodes entry r)�r}r(hUh0}r(h2]h3]h4]h5]h8]uhjh<]rhI)�r}r(hX:obj:`ascii `\hjh)jîh.hMh0}r (h2]h3]h4]h5]h8]uh:Kh<]r!(j )�r"}r#(hX:obj:`ascii `r$hjh)h,h.jh0}r%(UreftypeXobjUrefwarnr&‰U reftargetr'XasciiU refdomainXpyr(h5]h4]U refexplicitˆh2]h3]h8]Urefdocr)jUpy:classr*j¿U py:moduler+Xplanarity.planarity_networkxr,uh:Kh<]r-cdocutils.nodes literal r.)�r/}r0(hj$h0}r1(h2]h3]r2(Uxrefr3j(Xpy-objr4eh4]h5]h8]uhj"h<]r5hEXasciir6…�r7}r8(hUhj/ubah.Uliteralr9ubaubhEX…�r:}r;(hX\hjubeubah.Uentryr<ubj)�r=}r>(hUh0}r?(h2]h3]h4]h5]h8]uhjh<]r@hI)�rA}rB(hUh0}rC(h2]h3]h4]h5]h8]uhj=h<]h.hMubah.j<ubeh.UrowrDubj)�rE}rF(hUh0}rG(h2]h3]h4]h5]h8]uhjh<]rH(j)�rI}rJ(hUh0}rK(h2]h3]h4]h5]h8]uhjEh<]rLhI)�rM}rN(hX:obj:`edges `\hjIh)jîh.hMh0}rO(h2]h3]h4]h5]h8]uh:Kh<]rP(j )�rQ}rR(hX:obj:`edges `rShjMh)h,h.jh0}rT(UreftypeXobjj&‰j'XedgesU refdomainXpyrUh5]h4]U refexplicitˆh2]h3]h8]j)jj*j¿j+j,uh:Kh<]rVj.)�rW}rX(hjSh0}rY(h2]h3]rZ(j3jUXpy-objr[eh4]h5]h8]uhjQh<]r\hEXedgesr]…�r^}r_(hUhjWubah.j9ubaubhEX…�r`}ra(hX\hjMubeubah.j<ubj)�rb}rc(hUh0}rd(h2]h3]h4]h5]h8]uhjEh<]rehI)�rf}rg(hUh0}rh(h2]h3]h4]h5]h8]uhjbh<]h.hMubah.j<ubeh.jDubj)�ri}rj(hUh0}rk(h2]h3]h4]h5]h8]uhjh<]rl(j)�rm}rn(hUh0}ro(h2]h3]h4]h5]h8]uhjih<]rphI)�rq}rr(hX+:obj:`embed_drawplanar `\hjmh)jîh.hMh0}rs(h2]h3]h4]h5]h8]uh:Kh<]rt(j )�ru}rv(hX*:obj:`embed_drawplanar `rwhjqh)h,h.jh0}rx(UreftypeXobjj&‰j'Xembed_drawplanarU refdomainXpyryh5]h4]U refexplicitˆh2]h3]h8]j)jj*j¿j+j,uh:Kh<]rzj.)�r{}r|(hjwh0}r}(h2]h3]r~(j3jyXpy-objreh4]h5]h8]uhjuh<]r€hEXembed_drawplanarr�…�r‚}rƒ(hUhj{ubah.j9ubaubhEX…�r„}r…(hX\hjqubeubah.j<ubj)�r†}r‡(hUh0}rˆ(h2]h3]h4]h5]h8]uhjih<]r‰hI)�rŠ}r‹(hUh0}rŒ(h2]h3]h4]h5]h8]uhj†h<]h.hMubah.j<ubeh.jDubj)�r�}rŽ(hUh0}r�(h2]h3]h4]h5]h8]uhjh<]r�(j)�r‘}r’(hUh0}r“(h2]h3]h4]h5]h8]uhj�h<]r”hI)�r•}r–(hX#:obj:`embed_planar `\hj‘h)jîh.hMh0}r—(h2]h3]h4]h5]h8]uh:Kh<]r˜(j )�r™}rš(hX":obj:`embed_planar `r›hj•h)h,h.jh0}rœ(UreftypeXobjj&‰j'X embed_planarU refdomainXpyr�h5]h4]U refexplicitˆh2]h3]h8]j)jj*j¿j+j,uh:Kh<]ržj.)�rŸ}r (hj›h0}r¡(h2]h3]r¢(j3j�Xpy-objr£eh4]h5]h8]uhj™h<]r¤hEX embed_planarr¥…�r¦}r§(hUhjŸubah.j9ubaubhEX…�r¨}r©(hX\hj•ubeubah.j<ubj)�rª}r«(hUh0}r¬(h2]h3]h4]h5]h8]uhj�h<]r­hI)�r®}r¯(hUh0}r°(h2]h3]h4]h5]h8]uhjªh<]h.hMubah.j<ubeh.jDubj)�r±}r²(hUh0}r³(h2]h3]h4]h5]h8]uhjh<]r´(j)�rµ}r¶(hUh0}r·(h2]h3]h4]h5]h8]uhj±h<]r¸hI)�r¹}rº(hX:obj:`is_planar `\hjµh)jîh.hMh0}r»(h2]h3]h4]h5]h8]uh:Kh<]r¼(j )�r½}r¾(hX:obj:`is_planar `r¿hj¹h)h,h.jh0}rÀ(UreftypeXobjj&‰j'X is_planarU refdomainXpyrÁh5]h4]U refexplicitˆh2]h3]h8]j)jj*j¿j+j,uh:Kh<]rÂj.)�rÃ}rÄ(hj¿h0}rÅ(h2]h3]rÆ(j3jÁXpy-objrÇeh4]h5]h8]uhj½h<]rÈhEX is_planarrÉ…�rÊ}rË(hUhjÃubah.j9ubaubhEX…�rÌ}rÍ(hX\hj¹ubeubah.j<ubj)�rÎ}rÏ(hUh0}rÐ(h2]h3]h4]h5]h8]uhj±h<]rÑhI)�rÒ}rÓ(hUh0}rÔ(h2]h3]h4]h5]h8]uhjÎh<]h.hMubah.j<ubeh.jDubj)�rÕ}rÖ(hUh0}r×(h2]h3]h4]h5]h8]uhjh<]rØ(j)�rÙ}rÚ(hUh0}rÛ(h2]h3]h4]h5]h8]uhjÕh<]rÜhI)�rÝ}rÞ(hX+:obj:`kuratowski_edges `\hjÙh)jîh.hMh0}rß(h2]h3]h4]h5]h8]uh:Kh<]rà(j )�rá}râ(hX*:obj:`kuratowski_edges `rãhjÝh)h,h.jh0}rä(UreftypeXobjj&‰j'Xkuratowski_edgesU refdomainXpyråh5]h4]U refexplicitˆh2]h3]h8]j)jj*j¿j+j,uh:Kh<]ræj.)�rç}rè(hjãh0}ré(h2]h3]rê(j3jåXpy-objrëeh4]h5]h8]uhjáh<]rìhEXkuratowski_edgesrí…�rî}rï(hUhjçubah.j9ubaubhEX…�rð}rñ(hX\hjÝubeubah.j<ubj)�rò}ró(hUh0}rô(h2]h3]h4]h5]h8]uhjÕh<]rõhI)�rö}r÷(hUh0}rø(h2]h3]h4]h5]h8]uhjòh<]h.hMubah.j<ubeh.jDubj)�rù}rú(hUh0}rû(h2]h3]h4]h5]h8]uhjh<]rü(j)�rý}rþ(hUh0}rÿ(h2]h3]h4]h5]h8]uhjùh<]rhI)�r}r(hX:obj:`mapping `\hjýh)jîh.hMh0}r(h2]h3]h4]h5]h8]uh:Kh<]r(j )�r}r(hX:obj:`mapping `rhjh)h,h.jh0}r(UreftypeXobjj&‰j'XmappingU refdomainXpyr h5]h4]U refexplicitˆh2]h3]h8]j)jj*j¿j+j,uh:Kh<]r j.)�r }r (hjh0}r (h2]h3]r(j3j Xpy-objreh4]h5]h8]uhjh<]rhEXmappingr…�r}r(hUhj ubah.j9ubaubhEX…�r}r(hX\hjubeubah.j<ubj)�r}r(hUh0}r(h2]h3]h4]h5]h8]uhjùh<]rhI)�r}r(hUh0}r(h2]h3]h4]h5]h8]uhjh<]h.hMubah.j<ubeh.jDubj)�r}r(hUh0}r(h2]h3]h4]h5]h8]uhjh<]r (j)�r!}r"(hUh0}r#(h2]h3]h4]h5]h8]uhjh<]r$hI)�r%}r&(hX:obj:`nodes `\hj!h)jîh.hMh0}r'(h2]h3]h4]h5]h8]uh:Kh<]r((j )�r)}r*(hX:obj:`nodes `r+hj%h)h,h.jh0}r,(UreftypeXobjj&‰j'XnodesU refdomainXpyr-h5]h4]U refexplicitˆh2]h3]h8]j)jj*j¿j+j,uh:Kh<]r.j.)�r/}r0(hj+h0}r1(h2]h3]r2(j3j-Xpy-objr3eh4]h5]h8]uhj)h<]r4hEXnodesr5…�r6}r7(hUhj/ubah.j9ubaubhEX…�r8}r9(hX\hj%ubeubah.j<ubj)�r:}r;(hUh0}r<(h2]h3]h4]h5]h8]uhjh<]r=hI)�r>}r?(hUh0}r@(h2]h3]h4]h5]h8]uhj:h<]h.hMubah.j<ubeh.jDubj)�rA}rB(hUh0}rC(h2]h3]h4]h5]h8]uhjh<]rD(j)�rE}rF(hUh0}rG(h2]h3]h4]h5]h8]uhjAh<]rHhI)�rI}rJ(hX:obj:`write `\hjEh)jîh.hMh0}rK(h2]h3]h4]h5]h8]uh:Kh<]rL(j )�rM}rN(hX:obj:`write `rOhjIh)h,h.jh0}rP(UreftypeXobjj&‰j'XwriteU refdomainXpyrQh5]h4]U refexplicitˆh2]h3]h8]j)jj*j¿j+j,uh:Kh<]rRj.)�rS}rT(hjOh0}rU(h2]h3]rV(j3jQXpy-objrWeh4]h5]h8]uhjMh<]rXhEXwriterY…�rZ}r[(hUhjSubah.j9ubaubhEX…�r\}r](hX\hjIubeubah.j<ubj)�r^}r_(hUh0}r`(h2]h3]h4]h5]h8]uhjAh<]rahI)�rb}rc(hUh0}rd(h2]h3]h4]h5]h8]uhj^h<]h.hMubah.j<ubeh.jDubeh.Utbodyreubeh.Utgrouprfubah.Utablergubaubcsphinx.ext.autosummary autosummary_toc rh)�ri}rj(hUhhh)jîh.Uautosummary_tocrkh0}rl(jøjùh5]h4]h2]h3]h8]uh:Nh;hh<]rmcsphinx.addnodes toctree rn)�ro}rp(hUh0}rq(UglobrrNh5]h4]h2]h3]h8]Uentriesrs]rt(NXasciiru†rvNXedgesrw†rxNXembed_drawplanarry†rzNX embed_planarr{†r|NX is_planarr}†r~NXkuratowski_edgesr†r€NXmappingr�†r‚NXnodesrƒ†r„NXwriter…†r†eU includefilesr‡]rˆ(jujwjyj{j}jj�jƒj…eUmaxdepthr‰Jÿÿÿÿuhjih<]h.UtoctreerŠubaubeubh)jîh.Usystem_messager‹h0}rŒ(h2]UlevelKh5]h4]Usourceh,h3]h8]UlineK UtypeUWARNINGr�uh:Nh;hh<]rŽhI)�r�}r�(hUh0}r‘(h2]h3]h4]h5]h8]uhhh<]r’hEXfailed to import asciir“…�r”}r•(hUhj�ubah.hMubaubh)�r–}r—(hUhhh)jîh.j‹h0}r˜(h2]UlevelKh5]h4]Usourceh,h3]h8]UlineK Utypej�uh:Nh;hh<]r™hI)�rš}r›(hUh0}rœ(h2]h3]h4]h5]h8]uhj–h<]r�hEXfailed to import edgesrž…�rŸ}r (hUhjšubah.hMubaubh)�r¡}r¢(hUhhh)jîh.j‹h0}r£(h2]UlevelKh5]h4]Usourceh,h3]h8]UlineK Utypej�uh:Nh;hh<]r¤hI)�r¥}r¦(hUh0}r§(h2]h3]h4]h5]h8]uhj¡h<]r¨hEX!failed to import embed_drawplanarr©…�rª}r«(hUhj¥ubah.hMubaubh)�r¬}r­(hUhhh)jîh.j‹h0}r®(h2]UlevelKh5]h4]Usourceh,h3]h8]UlineK Utypej�uh:Nh;hh<]r¯hI)�r°}r±(hUh0}r²(h2]h3]h4]h5]h8]uhj¬h<]r³hEXfailed to import embed_planarr´…�rµ}r¶(hUhj°ubah.hMubaubh)�r·}r¸(hUhhh)jîh.j‹h0}r¹(h2]UlevelKh5]h4]Usourceh,h3]h8]UlineK Utypej�uh:Nh;hh<]rºhI)�r»}r¼(hUh0}r½(h2]h3]h4]h5]h8]uhj·h<]r¾hEXfailed to import is_planarr¿…�rÀ}rÁ(hUhj»ubah.hMubaubh)�rÂ}rÃ(hUhhh)jîh.j‹h0}rÄ(h2]UlevelKh5]h4]Usourceh,h3]h8]UlineK Utypej�uh:Nh;hh<]rÅhI)�rÆ}rÇ(hUh0}rÈ(h2]h3]h4]h5]h8]uhjÂh<]rÉhEX!failed to import kuratowski_edgesrÊ…�rË}rÌ(hUhjÆubah.hMubaubh)�rÍ}rÎ(hUhhh)jîh.j‹h0}rÏ(h2]UlevelKh5]h4]Usourceh,h3]h8]UlineK Utypej�uh:Nh;hh<]rÐhI)�rÑ}rÒ(hUh0}rÓ(h2]h3]h4]h5]h8]uhjÍh<]rÔhEXfailed to import mappingrÕ…�rÖ}r×(hUhjÑubah.hMubaubh)�rØ}rÙ(hUhhh)jîh.j‹h0}rÚ(h2]UlevelKh5]h4]Usourceh,h3]h8]UlineK Utypej�uh:Nh;hh<]rÛhI)�rÜ}rÝ(hUh0}rÞ(h2]h3]h4]h5]h8]uhjØh<]rßhEXfailed to import nodesrà…�rá}râ(hUhjÜubah.hMubaubh)�rã}rä(hUhhh)jîh.j‹h0}rå(h2]UlevelKh5]h4]Usourceh,h3]h8]UlineK Utypej�uh:Nh;hh<]ræhI)�rç}rè(hUh0}ré(h2]h3]h4]h5]h8]uhjãh<]rêhEXfailed to import writerë…�rì}rí(hUhjçubah.hMubaubh)�rî}rï(hUhhh)jîh.j‹h0}rð(h2]UlevelKh5]h4]Usourceh,h3]h8]UlineK Utypej�uh:Nh;hh<]rñhI)�rò}ró(hUh0}rô(h2]h3]h4]h5]h8]uhjîh<]rõhEX,toctree references unknown document u'ascii'rö…�r÷}rø(hUhjòubah.hMubaubh)�rù}rú(hUhhh)jîh.j‹h0}rû(h2]UlevelKh5]h4]Usourceh,h3]h8]UlineK Utypej�uh:Nh;hh<]rühI)�rý}rþ(hUh0}rÿ(h2]h3]h4]h5]h8]uhjùh<]rhEX,toctree references unknown document u'edges'r…�r}r(hUhjýubah.hMubaubh)�r}r(hUhhh)jîh.j‹h0}r(h2]UlevelKh5]h4]Usourceh,h3]h8]UlineK Utypej�uh:Nh;hh<]rhI)�r}r (hUh0}r (h2]h3]h4]h5]h8]uhjh<]r hEX7toctree references unknown document u'embed_drawplanar'r …�r }r(hUhjubah.hMubaubh)�r}r(hUhhh)jîh.j‹h0}r(h2]UlevelKh5]h4]Usourceh,h3]h8]UlineK Utypej�uh:Nh;hh<]rhI)�r}r(hUh0}r(h2]h3]h4]h5]h8]uhjh<]rhEX3toctree references unknown document u'embed_planar'r…�r}r(hUhjubah.hMubaubh)�r}r(hUhhh)jîh.j‹h0}r(h2]UlevelKh5]h4]Usourceh,h3]h8]UlineK Utypej�uh:Nh;hh<]rhI)�r}r(hUh0}r (h2]h3]h4]h5]h8]uhjh<]r!hEX0toctree references unknown document u'is_planar'r"…�r#}r$(hUhjubah.hMubaubh)�r%}r&(hUhhh)jîh.j‹h0}r'(h2]UlevelKh5]h4]Usourceh,h3]h8]UlineK Utypej�uh:Nh;hh<]r(hI)�r)}r*(hUh0}r+(h2]h3]h4]h5]h8]uhj%h<]r,hEX7toctree references unknown document u'kuratowski_edges'r-…�r.}r/(hUhj)ubah.hMubaubh)�r0}r1(hUhhh)jîh.j‹h0}r2(h2]UlevelKh5]h4]Usourceh,h3]h8]UlineK Utypej�uh:Nh;hh<]r3hI)�r4}r5(hUh0}r6(h2]h3]h4]h5]h8]uhj0h<]r7hEX.toctree references unknown document u'mapping'r8…�r9}r:(hUhj4ubah.hMubaubh)�r;}r<(hUhhh)jîh.j‹h0}r=(h2]UlevelKh5]h4]Usourceh,h3]h8]UlineK Utypej�uh:Nh;hh<]r>hI)�r?}r@(hUh0}rA(h2]h3]h4]h5]h8]uhj;h<]rBhEX,toctree references unknown document u'nodes'rC…�rD}rE(hUhj?ubah.hMubaubh)�rF}rG(hUhhh)jîh.j‹h0}rH(h2]UlevelKh5]h4]Usourceh,h3]h8]UlineK Utypej�uh:Nh;hh<]rIhI)�rJ}rK(hUh0}rL(h2]h3]h4]h5]h8]uhjFh<]rMhEX,toctree references unknown document u'write'rN…�rO}rP(hUhjJubah.hMubaubh)�rQ}rR(hUhh%h)h,h.j‹h0}rS(h2]UlevelKh5]h4]Usourceh,h3]h8]UlineK#Utypej�uh:K%h;hh<]rThI)�rU}rV(hUh0}rW(h2]h3]h4]h5]h8]uhjQh<]rXhEX§don't know which module to import for autodocumenting u'ascii' (try placing a "module" or "currentmodule" directive in the document, or giving an explicit module name)rY…�rZ}r[(hUhjUubah.hMubaubeUcurrent_sourcer\NU decorationr]NUautofootnote_startr^KUnameidsr_}r`(hh7hh¦hhh jªh h h h h h h h hhhj`hhhhhhhUindices-and-tablesrahhuh<]rb(cdocutils.nodes comment rc)�rd}re(hXÎplanarity documentation master file, created by sphinx-quickstart on Thu Jun 30 15:49:39 2011. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive.hhh)h,h.Ucommentrfh0}rg(jøjùh5]h4]h2]h3]h8]uh:Kh;hh<]rhhEXÎplanarity documentation master file, created by sphinx-quickstart on Thu Jun 30 15:49:39 2011. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive.ri…�rj}rk(hUhjdubaubh'h$)�rl}rm(hUhhh)h,h.h/h0}rn(h2]h3]h4]h5]rojaah8]rphauh:K'h;hh<]rq(h>)�rr}rs(hXIndices and tablesrthjlh)h,h.hBh0}ru(h2]h3]h4]h5]h8]uh:K'h;hh<]rvhEXIndices and tablesrw…�rx}ry(hjthjrubaubcdocutils.nodes bullet_list rz)�r{}r|(hUhjlh)h,h.U bullet_listr}h0}r~(UbulletrX*h5]h4]h2]h3]h8]uh:K)h;hh<]r€(cdocutils.nodes list_item r�)�r‚}rƒ(hX:ref:`genindex`r„hj{h)h,h.U list_itemr…h0}r†(h2]h3]h4]h5]h8]uh:Nh;hh<]r‡hI)�rˆ}r‰(hj„hj‚h)h,h.hMh0}rŠ(h2]h3]h4]h5]h8]uh:K)h<]r‹j )�rŒ}r�(hj„hjˆh)h,h.jh0}rŽ(UreftypeXrefj&ˆj'XgenindexU refdomainXstdr�h5]h4]U refexplicit‰h2]h3]h8]j)juh:K)h<]r�cdocutils.nodes emphasis r‘)�r’}r“(hj„h0}r”(h2]h3]r•(j3j�Xstd-refr–eh4]h5]h8]uhjŒh<]r—hEXgenindexr˜…�r™}rš(hUhj’ubah.Uemphasisr›ubaubaubaubj�)�rœ}r�(hX:ref:`modindex`ržhj{h)h,h.j…h0}rŸ(h2]h3]h4]h5]h8]uh:Nh;hh<]r hI)�r¡}r¢(hjžhjœh)h,h.hMh0}r£(h2]h3]h4]h5]h8]uh:K*h<]r¤j )�r¥}r¦(hjžhj¡h)h,h.jh0}r§(UreftypeXrefj&ˆj'XmodindexU refdomainXstdr¨h5]h4]U refexplicit‰h2]h3]h8]j)juh:K*h<]r©j‘)�rª}r«(hjžh0}r¬(h2]h3]r­(j3j¨Xstd-refr®eh4]h5]h8]uhj¥h<]r¯hEXmodindexr°…�r±}r²(hUhjªubah.j›ubaubaubaubj�)�r³}r´(hX:ref:`search` hj{h)h,h.j…h0}rµ(h2]h3]h4]h5]h8]uh:Nh;hh<]r¶hI)�r·}r¸(hX :ref:`search`r¹hj³h)h,h.hMh0}rº(h2]h3]h4]h5]h8]uh:K+h<]r»j )�r¼}r½(hj¹hj·h)h,h.jh0}r¾(UreftypeXrefj&ˆj'XsearchU refdomainXstdr¿h5]h4]U refexplicit‰h2]h3]h8]j)juh:K+h<]rÀj‘)�rÁ}rÂ(hj¹h0}rÃ(h2]h3]rÄ(j3j¿Xstd-refrÅeh4]h5]h8]uhj¼h<]rÆhEXsearchrÇ…�rÈ}rÉ(hUhjÁubah.j›ubaubaubaubeubeubehUU transformerrÊNU footnote_refsrË}rÌUrefnamesrÍ}rÎUsymbol_footnotesrÏ]rÐUautofootnote_refsrÑ]rÒUsymbol_footnote_refsrÓ]rÔU citationsrÕ]rÖh;hU current_liner×NUtransform_messagesrØ]rÙUreporterrÚNUid_startrÛKU autofootnotesrÜ]rÝU citation_refsrÞ}rßUindirect_targetsrà]ráUsettingsrâ(cdocutils.frontend Values rãorä}rå(Ufootnote_backlinksræKUrecord_dependenciesrçNU rfc_base_urlrèUhttp://tools.ietf.org/html/réU tracebackrêKUpep_referencesrëNUstrip_commentsrìNU toc_backlinksríj<U language_coderîUenrïU datestamprðNU report_levelrñKU _destinationròNU halt_levelróKU strip_classesrôNhBNUerror_encoding_error_handlerrõUbackslashreplaceröUdebugr÷NUembed_stylesheetrø‰Uoutput_encoding_error_handlerrùUstrictrúU sectnum_xformrûKUdump_transformsrüNU docinfo_xformrýKUwarning_streamrþNUpep_file_url_templaterÿUpep-%04drUexit_status_levelrKUconfigrNUstrict_visitorrNUcloak_email_addressesrˆUtrim_footnote_reference_spacer‰UenvrNUdump_pseudo_xmlrNUexpose_internalsrNUsectsubtitle_xformr ‰U source_linkr NUrfc_referencesr NUoutput_encodingr Uutf-8r U source_urlrNUinput_encodingrU utf-8-sigrU_disable_configrNU id_prefixrUU tab_widthrKUerror_encodingrUUTF-8rU_sourcerU;/home/aric/Software/Projects/planarity/doc/source/index.rstrUgettext_compactrˆU generatorrNUdump_internalsrNU pep_base_urlrUhttp://www.python.org/dev/peps/rUinput_encoding_error_handlerrjúUauto_id_prefixrUidrUdoctitle_xformr ‰Ustrip_elements_with_classesr!NU _config_filesr"]Ufile_insertion_enabledr#ˆU raw_enabledr$KU dump_settingsr%NubUsymbol_footnote_startr&KUidsr'}r((h7h'h¦h¡hjÎjajlh j�j`j[h jbh jh hÓh¥cdocutils.nodes target r))�r*}r+(hUhh¡h)h´h.Utargetr,h0}r-(h2]h5]r.h¥ah4]Uismodˆh3]h8]uh:Kh;hh<]ubhjËhj„j_j))�r/}r0(hUhj[h)h´h.j,h0}r1(h2]h5]r2j_ah4]Uismodˆh3]h8]uh:Kh;hh<]ubhj7hj½jªh%hjuUsubstitution_namesr3}r4h.h;h0}r5(h2]h5]h4]Usourceh,h3]h8]uU footnotesr6]r7Urefidsr8}r9ub.graph-algorithms-planarity-08d7b51/doc/build/doctrees/reference/000077500000000000000000000000001522057144000247315ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/doc/build/doctrees/reference/index.doctree000066400000000000000000001254601522057144000274170ustar00rootroot00000000000000€cdocutils.nodes document q)�q}q(U nametypesq}q(X functionsqNX)planarity.planarity_networkx.pgraph_graphqKX wrapper classqNX referenceq NX#planarity.planarity_functions.asciiq KX!planarity.planarity_networkx.drawq KX%planarity.planarity_functions.mappingq KX'planarity.planarity_functions.is_planarq KX#planarity.planarity_functions.writeqKXnetworkx interfaceqNX0planarity.planarity_networkx.kuratowski_subgraphqKX.planarity.planarity_functions.kuratowski_edgesqKXplanarity.PGraphqKX+planarity.planarity_networkx.networkx_graphqKuUsubstitution_defsq}qUparse_messagesq]q(cdocutils.nodes system_message q)�q}q(U rawsourceqUU attributesq}q(Udupnamesq]UlevelKUidsq]Ubackrefsq ]UsourceU q!Uclassesq"]Unamesq#]UlineKUtypeUWARNINGq$uUchildrenq%]q&cdocutils.nodes paragraph q')�q(}q)(hUh}q*(h]h"]h ]h]h#]uUparentq+hh%]q,cdocutils.nodes Text q-Xµduplicate object description of planarity.planarity_functions.is_planar, other instance in /home/aric/Software/Projects/planarity/doc/source/index.rst, use :noindex: for one of themq.…�q/}q0(hUh+h(ubaUtagnameq1U paragraphq2ubah1Usystem_messageq3ubh)�q4}q5(hUh}q6(h]UlevelKh]h ]Usourceh!h"]h#]UlineKUtypeh$uh%]q7h')�q8}q9(hUh}q:(h]h"]h ]h]h#]uh+h4h%]q;h-X¼duplicate object description of planarity.planarity_functions.kuratowski_edges, other instance in /home/aric/Software/Projects/planarity/doc/source/index.rst, use :noindex: for one of themq<…�q=}q>(hUh+h8ubah1h2ubah1h3ubh)�q?}q@(hUh}qA(h]UlevelKh]h ]Usourceh!h"]h#]UlineKUtypeh$uh%]qBh')�qC}qD(hUh}qE(h]h"]h ]h]h#]uh+h?h%]qFh-X±duplicate object description of planarity.planarity_functions.ascii, other instance in /home/aric/Software/Projects/planarity/doc/source/index.rst, use :noindex: for one of themqG…�qH}qI(hUh+hCubah1h2ubah1h3ubh)�qJ}qK(hUh}qL(h]UlevelKh]h ]Usourceh!h"]h#]UlineKUtypeh$uh%]qMh')�qN}qO(hUh}qP(h]h"]h ]h]h#]uh+hJh%]qQh-X±duplicate object description of planarity.planarity_functions.write, other instance in /home/aric/Software/Projects/planarity/doc/source/index.rst, use :noindex: for one of themqR…�qS}qT(hUh+hNubah1h2ubah1h3ubh)�qU}qV(hUh}qW(h]UlevelKh]h ]Usourceh!h"]h#]UlineKUtypeh$uh%]qXh')�qY}qZ(hUh}q[(h]h"]h ]h]h#]uh+hUh%]q\h-X³duplicate object description of planarity.planarity_functions.mapping, other instance in /home/aric/Software/Projects/planarity/doc/source/index.rst, use :noindex: for one of themq]…�q^}q_(hUh+hYubah1h2ubah1h3ubh)�q`}qa(hUh}qb(h]UlevelKh]h ]Usourceh!h"]h#]UlineKUtypeh$uh%]qch')�qd}qe(hUh}qf(h]h"]h ]h]h#]uh+h`h%]qgh-X¾duplicate object description of planarity.planarity_networkx.kuratowski_subgraph, other instance in /home/aric/Software/Projects/planarity/doc/source/index.rst, use :noindex: for one of themqh…�qi}qj(hUh+hdubah1h2ubah1h3ubh)�qk}ql(hUh}qm(h]UlevelKh]h ]Usourceh!h"]h#]UlineKUtypeh$uh%]qnh')�qo}qp(hUh}qq(h]h"]h ]h]h#]uh+hkh%]qrh-X·duplicate object description of planarity.planarity_networkx.pgraph_graph, other instance in /home/aric/Software/Projects/planarity/doc/source/index.rst, use :noindex: for one of themqs…�qt}qu(hUh+houbah1h2ubah1h3ubh)�qv}qw(hUh}qx(h]UlevelKh]h ]Usourceh!h"]h#]UlineKUtypeh$uh%]qyh')�qz}q{(hUh}q|(h]h"]h ]h]h#]uh+hvh%]q}h-X¹duplicate object description of planarity.planarity_networkx.networkx_graph, other instance in /home/aric/Software/Projects/planarity/doc/source/index.rst, use :noindex: for one of themq~…�q}q€(hUh+hzubah1h2ubah1h3ubh)�q�}q‚(hUh}qƒ(h]UlevelKh]h ]Usourceh!h"]h#]UlineKUtypeh$uh%]q„h')�q…}q†(hUh}q‡(h]h"]h ]h]h#]uh+h�h%]qˆh-X¯duplicate object description of planarity.planarity_networkx.draw, other instance in /home/aric/Software/Projects/planarity/doc/source/index.rst, use :noindex: for one of themq‰…�qŠ}q‹(hUh+h…ubah1h2ubah1h3ubh)�qŒ}q�(hUh}qŽ(h]UlevelKh]h ]Usourceh!h"]h#]UlineKUtypeh$uh%]q�h')�q�}q‘(hUh}q’(h]h"]h ]h]h#]uh+hŒh%]q“h-Xžduplicate object description of planarity.PGraph, other instance in /home/aric/Software/Projects/planarity/doc/source/index.rst, use :noindex: for one of themq”…�q•}q–(hUh+h�ubah1h2ubah1h3ubh)�q—}q˜(hUh+csphinx.addnodes desc_content q™)�qš}q›(hUh+csphinx.addnodes desc qœ)�q�}qž(hUh+cdocutils.nodes section qŸ)�q }q¡(hUh+hŸ)�q¢}q£(hUh+hUsourceq¤cdocutils.nodes reprunicode q¥XE/home/aric/Software/Projects/planarity/doc/source/reference/index.rstq¦…�q§}q¨bh1Usectionq©h}qª(h]h"]h ]h]q«U referenceq¬ah#]q­h auUlineq®KUdocumentq¯hh%]q°(cdocutils.nodes title q±)�q²}q³(hX Referenceq´h+h¢h¤h§h1Utitleqµh}q¶(h]h"]h ]h]h#]uh®Kh¯hh%]q·h-X Referenceq¸…�q¹}qº(hh´h+h²ubaubcdocutils.nodes field_list q»)�q¼}q½(hUh+h¢h¤h§h1U field_listq¾h}q¿(h]h"]h ]h]h#]uh®Kh¯hh%]qÀ(cdocutils.nodes field qÁ)�qÂ}qÃ(hUh+h¼h¤h§h1UfieldqÄh}qÅ(h]h"]h ]h]h#]uh®Kh¯hh%]qÆ(cdocutils.nodes field_name qÇ)�qÈ}qÉ(hXReleaseqÊh}qË(h]h"]h ]h]h#]uh+hÂh%]qÌh-XReleaseqÍ…�qÎ}qÏ(hhÊh+hÈubah1U field_nameqÐubcdocutils.nodes field_body qÑ)�qÒ}qÓ(hX |version|qÔh}qÕ(h]h"]h ]h]h#]uh+hÂh%]qÖh')�q×}qØ(hhÔh+hÒh¤h§h1h2h}qÙ(h]h"]h ]h]h#]uh®Kh%]qÚh-X0.3qÛ…�qÜ}qÝ(hU0.3qÞh+h×ubaubah1U field_bodyqßubeubhÁ)�qà}qá(hUh+h¼h¤h§h1hÄh}qâ(h]h"]h ]h]h#]uh®Kh¯hh%]qã(hÇ)�qä}qå(hXDateqæh}qç(h]h"]h ]h]h#]uh+hàh%]qèh-XDateqé…�qê}që(hhæh+häubah1hÐubhÑ)�qì}qí(hX|today| h}qî(h]h"]h ]h]h#]uh+hàh%]qïh')�qð}qñ(hX|today|qòh+hìh¤h§h1h2h}qó(h]h"]h ]h]h#]uh®Kh%]qôh-X June 09, 2013qõ…�qö}q÷(hX June 09, 2013h+hðubaubah1hßubeubeubhŸ)�qø}qù(hUh+h¢h¤h§h1h©h}qú(h]h"]h ]h]qû(X$module-planarity.planarity_functionsqüU functionsqýeh#]qþhauh®K h¯hh%]qÿ(h±)�r}r(hX Functionsrh+høh¤h§h1hµh}r(h]h"]h ]h]h#]uh®K h¯hh%]rh-X Functionsr…�r}r(hjh+jubaubcsphinx.addnodes index r)�r }r (hUh+høh¤U r h1Uindexr h}r (h]h ]h]h"]h#]Uentries]r(UsinglerX&planarity.planarity_functions (module)X$module-planarity.planarity_functionsUtrauh®Kh¯hh%]ubh')�r}r(hX"Functional interface to planarity.rh+høh¤Xž/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_functions.py:docstring of planarity.planarity_functionsrh1h2h}r(h]h"]h ]h]h#]uh®Kh¯hh%]rh-X"Functional interface to planarity.r…�r}r(hjh+jubaubj)�r}r(hUh+høh¤X¨/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_functions.py:docstring of planarity.planarity_functions.is_planarrh1j h}r(h]h ]h]h"]h#]Uentries]r(jX5is_planar() (in module planarity.planarity_functions)h Utrauh®Nh¯hh%]ubhœ)�r }r!(hUh+høh¤jh1Udescr"h}r#(Unoindexr$‰Udomainr%Xpyh]h ]h]h"]h#]Uobjtyper&Xfunctionr'Udesctyper(j'uh®Nh¯hh%]r)(csphinx.addnodes desc_signature r*)�r+}r,(hXis_planar(graph)h+j h¤h!h1Udesc_signaturer-h}r.(h]r/h aUmoduler0h¥Xplanarity.planarity_functionsr1…�r2}r3bh ]h]h"]h#]r4h aUfullnamer5X is_planarr6Uclassr7UUfirstr8‰uh®Nh¯hh%]r9(csphinx.addnodes desc_addname r:)�r;}r<(hXplanarity.planarity_functions.h+j+h¤h!h1U desc_addnamer=h}r>(h]h"]h ]h]h#]uh®Nh¯hh%]r?h-Xplanarity.planarity_functions.r@…�rA}rB(hUh+j;ubaubcsphinx.addnodes desc_name rC)�rD}rE(hj6h+j+h¤h!h1U desc_namerFh}rG(h]h"]h ]h]h#]uh®Nh¯hh%]rHh-X is_planarrI…�rJ}rK(hUh+jDubaubcsphinx.addnodes desc_parameterlist rL)�rM}rN(hUh+j+h¤h!h1Udesc_parameterlistrOh}rP(h]h"]h ]h]h#]uh®Nh¯hh%]rQcsphinx.addnodes desc_parameter rR)�rS}rT(hXgraphh}rU(h]h"]h ]h]h#]uh+jMh%]rVh-XgraphrW…�rX}rY(hUh+jSubah1Udesc_parameterrZubaubcsphinx.addnodes only r[)�r\}r](hUh+j+h¤Nh1Uonlyr^h}r_(UexprUhtmlr`h]h ]h]h"]h#]uh®Nh¯hh%]racsphinx.addnodes pending_xref rb)�rc}rd(hUh}re(UreftypeUviewcoderfUrefdocXreference/indexrgU refdomainUstdrhh]h ]U refexplicit‰h]h"]h#]U reftargetX&_modules/planarity/planarity_functionsUrefidj6uh+j\h%]ricdocutils.nodes inline rj)�rk}rl(hUh}rm(h]h"]rnU viewcode-linkroah ]h]h#]uh+jch%]rph-X[source]rq…�rr}rs(hUh+jkubah1Uinlinertubah1U pending_xrefruubaubeubh™)�rv}rw(hUh+j h¤h!h1U desc_contentrxh}ry(h]h"]h ]h]h#]uh®Nh¯hh%]rzh')�r{}r|(hXTest planarity of graph.r}h+jvh¤jh1h2h}r~(h]h"]h ]h]h#]uh®Kh¯hh%]rh-XTest planarity of graph.r€…�r�}r‚(hj}h+j{ubaubaubeubj)�rƒ}r„(hUh+høh¤X¯/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_functions.py:docstring of planarity.planarity_functions.kuratowski_edgesr…h1j h}r†(h]h ]h]h"]h#]Uentries]r‡(jX<kuratowski_edges() (in module planarity.planarity_functions)hUtrˆauh®Nh¯hh%]ubhœ)�r‰}rŠ(hUh+høh¤j…h1j"h}r‹(j$‰j%Xpyh]h ]h]h"]h#]j&XfunctionrŒj(jŒuh®Nh¯hh%]r�(j*)�rŽ}r�(hXkuratowski_edges(graph)h+j‰h¤h!h1j-h}r�(h]r‘haj0h¥Xplanarity.planarity_functionsr’…�r“}r”bh ]h]h"]h#]r•haj5Xkuratowski_edgesr–j7Uj8‰uh®Nh¯hh%]r—(j:)�r˜}r™(hXplanarity.planarity_functions.h+jŽh¤h!h1j=h}rš(h]h"]h ]h]h#]uh®Nh¯hh%]r›h-Xplanarity.planarity_functions.rœ…�r�}rž(hUh+j˜ubaubjC)�rŸ}r (hj–h+jŽh¤h!h1jFh}r¡(h]h"]h ]h]h#]uh®Nh¯hh%]r¢h-Xkuratowski_edgesr£…�r¤}r¥(hUh+jŸubaubjL)�r¦}r§(hUh+jŽh¤h!h1jOh}r¨(h]h"]h ]h]h#]uh®Nh¯hh%]r©jR)�rª}r«(hXgraphh}r¬(h]h"]h ]h]h#]uh+j¦h%]r­h-Xgraphr®…�r¯}r°(hUh+jªubah1jZubaubj[)�r±}r²(hUh+jŽh¤Nh1j^h}r³(Uexprj`h]h ]h]h"]h#]uh®Nh¯hh%]r´jb)�rµ}r¶(hUh}r·(UreftypejfUrefdocjgU refdomainjhh]h ]U refexplicit‰h]h"]h#]U reftargetX&_modules/planarity/planarity_functionsUrefidj–uh+j±h%]r¸jj)�r¹}rº(hUh}r»(h]h"]r¼joah ]h]h#]uh+jµh%]r½h-X[source]r¾…�r¿}rÀ(hUh+j¹ubah1jtubah1juubaubeubh™)�rÁ}rÂ(hUh+j‰h¤h!h1jxh}rÃ(h]h"]h ]h]h#]uh®Nh¯hh%]rÄh')�rÅ}rÆ(hX7Return edges of forbidden subgraph of non-planar graph.rÇh+jÁh¤j…h1h2h}rÈ(h]h"]h ]h]h#]uh®Kh¯hh%]rÉh-X7Return edges of forbidden subgraph of non-planar graph.rÊ…�rË}rÌ(hjÇh+jÅubaubaubeubj)�rÍ}rÎ(hUh+høh¤X¤/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_functions.py:docstring of planarity.planarity_functions.asciirÏh1j h}rÐ(h]h ]h]h"]h#]Uentries]rÑ(jX1ascii() (in module planarity.planarity_functions)h UtrÒauh®Nh¯hh%]ubhœ)�rÓ}rÔ(hUh+høh¤jÏh1j"h}rÕ(j$‰j%Xpyh]h ]h]h"]h#]j&XfunctionrÖj(jÖuh®Nh¯hh%]r×(j*)�rØ}rÙ(hX ascii(graph)h+jÓh¤h!h1j-h}rÚ(h]rÛh aj0h¥Xplanarity.planarity_functionsrÜ…�rÝ}rÞbh ]h]h"]h#]rßh aj5Xasciiràj7Uj8‰uh®Nh¯hh%]rá(j:)�râ}rã(hXplanarity.planarity_functions.h+jØh¤h!h1j=h}rä(h]h"]h ]h]h#]uh®Nh¯hh%]råh-Xplanarity.planarity_functions.ræ…�rç}rè(hUh+jâubaubjC)�ré}rê(hjàh+jØh¤h!h1jFh}rë(h]h"]h ]h]h#]uh®Nh¯hh%]rìh-Xasciirí…�rî}rï(hUh+jéubaubjL)�rð}rñ(hUh+jØh¤h!h1jOh}rò(h]h"]h ]h]h#]uh®Nh¯hh%]rójR)�rô}rõ(hXgraphh}rö(h]h"]h ]h]h#]uh+jðh%]r÷h-Xgraphrø…�rù}rú(hUh+jôubah1jZubaubj[)�rû}rü(hUh+jØh¤Nh1j^h}rý(Uexprj`h]h ]h]h"]h#]uh®Nh¯hh%]rþjb)�rÿ}r(hUh}r(UreftypejfUrefdocjgU refdomainjhh]h ]U refexplicit‰h]h"]h#]U reftargetX&_modules/planarity/planarity_functionsUrefidjàuh+jûh%]rjj)�r}r(hUh}r(h]h"]rjoah ]h]h#]uh+jÿh%]rh-X[source]r…�r }r (hUh+jubah1jtubah1juubaubeubh™)�r }r (hUh+jÓh¤h!h1jxh}r (h]h"]h ]h]h#]uh®Nh¯hh%]rh')�r}r(hX+Draw text representation of a planar graph.rh+j h¤jÏh1h2h}r(h]h"]h ]h]h#]uh®Kh¯hh%]rh-X+Draw text representation of a planar graph.r…�r}r(hjh+jubaubaubeubj)�r}r(hUh+høh¤X¤/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_functions.py:docstring of planarity.planarity_functions.writerh1j h}r(h]h ]h]h"]h#]Uentries]r(jX1write() (in module planarity.planarity_functions)hUtrauh®Nh¯hh%]ubhœ)�r}r(hUh+høh¤jh1j"h}r(j$‰j%Xpyh]h ]h]h"]h#]j&Xfunctionr j(j uh®Nh¯hh%]r!(j*)�r"}r#(hXwrite(graph, path='stdout')h+jh¤h!h1j-h}r$(h]r%haj0h¥Xplanarity.planarity_functionsr&…�r'}r(bh ]h]h"]h#]r)haj5Xwriter*j7Uj8‰uh®Nh¯hh%]r+(j:)�r,}r-(hXplanarity.planarity_functions.h+j"h¤h!h1j=h}r.(h]h"]h ]h]h#]uh®Nh¯hh%]r/h-Xplanarity.planarity_functions.r0…�r1}r2(hUh+j,ubaubjC)�r3}r4(hj*h+j"h¤h!h1jFh}r5(h]h"]h ]h]h#]uh®Nh¯hh%]r6h-Xwriter7…�r8}r9(hUh+j3ubaubjL)�r:}r;(hUh+j"h¤h!h1jOh}r<(h]h"]h ]h]h#]uh®Nh¯hh%]r=(jR)�r>}r?(hXgraphh}r@(h]h"]h ]h]h#]uh+j:h%]rAh-XgraphrB…�rC}rD(hUh+j>ubah1jZubjR)�rE}rF(hX path='stdout'h}rG(h]h"]h ]h]h#]uh+j:h%]rHh-X path='stdout'rI…�rJ}rK(hUh+jEubah1jZubeubj[)�rL}rM(hUh+j"h¤Nh1j^h}rN(Uexprj`h]h ]h]h"]h#]uh®Nh¯hh%]rOjb)�rP}rQ(hUh}rR(UreftypejfUrefdocjgU refdomainjhh]h ]U refexplicit‰h]h"]h#]U reftargetX&_modules/planarity/planarity_functionsUrefidj*uh+jLh%]rSjj)�rT}rU(hUh}rV(h]h"]rWjoah ]h]h#]uh+jPh%]rXh-X[source]rY…�rZ}r[(hUh+jTubah1jtubah1juubaubeubh™)�r\}r](hUh+jh¤h!h1jxh}r^(h]h"]h ]h]h#]uh®Nh¯hh%]r_h')�r`}ra(hX8Write an adjacency list representation of graph to path.rbh+j\h¤jh1h2h}rc(h]h"]h ]h]h#]uh®Kh¯hh%]rdh-X8Write an adjacency list representation of graph to path.re…�rf}rg(hjbh+j`ubaubaubeubj)�rh}ri(hUh+høh¤X¦/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_functions.py:docstring of planarity.planarity_functions.mappingrjh1j h}rk(h]h ]h]h"]h#]Uentries]rl(jX3mapping() (in module planarity.planarity_functions)h Utrmauh®Nh¯hh%]ubhœ)�rn}ro(hUh+høh¤jjh1j"h}rp(j$‰j%Xpyh]h ]h]h"]h#]j&Xfunctionrqj(jquh®Nh¯hh%]rr(j*)�rs}rt(hXmapping(graph)h+jnh¤h!h1j-h}ru(h]rvh aj0h¥Xplanarity.planarity_functionsrw…�rx}rybh ]h]h"]h#]rzh aj5Xmappingr{j7Uj8‰uh®Nh¯hh%]r|(j:)�r}}r~(hXplanarity.planarity_functions.h+jsh¤h!h1j=h}r(h]h"]h ]h]h#]uh®Nh¯hh%]r€h-Xplanarity.planarity_functions.r�…�r‚}rƒ(hUh+j}ubaubjC)�r„}r…(hj{h+jsh¤h!h1jFh}r†(h]h"]h ]h]h#]uh®Nh¯hh%]r‡h-Xmappingrˆ…�r‰}rŠ(hUh+j„ubaubjL)�r‹}rŒ(hUh+jsh¤h!h1jOh}r�(h]h"]h ]h]h#]uh®Nh¯hh%]rŽjR)�r�}r�(hXgraphh}r‘(h]h"]h ]h]h#]uh+j‹h%]r’h-Xgraphr“…�r”}r•(hUh+j�ubah1jZubaubj[)�r–}r—(hUh+jsh¤Nh1j^h}r˜(Uexprj`h]h ]h]h"]h#]uh®Nh¯hh%]r™jb)�rš}r›(hUh}rœ(UreftypejfUrefdocjgU refdomainjhh]h ]U refexplicit‰h]h"]h#]U reftargetX&_modules/planarity/planarity_functionsUrefidj{uh+j–h%]r�jj)�rž}rŸ(hUh}r (h]h"]r¡joah ]h]h#]uh+jšh%]r¢h-X[source]r£…�r¤}r¥(hUh+jžubah1jtubah1juubaubeubh™)�r¦}r§(hUh+jnh¤h!h1jxh}r¨(h]h"]h ]h]h#]uh®Nh¯hh%]r©h')�rª}r«(hX;Return dictionary of internal mapping of nodes to integers.r¬h+j¦h¤jjh1h2h}r­(h]h"]h ]h]h#]uh®Kh¯hh%]r®h-X;Return dictionary of internal mapping of nodes to integers.r¯…�r°}r±(hj¬h+jªubaubaubeubeubhŸ)�r²}r³(hUh+h¢h¤h§h1h©h}r´(h]h"]h ]h]rµ(X#module-planarity.planarity_networkxr¶Unetworkx-interfacer·eh#]r¸hauh®Kh¯hh%]r¹(h±)�rº}r»(hXNetworkX Interfacer¼h+j²h¤h§h1hµh}r½(h]h"]h ]h]h#]uh®Kh¯hh%]r¾h-XNetworkX Interfacer¿…�rÀ}rÁ(hj¼h+jºubaubj)�rÂ}rÃ(hUh+j²h¤j h1j h}rÄ(h]h ]h]h"]h#]Uentries]rÅ(jX%planarity.planarity_networkx (module)X#module-planarity.planarity_networkxUtrÆauh®Kh¯hh%]ubh')�rÇ}rÈ(hX NetworkX interface to planarity.rÉh+j²h¤Xœ/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_networkx.py:docstring of planarity.planarity_networkxrÊh1h2h}rË(h]h"]h ]h]h#]uh®Kh¯hh%]rÌh-X NetworkX interface to planarity.rÍ…�rÎ}rÏ(hjÉh+jÇubaubj)�rÐ}rÑ(hUh+j²h¤X°/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_networkx.py:docstring of planarity.planarity_networkx.kuratowski_subgraphrÒh1j h}rÓ(h]h ]h]h"]h#]Uentries]rÔ(jX>kuratowski_subgraph() (in module planarity.planarity_networkx)hUtrÕauh®Nh¯hh%]ubhœ)�rÖ}r×(hUh+j²h¤jÒh1j"h}rØ(j$‰j%Xpyh]h ]h]h"]h#]j&XfunctionrÙj(jÙuh®Nh¯hh%]rÚ(j*)�rÛ}rÜ(hXkuratowski_subgraph(graph)h+jÖh¤h!h1j-h}rÝ(h]rÞhaj0h¥Xplanarity.planarity_networkxrß…�rà}rábh ]h]h"]h#]râhaj5Xkuratowski_subgraphrãj7Uj8‰uh®Nh¯hh%]rä(j:)�rå}ræ(hXplanarity.planarity_networkx.h+jÛh¤h!h1j=h}rç(h]h"]h ]h]h#]uh®Nh¯hh%]rèh-Xplanarity.planarity_networkx.ré…�rê}rë(hUh+jåubaubjC)�rì}rí(hjãh+jÛh¤h!h1jFh}rî(h]h"]h ]h]h#]uh®Nh¯hh%]rïh-Xkuratowski_subgraphrð…�rñ}rò(hUh+jìubaubjL)�ró}rô(hUh+jÛh¤h!h1jOh}rõ(h]h"]h ]h]h#]uh®Nh¯hh%]röjR)�r÷}rø(hXgraphh}rù(h]h"]h ]h]h#]uh+jóh%]rúh-Xgraphrû…�rü}rý(hUh+j÷ubah1jZubaubj[)�rþ}rÿ(hUh+jÛh¤Nh1j^h}r(Uexprj`h]h ]h]h"]h#]uh®Nh¯hh%]rjb)�r}r(hUh}r(UreftypejfUrefdocjgU refdomainjhh]h ]U refexplicit‰h]h"]h#]U reftargetX%_modules/planarity/planarity_networkxUrefidjãuh+jþh%]rjj)�r}r(hUh}r(h]h"]r joah ]h]h#]uh+jh%]r h-X[source]r …�r }r (hUh+jubah1jtubah1juubaubeubh™)�r}r(hUh+jÖh¤h!h1jxh}r(h]h"]h ]h]h#]uh®Nh¯hh%]rh')�r}r(hX/Return forbidden subgraph of nonplanar graph G.rh+jh¤jÒh1h2h}r(h]h"]h ]h]h#]uh®Kh¯hh%]rh-X/Return forbidden subgraph of nonplanar graph G.r…�r}r(hjh+jubaubaubeubj)�r}r(hUh+j²h¤X©/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_networkx.py:docstring of planarity.planarity_networkx.pgraph_graphrh1j h}r(h]h ]h]h"]h#]Uentries]r(jX7pgraph_graph() (in module planarity.planarity_networkx)hUtrauh®Nh¯hh%]ubhœ)�r }r!(hUh+j²h¤jh1j"h}r"(j$‰j%Xpyh]h ]h]h"]h#]j&Xfunctionr#j(j#uh®Nh¯hh%]r$(j*)�r%}r&(hXpgraph_graph(graph)h+j h¤h!h1j-h}r'(h]r(haj0h¥Xplanarity.planarity_networkxr)…�r*}r+bh ]h]h"]h#]r,haj5X pgraph_graphr-j7Uj8‰uh®Nh¯hh%]r.(j:)�r/}r0(hXplanarity.planarity_networkx.h+j%h¤h!h1j=h}r1(h]h"]h ]h]h#]uh®Nh¯hh%]r2h-Xplanarity.planarity_networkx.r3…�r4}r5(hUh+j/ubaubjC)�r6}r7(hj-h+j%h¤h!h1jFh}r8(h]h"]h ]h]h#]uh®Nh¯hh%]r9h-X pgraph_graphr:…�r;}r<(hUh+j6ubaubjL)�r=}r>(hUh+j%h¤h!h1jOh}r?(h]h"]h ]h]h#]uh®Nh¯hh%]r@jR)�rA}rB(hXgraphh}rC(h]h"]h ]h]h#]uh+j=h%]rDh-XgraphrE…�rF}rG(hUh+jAubah1jZubaubj[)�rH}rI(hUh+j%h¤Nh1j^h}rJ(Uexprj`h]h ]h]h"]h#]uh®Nh¯hh%]rKjb)�rL}rM(hUh}rN(UreftypejfUrefdocjgU refdomainjhh]h ]U refexplicit‰h]h"]h#]U reftargetX%_modules/planarity/planarity_networkxUrefidj-uh+jHh%]rOjj)�rP}rQ(hUh}rR(h]h"]rSjoah ]h]h#]uh+jLh%]rTh-X[source]rU…�rV}rW(hUh+jPubah1jtubah1juubaubeubh™)�rX}rY(hUh+j h¤h!h1jxh}rZ(h]h"]h ]h]h#]uh®Nh¯hh%]r[h')�r\}r](hX.Return pgraph graph built from NetworkX graph.r^h+jXh¤jh1h2h}r_(h]h"]h ]h]h#]uh®Kh¯hh%]r`h-X.Return pgraph graph built from NetworkX graph.ra…�rb}rc(hj^h+j\ubaubaubeubj)�rd}re(hUh+j²h¤X«/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_networkx.py:docstring of planarity.planarity_networkx.networkx_graphrfh1j h}rg(h]h ]h]h"]h#]Uentries]rh(jX9networkx_graph() (in module planarity.planarity_networkx)hUtriauh®Nh¯hh%]ubhœ)�rj}rk(hUh+j²h¤jfh1j"h}rl(j$‰j%Xpyh]h ]h]h"]h#]j&Xfunctionrmj(jmuh®Nh¯hh%]rn(j*)�ro}rp(hXnetworkx_graph(pgraph)h+jjh¤h!h1j-h}rq(h]rrhaj0h¥Xplanarity.planarity_networkxrs…�rt}rubh ]h]h"]h#]rvhaj5Xnetworkx_graphrwj7Uj8‰uh®Nh¯hh%]rx(j:)�ry}rz(hXplanarity.planarity_networkx.h+joh¤h!h1j=h}r{(h]h"]h ]h]h#]uh®Nh¯hh%]r|h-Xplanarity.planarity_networkx.r}…�r~}r(hUh+jyubaubjC)�r€}r�(hjwh+joh¤h!h1jFh}r‚(h]h"]h ]h]h#]uh®Nh¯hh%]rƒh-Xnetworkx_graphr„…�r…}r†(hUh+j€ubaubjL)�r‡}rˆ(hUh+joh¤h!h1jOh}r‰(h]h"]h ]h]h#]uh®Nh¯hh%]rŠjR)�r‹}rŒ(hXpgraphh}r�(h]h"]h ]h]h#]uh+j‡h%]rŽh-Xpgraphr�…�r�}r‘(hUh+j‹ubah1jZubaubj[)�r’}r“(hUh+joh¤Nh1j^h}r”(Uexprj`h]h ]h]h"]h#]uh®Nh¯hh%]r•jb)�r–}r—(hUh}r˜(UreftypejfUrefdocjgU refdomainjhh]h ]U refexplicit‰h]h"]h#]U reftargetX%_modules/planarity/planarity_networkxUrefidjwuh+j’h%]r™jj)�rš}r›(hUh}rœ(h]h"]r�joah ]h]h#]uh+j–h%]ržh-X[source]rŸ…�r }r¡(hUh+jšubah1jtubah1juubaubeubh™)�r¢}r£(hUh+jjh¤h!h1jxh}r¤(h]h"]h ]h]h#]uh®Nh¯hh%]r¥h')�r¦}r§(hX2Return NetworkX graph built from planarity pgraph.r¨h+j¢h¤jfh1h2h}r©(h]h"]h ]h]h#]uh®Kh¯hh%]rªh-X2Return NetworkX graph built from planarity pgraph.r«…�r¬}r­(hj¨h+j¦ubaubaubeubj)�r®}r¯(hUh+j²h¤X¡/home/aric/.local/lib/python2.7/site-packages/planarity-0.3-py2.7-linux-x86_64.egg/planarity/planarity_networkx.py:docstring of planarity.planarity_networkx.drawr°h1j h}r±(h]h ]h]h"]h#]Uentries]r²(jX/draw() (in module planarity.planarity_networkx)h Utr³auh®Nh¯hh%]ubhœ)�r´}rµ(hUh+j²h¤j°h1j"h}r¶(j$‰j%Xpyh]h ]h]h"]h#]j&Xfunctionr·j(j·uh®Nh¯hh%]r¸(j*)�r¹}rº(hXdraw(graph, labels=True)h+j´h¤h!h1j-h}r»(h]r¼h aj0h¥Xplanarity.planarity_networkxr½…�r¾}r¿bh ]h]h"]h#]rÀh aj5XdrawrÁj7Uj8‰uh®Nh¯hh%]rÂ(j:)�rÃ}rÄ(hXplanarity.planarity_networkx.h+j¹h¤h!h1j=h}rÅ(h]h"]h ]h]h#]uh®Nh¯hh%]rÆh-Xplanarity.planarity_networkx.rÇ…�rÈ}rÉ(hUh+jÃubaubjC)�rÊ}rË(hjÁh+j¹h¤h!h1jFh}rÌ(h]h"]h ]h]h#]uh®Nh¯hh%]rÍh-XdrawrÎ…�rÏ}rÐ(hUh+jÊubaubjL)�rÑ}rÒ(hUh+j¹h¤h!h1jOh}rÓ(h]h"]h ]h]h#]uh®Nh¯hh%]rÔ(jR)�rÕ}rÖ(hXgraphh}r×(h]h"]h ]h]h#]uh+jÑh%]rØh-XgraphrÙ…�rÚ}rÛ(hUh+jÕubah1jZubjR)�rÜ}rÝ(hX labels=Trueh}rÞ(h]h"]h ]h]h#]uh+jÑh%]rßh-X labels=Truerà…�rá}râ(hUh+jÜubah1jZubeubj[)�rã}rä(hUh+j¹h¤Nh1j^h}rå(Uexprj`h]h ]h]h"]h#]uh®Nh¯hh%]ræjb)�rç}rè(hUh}ré(UreftypejfUrefdocjgU refdomainjhh]h ]U refexplicit‰h]h"]h#]U reftargetX%_modules/planarity/planarity_networkxUrefidjÁuh+jãh%]rêjj)�rë}rì(hUh}rí(h]h"]rîjoah ]h]h#]uh+jçh%]rïh-X[source]rð…�rñ}rò(hUh+jëubah1jtubah1juubaubeubh™)�ró}rô(hUh+j´h¤h!h1jxh}rõ(h]h"]h ]h]h#]uh®Nh¯hh%]röh')�r÷}rø(hX"Draw planar graph with Matplotlib.rùh+jóh¤j°h1h2h}rú(h]h"]h ]h]h#]uh®Kh¯hh%]rûh-X"Draw planar graph with Matplotlib.rü…�rý}rþ(hjùh+j÷ubaubaubeubeubh eubh¤h§h1h©h}rÿ(h]h"]h ]h]rU wrapper-classrah#]rhauh®Kh¯hh%]r(h±)�r}r(hX Wrapper Classrh+h h¤h§h1hµh}r(h]h"]h ]h]h#]uh®Kh¯hh%]rh-X Wrapper Classr …�r }r (hjh+jubaubj)�r }r (hUh+h h¤Nh1j h}r(h]h ]h]h"]h#]Uentries]r(jXPGraph (class in planarity)hUtrauh®Nh¯hh%]ubh�eubh¤Nh1j"h}r(j$‰j%Xpyh]h ]h]h"]h#]j&Xclassrj(juh®Nh¯hh%]r(j*)�r}r(hXPGraphrh+h�h¤h!h1j-h}r(h]rhaj0h¥X planarityr…�r}rbh ]h]h"]h#]rhaj5jj7Uj8‰uh®Nh¯hh%]r(csphinx.addnodes desc_annotation r)�r}r (hXclass h+jh¤h!h1Udesc_annotationr!h}r"(h]h"]h ]h]h#]uh®Nh¯hh%]r#h-Xclass r$…�r%}r&(hUh+jubaubj:)�r'}r((hX planarity.h+jh¤h!h1j=h}r)(h]h"]h ]h]h#]uh®Nh¯hh%]r*h-X planarity.r+…�r,}r-(hUh+j'ubaubjC)�r.}r/(hjh+jh¤h!h1jFh}r0(h]h"]h ]h]h#]uh®Nh¯hh%]r1h-XPGraphr2…�r3}r4(hUh+j.ubaubeubhšeubh¤h!h1jxh}r5(h]h"]h ]h]h#]uh®Nh¯hh%]r6(cdocutils.nodes rubric r7)�r8}r9(hXMethodsr:h+hšh¤Xdocstring of planarity.PGraphr;h1Urubricr<h}r=(h]h"]h ]h]h#]uh®Kh¯hh%]r>h-XMethodsr?…�r@}rA(hj:h+j8ubaubcsphinx.addnodes tabular_col_spec rB)�rC}rD(hUh+hšh¤U rEh1Utabular_col_specrFh}rG(h]h ]h]h"]h#]UspecrHUllrIuh®Nh¯hh%]ubcsphinx.ext.autosummary autosummary_table rJ)�rK}rL(hUh+hšh¤jEh1Uautosummary_tablerMh}rN(U xml:spacerOUpreserverPh]h ]h]h"]h#]uh®Nh¯hh%]rQcdocutils.nodes table rR)�rS}rT(hUh}rU(h]h"]rVU longtablerWah ]h]h#]uh+jKh%]rXcdocutils.nodes tgroup rY)�rZ}r[(hUh}r\(h]h ]h]h"]h#]UcolsKuh+jSh%]r](cdocutils.nodes colspec r^)�r_}r`(hUh}ra(h]h ]h]h"]h#]UcolwidthK uh+jZh%]h1Ucolspecrbubj^)�rc}rd(hUh}re(h]h ]h]h"]h#]UcolwidthKZuh+jZh%]h1jbubcdocutils.nodes tbody rf)�rg}rh(hUh}ri(h]h"]h ]h]h#]uh+jZh%]rj(cdocutils.nodes row rk)�rl}rm(hUh}rn(h]h"]h ]h]h#]uh+jgh%]ro(cdocutils.nodes entry rp)�rq}rr(hUh}rs(h]h"]h ]h]h#]uh+jlh%]rth')�ru}rv(hX:obj:`ascii `\h+jqh¤jEh1h2h}rw(h]h"]h ]h]h#]uh®Kh%]rx(jb)�ry}rz(hX:obj:`ascii `r{h+juh¤h§h1juh}r|(UreftypeXobjUrefwarnr}‰U reftargetr~XasciiU refdomainXpyrh]h ]U refexplicitˆh]h"]h#]Urefdocr€jgUpy:classr�jU py:moduler‚Xplanarity.planarity_networkxrƒuh®Kh%]r„cdocutils.nodes literal r…)�r†}r‡(hj{h}rˆ(h]h"]r‰(UxrefrŠjXpy-objr‹eh ]h]h#]uh+jyh%]rŒh-Xasciir�…�rŽ}r�(hUh+j†ubah1Uliteralr�ubaubh-X…�r‘}r’(hX\h+juubeubah1Uentryr“ubjp)�r”}r•(hUh}r–(h]h"]h ]h]h#]uh+jlh%]r—h')�r˜}r™(hUh}rš(h]h"]h ]h]h#]uh+j”h%]h1h2ubah1j“ubeh1Urowr›ubjk)�rœ}r�(hUh}rž(h]h"]h ]h]h#]uh+jgh%]rŸ(jp)�r }r¡(hUh}r¢(h]h"]h ]h]h#]uh+jœh%]r£h')�r¤}r¥(hX:obj:`edges `\h+j h¤jEh1h2h}r¦(h]h"]h ]h]h#]uh®Kh%]r§(jb)�r¨}r©(hX:obj:`edges `rªh+j¤h¤h§h1juh}r«(UreftypeXobjj}‰j~XedgesU refdomainXpyr¬h]h ]U refexplicitˆh]h"]h#]j€jgj�jj‚jƒuh®Kh%]r­j…)�r®}r¯(hjªh}r°(h]h"]r±(jŠj¬Xpy-objr²eh ]h]h#]uh+j¨h%]r³h-Xedgesr´…�rµ}r¶(hUh+j®ubah1j�ubaubh-X…�r·}r¸(hX\h+j¤ubeubah1j“ubjp)�r¹}rº(hUh}r»(h]h"]h ]h]h#]uh+jœh%]r¼h')�r½}r¾(hUh}r¿(h]h"]h ]h]h#]uh+j¹h%]h1h2ubah1j“ubeh1j›ubjk)�rÀ}rÁ(hUh}rÂ(h]h"]h ]h]h#]uh+jgh%]rÃ(jp)�rÄ}rÅ(hUh}rÆ(h]h"]h ]h]h#]uh+jÀh%]rÇh')�rÈ}rÉ(hX+:obj:`embed_drawplanar `\h+jÄh¤jEh1h2h}rÊ(h]h"]h ]h]h#]uh®Kh%]rË(jb)�rÌ}rÍ(hX*:obj:`embed_drawplanar `rÎh+jÈh¤h§h1juh}rÏ(UreftypeXobjj}‰j~Xembed_drawplanarU refdomainXpyrÐh]h ]U refexplicitˆh]h"]h#]j€jgj�jj‚jƒuh®Kh%]rÑj…)�rÒ}rÓ(hjÎh}rÔ(h]h"]rÕ(jŠjÐXpy-objrÖeh ]h]h#]uh+jÌh%]r×h-Xembed_drawplanarrØ…�rÙ}rÚ(hUh+jÒubah1j�ubaubh-X…�rÛ}rÜ(hX\h+jÈubeubah1j“ubjp)�rÝ}rÞ(hUh}rß(h]h"]h ]h]h#]uh+jÀh%]ràh')�rá}râ(hUh}rã(h]h"]h ]h]h#]uh+jÝh%]h1h2ubah1j“ubeh1j›ubjk)�rä}rå(hUh}ræ(h]h"]h ]h]h#]uh+jgh%]rç(jp)�rè}ré(hUh}rê(h]h"]h ]h]h#]uh+jäh%]rëh')�rì}rí(hX#:obj:`embed_planar `\h+jèh¤jEh1h2h}rî(h]h"]h ]h]h#]uh®Kh%]rï(jb)�rð}rñ(hX":obj:`embed_planar `ròh+jìh¤h§h1juh}ró(UreftypeXobjj}‰j~X embed_planarU refdomainXpyrôh]h ]U refexplicitˆh]h"]h#]j€jgj�jj‚jƒuh®Kh%]rõj…)�rö}r÷(hjòh}rø(h]h"]rù(jŠjôXpy-objrúeh ]h]h#]uh+jðh%]rûh-X embed_planarrü…�rý}rþ(hUh+jöubah1j�ubaubh-X…�rÿ}r(hX\h+jìubeubah1j“ubjp)�r}r(hUh}r(h]h"]h ]h]h#]uh+jäh%]rh')�r}r(hUh}r(h]h"]h ]h]h#]uh+jh%]h1h2ubah1j“ubeh1j›ubjk)�r}r (hUh}r (h]h"]h ]h]h#]uh+jgh%]r (jp)�r }r (hUh}r(h]h"]h ]h]h#]uh+jh%]rh')�r}r(hX:obj:`is_planar `\h+j h¤jEh1h2h}r(h]h"]h ]h]h#]uh®Kh%]r(jb)�r}r(hX:obj:`is_planar `rh+jh¤h§h1juh}r(UreftypeXobjj}‰j~X is_planarU refdomainXpyrh]h ]U refexplicitˆh]h"]h#]j€jgj�jj‚jƒuh®Kh%]rj…)�r}r(hjh}r(h]h"]r(jŠjXpy-objreh ]h]h#]uh+jh%]rh-X is_planarr …�r!}r"(hUh+jubah1j�ubaubh-X…�r#}r$(hX\h+jubeubah1j“ubjp)�r%}r&(hUh}r'(h]h"]h ]h]h#]uh+jh%]r(h')�r)}r*(hUh}r+(h]h"]h ]h]h#]uh+j%h%]h1h2ubah1j“ubeh1j›ubjk)�r,}r-(hUh}r.(h]h"]h ]h]h#]uh+jgh%]r/(jp)�r0}r1(hUh}r2(h]h"]h ]h]h#]uh+j,h%]r3h')�r4}r5(hX+:obj:`kuratowski_edges `\h+j0h¤jEh1h2h}r6(h]h"]h ]h]h#]uh®Kh%]r7(jb)�r8}r9(hX*:obj:`kuratowski_edges `r:h+j4h¤h§h1juh}r;(UreftypeXobjj}‰j~Xkuratowski_edgesU refdomainXpyr<h]h ]U refexplicitˆh]h"]h#]j€jgj�jj‚jƒuh®Kh%]r=j…)�r>}r?(hj:h}r@(h]h"]rA(jŠj<Xpy-objrBeh ]h]h#]uh+j8h%]rCh-Xkuratowski_edgesrD…�rE}rF(hUh+j>ubah1j�ubaubh-X…�rG}rH(hX\h+j4ubeubah1j“ubjp)�rI}rJ(hUh}rK(h]h"]h ]h]h#]uh+j,h%]rLh')�rM}rN(hUh}rO(h]h"]h ]h]h#]uh+jIh%]h1h2ubah1j“ubeh1j›ubjk)�rP}rQ(hUh}rR(h]h"]h ]h]h#]uh+jgh%]rS(jp)�rT}rU(hUh}rV(h]h"]h ]h]h#]uh+jPh%]rWh')�rX}rY(hX:obj:`mapping `\h+jTh¤jEh1h2h}rZ(h]h"]h ]h]h#]uh®Kh%]r[(jb)�r\}r](hX:obj:`mapping `r^h+jXh¤h§h1juh}r_(UreftypeXobjj}‰j~XmappingU refdomainXpyr`h]h ]U refexplicitˆh]h"]h#]j€jgj�jj‚jƒuh®Kh%]raj…)�rb}rc(hj^h}rd(h]h"]re(jŠj`Xpy-objrfeh ]h]h#]uh+j\h%]rgh-Xmappingrh…�ri}rj(hUh+jbubah1j�ubaubh-X…�rk}rl(hX\h+jXubeubah1j“ubjp)�rm}rn(hUh}ro(h]h"]h ]h]h#]uh+jPh%]rph')�rq}rr(hUh}rs(h]h"]h ]h]h#]uh+jmh%]h1h2ubah1j“ubeh1j›ubjk)�rt}ru(hUh}rv(h]h"]h ]h]h#]uh+jgh%]rw(jp)�rx}ry(hUh}rz(h]h"]h ]h]h#]uh+jth%]r{h')�r|}r}(hX:obj:`nodes `\h+jxh¤jEh1h2h}r~(h]h"]h ]h]h#]uh®Kh%]r(jb)�r€}r�(hX:obj:`nodes `r‚h+j|h¤h§h1juh}rƒ(UreftypeXobjj}‰j~XnodesU refdomainXpyr„h]h ]U refexplicitˆh]h"]h#]j€jgj�jj‚jƒuh®Kh%]r…j…)�r†}r‡(hj‚h}rˆ(h]h"]r‰(jŠj„Xpy-objrŠeh ]h]h#]uh+j€h%]r‹h-XnodesrŒ…�r�}rŽ(hUh+j†ubah1j�ubaubh-X…�r�}r�(hX\h+j|ubeubah1j“ubjp)�r‘}r’(hUh}r“(h]h"]h ]h]h#]uh+jth%]r”h')�r•}r–(hUh}r—(h]h"]h ]h]h#]uh+j‘h%]h1h2ubah1j“ubeh1j›ubjk)�r˜}r™(hUh}rš(h]h"]h ]h]h#]uh+jgh%]r›(jp)�rœ}r�(hUh}rž(h]h"]h ]h]h#]uh+j˜h%]rŸh')�r }r¡(hX:obj:`write `\h+jœh¤jEh1h2h}r¢(h]h"]h ]h]h#]uh®Kh%]r£(jb)�r¤}r¥(hX:obj:`write `r¦h+j h¤h§h1juh}r§(UreftypeXobjj}‰j~XwriteU refdomainXpyr¨h]h ]U refexplicitˆh]h"]h#]j€jgj�jj‚jƒuh®Kh%]r©j…)�rª}r«(hj¦h}r¬(h]h"]r­(jŠj¨Xpy-objr®eh ]h]h#]uh+j¤h%]r¯h-Xwriter°…�r±}r²(hUh+jªubah1j�ubaubh-X…�r³}r´(hX\h+j ubeubah1j“ubjp)�rµ}r¶(hUh}r·(h]h"]h ]h]h#]uh+j˜h%]r¸h')�r¹}rº(hUh}r»(h]h"]h ]h]h#]uh+jµh%]h1h2ubah1j“ubeh1j›ubeh1Utbodyr¼ubeh1Utgroupr½ubah1Utabler¾ubaubcsphinx.ext.autosummary autosummary_toc r¿)�rÀ}rÁ(hUh+hšh¤jEh1Uautosummary_tocrÂh}rÃ(jOjPh]h ]h]h"]h#]uh®Nh¯hh%]rÄcsphinx.addnodes toctree rÅ)�rÆ}rÇ(hUh}rÈ(UglobrÉNh]h ]h]h"]h#]UentriesrÊ]rË(NXreference/asciir̆rÍNXreference/edgesrΆrÏNXreference/embed_drawplanarrІrÑNXreference/embed_planarrÒ†rÓNXreference/is_planarrÔ†rÕNXreference/kuratowski_edgesrÖ†r×NXreference/mappingr؆rÙNXreference/nodesrÚ†rÛNXreference/writer܆rÝeU includefilesrÞ]rß(jÌjÎjÐjÒjÔjÖjØjÚjÜeUmaxdepthràJÿÿÿÿuh+jÀh%]h1Utoctreeráubaubeubh¤jEh1h3h}râ(h]UlevelKh]h ]Usourceh§h"]h#]UlineK Utypeh$uh®Nh¯hh%]rãh')�rä}rå(hUh}ræ(h]h"]h ]h]h#]uh+h—h%]rçh-Xfailed to import asciirè…�ré}rê(hUh+jäubah1h2ubaubh)�rë}rì(hUh+hšh¤jEh1h3h}rí(h]UlevelKh]h ]Usourceh§h"]h#]UlineK Utypeh$uh®Nh¯hh%]rîh')�rï}rð(hUh}rñ(h]h"]h ]h]h#]uh+jëh%]ròh-Xfailed to import edgesró…�rô}rõ(hUh+jïubah1h2ubaubh)�rö}r÷(hUh+hšh¤jEh1h3h}rø(h]UlevelKh]h ]Usourceh§h"]h#]UlineK Utypeh$uh®Nh¯hh%]rùh')�rú}rû(hUh}rü(h]h"]h ]h]h#]uh+jöh%]rýh-X!failed to import embed_drawplanarrþ…�rÿ}r(hUh+júubah1h2ubaubh)�r}r(hUh+hšh¤jEh1h3h}r(h]UlevelKh]h ]Usourceh§h"]h#]UlineK Utypeh$uh®Nh¯hh%]rh')�r}r(hUh}r(h]h"]h ]h]h#]uh+jh%]rh-Xfailed to import embed_planarr …�r }r (hUh+jubah1h2ubaubh)�r }r (hUh+hšh¤jEh1h3h}r(h]UlevelKh]h ]Usourceh§h"]h#]UlineK Utypeh$uh®Nh¯hh%]rh')�r}r(hUh}r(h]h"]h ]h]h#]uh+j h%]rh-Xfailed to import is_planarr…�r}r(hUh+jubah1h2ubaubh)�r}r(hUh+hšh¤jEh1h3h}r(h]UlevelKh]h ]Usourceh§h"]h#]UlineK Utypeh$uh®Nh¯hh%]rh')�r}r(hUh}r(h]h"]h ]h]h#]uh+jh%]rh-X!failed to import kuratowski_edgesr…�r }r!(hUh+jubah1h2ubaubh)�r"}r#(hUh+hšh¤jEh1h3h}r$(h]UlevelKh]h ]Usourceh§h"]h#]UlineK Utypeh$uh®Nh¯hh%]r%h')�r&}r'(hUh}r((h]h"]h ]h]h#]uh+j"h%]r)h-Xfailed to import mappingr*…�r+}r,(hUh+j&ubah1h2ubaubh)�r-}r.(hUh+hšh¤jEh1h3h}r/(h]UlevelKh]h ]Usourceh§h"]h#]UlineK Utypeh$uh®Nh¯hh%]r0h')�r1}r2(hUh}r3(h]h"]h ]h]h#]uh+j-h%]r4h-Xfailed to import nodesr5…�r6}r7(hUh+j1ubah1h2ubaubh)�r8}r9(hUh+hšh¤jEh1h3h}r:(h]UlevelKh]h ]Usourceh§h"]h#]UlineK Utypeh$uh®Nh¯hh%]r;h')�r<}r=(hUh}r>(h]h"]h ]h]h#]uh+j8h%]r?h-Xfailed to import writer@…�rA}rB(hUh+j<ubah1h2ubaubh)�rC}rD(hUh+hšh¤jEh1h3h}rE(h]UlevelKh]h ]Usourceh§h"]h#]UlineK Utypeh$uh®Nh¯hh%]rFh')�rG}rH(hUh}rI(h]h"]h ]h]h#]uh+jCh%]rJh-X6toctree references unknown document u'reference/ascii'rK…�rL}rM(hUh+jGubah1h2ubaubh)�rN}rO(hUh+hšh¤jEh1h3h}rP(h]UlevelKh]h ]Usourceh§h"]h#]UlineK Utypeh$uh®Nh¯hh%]rQh')�rR}rS(hUh}rT(h]h"]h ]h]h#]uh+jNh%]rUh-X6toctree references unknown document u'reference/edges'rV…�rW}rX(hUh+jRubah1h2ubaubh)�rY}rZ(hUh+hšh¤jEh1h3h}r[(h]UlevelKh]h ]Usourceh§h"]h#]UlineK Utypeh$uh®Nh¯hh%]r\h')�r]}r^(hUh}r_(h]h"]h ]h]h#]uh+jYh%]r`h-XAtoctree references unknown document u'reference/embed_drawplanar'ra…�rb}rc(hUh+j]ubah1h2ubaubh)�rd}re(hUh+hšh¤jEh1h3h}rf(h]UlevelKh]h ]Usourceh§h"]h#]UlineK Utypeh$uh®Nh¯hh%]rgh')�rh}ri(hUh}rj(h]h"]h ]h]h#]uh+jdh%]rkh-X=toctree references unknown document u'reference/embed_planar'rl…�rm}rn(hUh+jhubah1h2ubaubh)�ro}rp(hUh+hšh¤jEh1h3h}rq(h]UlevelKh]h ]Usourceh§h"]h#]UlineK Utypeh$uh®Nh¯hh%]rrh')�rs}rt(hUh}ru(h]h"]h ]h]h#]uh+joh%]rvh-X:toctree references unknown document u'reference/is_planar'rw…�rx}ry(hUh+jsubah1h2ubaubh)�rz}r{(hUh+hšh¤jEh1h3h}r|(h]UlevelKh]h ]Usourceh§h"]h#]UlineK Utypeh$uh®Nh¯hh%]r}h')�r~}r(hUh}r€(h]h"]h ]h]h#]uh+jzh%]r�h-XAtoctree references unknown document u'reference/kuratowski_edges'r‚…�rƒ}r„(hUh+j~ubah1h2ubaubh)�r…}r†(hUh+hšh¤jEh1h3h}r‡(h]UlevelKh]h ]Usourceh§h"]h#]UlineK Utypeh$uh®Nh¯hh%]rˆh')�r‰}rŠ(hUh}r‹(h]h"]h ]h]h#]uh+j…h%]rŒh-X8toctree references unknown document u'reference/mapping'r�…�rŽ}r�(hUh+j‰ubah1h2ubaubh)�r�}r‘(hUh+hšh¤jEh1h3h}r’(h]UlevelKh]h ]Usourceh§h"]h#]UlineK Utypeh$uh®Nh¯hh%]r“h')�r”}r•(hUh}r–(h]h"]h ]h]h#]uh+j�h%]r—h-X6toctree references unknown document u'reference/nodes'r˜…�r™}rš(hUh+j”ubah1h2ubaubh)�r›}rœ(hUh+hšh¤jEh1h3h}r�(h]UlevelKh]h ]Usourceh§h"]h#]UlineK Utypeh$uh®Nh¯hh%]ržh')�rŸ}r (hUh}r¡(h]h"]h ]h]h#]uh+j›h%]r¢h-X6toctree references unknown document u'reference/write'r£…�r¤}r¥(hUh+jŸubah1h2ubaubh)�r¦}r§(hUh+h h¤h§h1h3h}r¨(h]UlevelKh]h ]Usourceh§h"]h#]UlineKUtypeh$uh®Kh¯hh%]r©h')�rª}r«(hUh}r¬(h]h"]h ]h]h#]uh+j¦h%]r­h-X§don't know which module to import for autodocumenting u'ascii' (try placing a "module" or "currentmodule" directive in the document, or giving an explicit module name)r®…�r¯}r°(hUh+jªubah1h2ubaubeUcurrent_sourcer±NU decorationr²NUautofootnote_startr³KUnameidsr´}rµ(hhýhhhjh h¬h h h h h h h h hhhj·hhhhhhhhuh%]r¶h¢ahUU transformerr·NU footnote_refsr¸}r¹Urefnamesrº}r»Usymbol_footnotesr¼]r½Uautofootnote_refsr¾]r¿Usymbol_footnote_refsrÀ]rÁU citationsrÂ]rÃh¯hU current_linerÄNUtransform_messagesrÅ]rÆUreporterrÇNUid_startrÈKU autofootnotesrÉ]rÊU citation_refsrË}rÌUindirect_targetsrÍ]rÎUsettingsrÏ(cdocutils.frontend Values rÐorÑ}rÒ(Ufootnote_backlinksrÓKUrecord_dependenciesrÔNU rfc_base_urlrÕUhttp://tools.ietf.org/html/rÖU tracebackr×KUpep_referencesrØNUstrip_commentsrÙNU toc_backlinksrÚj“U language_coderÛUenrÜU datestamprÝNU report_levelrÞKU _destinationrßNU halt_levelràKU strip_classesráNhµNUerror_encoding_error_handlerrâUbackslashreplacerãUdebugräNUembed_stylesheetrå‰Uoutput_encoding_error_handlerræUstrictrçU sectnum_xformrèKUdump_transformsréNU docinfo_xformrêKUwarning_streamrëNUpep_file_url_templaterìUpep-%04dríUexit_status_levelrîKUconfigrïNUstrict_visitorrðNUcloak_email_addressesrñˆUtrim_footnote_reference_spacerò‰UenvróNUdump_pseudo_xmlrôNUexpose_internalsrõNUsectsubtitle_xformrö‰U source_linkr÷NUrfc_referencesrøNUoutput_encodingrùUutf-8rúU source_urlrûNUinput_encodingrüU utf-8-sigrýU_disable_configrþNU id_prefixrÿUU tab_widthrKUerror_encodingrUUTF-8rU_sourcerUE/home/aric/Software/Projects/planarity/doc/source/reference/index.rstrUgettext_compactrˆU generatorrNUdump_internalsrNU pep_base_urlrUhttp://www.python.org/dev/peps/r Uinput_encoding_error_handlerr jçUauto_id_prefixr Uidr Udoctitle_xformr ‰Ustrip_elements_with_classesrNU _config_filesr]Ufile_insertion_enabledrˆU raw_enabledrKU dump_settingsrNubUsymbol_footnote_startrKUidsr}r(hýhøhj%h¬h¢h jØj·j²h j¹h jsh j+hücdocutils.nodes target r)�r}r(hUh+høh¤j h1Utargetrh}r(h]h]rhüah ]Uismodˆh"]h#]uh®Kh¯hh%]ubhj"hjÛj¶j)�r}r(hUh+j²h¤j h1jh}r(h]h]rj¶ah ]Uismodˆh"]h#]uh®Kh¯hh%]ubhjŽhjjh hjouUsubstitution_namesr }r!h1h¯h}r"(h]h]h ]Usourceh§h"]h#]uU footnotesr#]r$Urefidsr%}r&ub.graph-algorithms-planarity-08d7b51/doc/build/html/000077500000000000000000000000001522057144000221275ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/doc/build/html/.buildinfo000066400000000000000000000003461522057144000241060ustar00rootroot00000000000000# Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. config: ce79c7d92812e7ebd13167db61eb138b tags: fbb0d17656682115ca4d033fb2f83ba1 graph-algorithms-planarity-08d7b51/doc/build/html/_modules/000077500000000000000000000000001522057144000237365ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/doc/build/html/_modules/index.html000066400000000000000000000063231522057144000257370ustar00rootroot00000000000000 Overview: module code — planarity 0.3 documentation

All modules for which code is available

graph-algorithms-planarity-08d7b51/doc/build/html/_modules/planarity.html000066400000000000000000000075631522057144000266420ustar00rootroot00000000000000 planarity — planarity 0.3 documentation

Source code for planarity

from __future__ import absolute_import
from .planarity import PGraph
from .planarity_functions import *
from .planarity_networkx import *
from .tests.test import run as test
graph-algorithms-planarity-08d7b51/doc/build/html/_modules/planarity/000077500000000000000000000000001522057144000257415ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/doc/build/html/_modules/planarity/planarity_functions.html000066400000000000000000000167051522057144000327330ustar00rootroot00000000000000 planarity.planarity_functions — planarity 0.3 documentation

Source code for planarity.planarity_functions

"""Functional interface to planarity."""
import planarity

__all__ = ['is_planar', 'kuratowski_edges', 'ascii', 'write', 'mapping']

[docs]def is_planar(graph): """Test planarity of graph.""" return planarity.PGraph(graph).is_planar()
[docs]def kuratowski_edges(graph): """Return edges of forbidden subgraph of non-planar graph.""" return planarity.PGraph(graph).kuratowski_edges()
[docs]def ascii(graph): """Draw text representation of a planar graph.""" return planarity.PGraph(graph).ascii()
[docs]def write(graph, path='stdout'): """Write an adjacency list representation of graph to path.""" planarity.PGraph(graph).write(path)
[docs]def mapping(graph): """Return dictionary of internal mapping of nodes to integers.""" return planarity.PGraph(graph).mapping()
graph-algorithms-planarity-08d7b51/doc/build/html/_modules/planarity/planarity_networkx.html000066400000000000000000000422221522057144000325750ustar00rootroot00000000000000 planarity.planarity_networkx — planarity 0.3 documentation

Source code for planarity.planarity_networkx

"""NetworkX interface to planarity."""
import planarity

__all__ = ['kuratowski_subgraph', 'pgraph_graph',
           'networkx_graph', 'draw']

[docs]def kuratowski_subgraph(graph): """Return forbidden subgraph of nonplanar graph G.""" try: import networkx as nx except ImportError: raise ImportError("NetworkX required for kuratowski_subgraph()") pgraph = planarity.PGraph(graph) edges = pgraph.kuratowski_edges() return nx.Graph(edges)
[docs]def networkx_graph(pgraph): """Return NetworkX graph built from planarity pgraph.""" try: import networkx as nx except ImportError: raise ImportError("NetworkX required for networkx_graph()") graph = nx.Graph() graph.add_nodes_from(pgraph.nodes(data=True)) graph.add_edges_from(pgraph.edges(data=True)) return graph
[docs]def pgraph_graph(graph): """Return pgraph graph built from NetworkX graph.""" return planarity.PGraph(graph)
[docs]def draw(graph, labels=True): """Draw planar graph with Matplotlib.""" try: import matplotlib.pyplot as plt from matplotlib.patches import Circle from matplotlib.collections import PatchCollection except ImportError: raise ImportError("Matplotlib is required for draw()") pgraph = planarity.PGraph(graph) pgraph.embed_drawplanar() hgraph = networkx_graph(pgraph) patches = [] node_labels = {} xs = [] ys = [] for node, data in hgraph.nodes(data=True): y = data['pos'] xb = data['start'] xe = data['end'] x = int((xe+xb)/2) node_labels[node] = (x, y) patches += [Circle((x, y), 0.25)]#,0.5,fc='w')] xs.extend([xb, xe]) ys.append(y) plt.hlines([y], [xb], [xe]) for (_, _, data) in hgraph.edges(data=True): x = data['pos'] yb = data['start'] ye = data['end'] ys.extend([yb, ye]) xs.append(x) plt.vlines([x], [yb], [ye]) # labels if labels: for n, (x, y) in node_labels.items(): plt.text(x, y, n, horizontalalignment='center', verticalalignment='center', bbox = dict(boxstyle='round', ec=(0.0, 0.0, 0.0), fc=(1.0, 1.0, 1.0), ) ) p = PatchCollection(patches) ax = plt.gca() ax.add_collection(p) plt.axis('equal') plt.xlim(min(xs)-1, max(xs)+1) plt.ylim(min(ys)-1, max(ys)+1)
graph-algorithms-planarity-08d7b51/doc/build/html/_sources/000077500000000000000000000000001522057144000237515ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/doc/build/html/_sources/index.txt000066400000000000000000000014231522057144000256210ustar00rootroot00000000000000.. planarity documentation master file, created by sphinx-quickstart on Thu Jun 30 15:49:39 2011. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. Planarity ========= A Python interface to graph planarity algorithms. This provides a wrapper for Boyer's (C) planarity algorithms: http://code.google.com/p/planarity/ :Release: |version| :Date: |today| Functions --------- .. automodule:: planarity.planarity_functions :members: NetworkX Interface ------------------ .. automodule:: planarity.planarity_networkx :members: Wrapper Class ------------- .. autoclass:: planarity.PGraph .. automethod:: ascii Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` graph-algorithms-planarity-08d7b51/doc/build/html/_sources/reference/000077500000000000000000000000001522057144000257075ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/doc/build/html/_sources/reference/index.txt000066400000000000000000000005151522057144000275600ustar00rootroot00000000000000========= Reference ========= :Release: |version| :Date: |today| Functions --------- .. automodule:: planarity.planarity_functions :members: NetworkX Interface ------------------ .. automodule:: planarity.planarity_networkx :members: Wrapper Class ------------- .. autoclass:: planarity.PGraph .. automethod:: ascii graph-algorithms-planarity-08d7b51/doc/build/html/_static/000077500000000000000000000000001522057144000235555ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/doc/build/html/_static/ajax-loader.gif000066400000000000000000000012411522057144000264310ustar00rootroot00000000000000GIF89aòÿÿÿU|ÆÖßN€�U|l–®Š«¾™¶Æ!þCreated with ajaxload.info!ù !ÿ NETSCAPE2.0,3ºÜþ0ÊIkc:œN˜f E±1º™Á¶.`ÄÂqÐ-[9ݦ9 JkçH!ù ,4ºÜþNŒ! „ »°æŠDqBQT`1 `LE[¨|µußía€ ×â†C²%$*!ù ,6º2#+ÊAÈ�Ì”V/…côNñIBa˜«pð ̳½ƨ+YíüƒÃ2©dŸ¿!ù ,3ºb%+Ê2†‘ìœV_…‹¦ …! 1D‡aªF‚°ÑbR]ó=08,�Ȥr9L!ù ,2ºr'+JçdðóL� &vÃ`\bT”…„¹hYB)ÏÊ@é<Ã&,�ȤR’!ù ,3º Â�9ãtç¼Úž0Çà!.B¶�ÊW¬¢1  sa»°5÷•�0° ‰»Ÿm)J!ù ,2ºÜþð ÙœU]šîÚqp•`ˆÝaœÝ4–…AFÅ0�`›¶ Â@›1€ÂÖΑ!ù ,2ºÜþ0ÊI«eBÔœ)×à ŽÇq10©Ê°®PÂaVÚ¥ ub‚ž[�;graph-algorithms-planarity-08d7b51/doc/build/html/_static/basic.css000066400000000000000000000204171522057144000253540ustar00rootroot00000000000000/* * basic.css * ~~~~~~~~~ * * Sphinx stylesheet -- basic theme. * * :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ /* -- main layout ----------------------------------------------------------- */ div.clearer { clear: both; } /* -- relbar ---------------------------------------------------------------- */ div.related { width: 100%; font-size: 90%; } div.related h3 { display: none; } div.related ul { margin: 0; padding: 0 0 0 10px; list-style: none; } div.related li { display: inline; } div.related li.right { float: right; margin-right: 5px; } /* -- sidebar --------------------------------------------------------------- */ div.sphinxsidebarwrapper { padding: 10px 5px 0 10px; } div.sphinxsidebar { float: left; width: 230px; margin-left: -100%; font-size: 90%; } div.sphinxsidebar ul { list-style: none; } div.sphinxsidebar ul ul, div.sphinxsidebar ul.want-points { margin-left: 20px; list-style: square; } div.sphinxsidebar ul ul { margin-top: 0; margin-bottom: 0; } div.sphinxsidebar form { margin-top: 10px; } div.sphinxsidebar input { border: 1px solid #98dbcc; font-family: sans-serif; font-size: 1em; } div.sphinxsidebar #searchbox input[type="text"] { width: 170px; } div.sphinxsidebar #searchbox input[type="submit"] { width: 30px; } img { border: 0; } /* -- search page ----------------------------------------------------------- */ ul.search { margin: 10px 0 0 20px; padding: 0; } ul.search li { padding: 5px 0 5px 20px; background-image: url(file.png); background-repeat: no-repeat; background-position: 0 7px; } ul.search li a { font-weight: bold; } ul.search li div.context { color: #888; margin: 2px 0 0 30px; text-align: left; } ul.keywordmatches li.goodmatch a { font-weight: bold; } /* -- index page ------------------------------------------------------------ */ table.contentstable { width: 90%; } table.contentstable p.biglink { line-height: 150%; } a.biglink { font-size: 1.3em; } span.linkdescr { font-style: italic; padding-top: 5px; font-size: 90%; } /* -- general index --------------------------------------------------------- */ table.indextable { width: 100%; } table.indextable td { text-align: left; vertical-align: top; } table.indextable dl, table.indextable dd { margin-top: 0; margin-bottom: 0; } table.indextable tr.pcap { height: 10px; } table.indextable tr.cap { margin-top: 10px; background-color: #f2f2f2; } img.toggler { margin-right: 3px; margin-top: 3px; cursor: pointer; } div.modindex-jumpbox { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; margin: 1em 0 1em 0; padding: 0.4em; } div.genindex-jumpbox { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; margin: 1em 0 1em 0; padding: 0.4em; } /* -- general body styles --------------------------------------------------- */ a.headerlink { visibility: hidden; } h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, h4:hover > a.headerlink, h5:hover > a.headerlink, h6:hover > a.headerlink, dt:hover > a.headerlink { visibility: visible; } div.body p.caption { text-align: inherit; } div.body td { text-align: left; } .field-list ul { padding-left: 1em; } .first { margin-top: 0 !important; } p.rubric { margin-top: 30px; font-weight: bold; } img.align-left, .figure.align-left, object.align-left { clear: left; float: left; margin-right: 1em; } img.align-right, .figure.align-right, object.align-right { clear: right; float: right; margin-left: 1em; } img.align-center, .figure.align-center, object.align-center { display: block; margin-left: auto; margin-right: auto; } .align-left { text-align: left; } .align-center { text-align: center; } .align-right { text-align: right; } /* -- sidebars -------------------------------------------------------------- */ div.sidebar { margin: 0 0 0.5em 1em; border: 1px solid #ddb; padding: 7px 7px 0 7px; background-color: #ffe; width: 40%; float: right; } p.sidebar-title { font-weight: bold; } /* -- topics ---------------------------------------------------------------- */ div.topic { border: 1px solid #ccc; padding: 7px 7px 0 7px; margin: 10px 0 10px 0; } p.topic-title { font-size: 1.1em; font-weight: bold; margin-top: 10px; } /* -- admonitions ----------------------------------------------------------- */ div.admonition { margin-top: 10px; margin-bottom: 10px; padding: 7px; } div.admonition dt { font-weight: bold; } div.admonition dl { margin-bottom: 0; } p.admonition-title { margin: 0px 10px 5px 0px; font-weight: bold; } div.body p.centered { text-align: center; margin-top: 25px; } /* -- tables ---------------------------------------------------------------- */ table.docutils { border: 0; border-collapse: collapse; } table.docutils td, table.docutils th { padding: 1px 8px 1px 5px; border-top: 0; border-left: 0; border-right: 0; border-bottom: 1px solid #aaa; } table.field-list td, table.field-list th { border: 0 !important; } table.footnote td, table.footnote th { border: 0 !important; } th { text-align: left; padding-right: 5px; } table.citation { border-left: solid 1px gray; margin-left: 1px; } table.citation td { border-bottom: none; } /* -- other body styles ----------------------------------------------------- */ ol.arabic { list-style: decimal; } ol.loweralpha { list-style: lower-alpha; } ol.upperalpha { list-style: upper-alpha; } ol.lowerroman { list-style: lower-roman; } ol.upperroman { list-style: upper-roman; } dl { margin-bottom: 15px; } dd p { margin-top: 0px; } dd ul, dd table { margin-bottom: 10px; } dd { margin-top: 3px; margin-bottom: 10px; margin-left: 30px; } dt:target, .highlighted { background-color: #fbe54e; } dl.glossary dt { font-weight: bold; font-size: 1.1em; } .field-list ul { margin: 0; padding-left: 1em; } .field-list p { margin: 0; } .refcount { color: #060; } .optional { font-size: 1.3em; } .versionmodified { font-style: italic; } .system-message { background-color: #fda; padding: 5px; border: 3px solid red; } .footnote:target { background-color: #ffa; } .line-block { display: block; margin-top: 1em; margin-bottom: 1em; } .line-block .line-block { margin-top: 0; margin-bottom: 0; margin-left: 1.5em; } .guilabel, .menuselection { font-family: sans-serif; } .accelerator { text-decoration: underline; } .classifier { font-style: oblique; } abbr, acronym { border-bottom: dotted 1px; cursor: help; } /* -- code displays --------------------------------------------------------- */ pre { overflow: auto; overflow-y: hidden; /* fixes display issues on Chrome browsers */ } td.linenos pre { padding: 5px 0px; border: 0; background-color: transparent; color: #aaa; } table.highlighttable { margin-left: 0.5em; } table.highlighttable td { padding: 0 0.5em 0 0.5em; } tt.descname { background-color: transparent; font-weight: bold; font-size: 1.2em; } tt.descclassname { background-color: transparent; } tt.xref, a tt { background-color: transparent; font-weight: bold; } h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { background-color: transparent; } .viewcode-link { float: right; } .viewcode-back { float: right; font-family: sans-serif; } div.viewcode-block:target { margin: -1px -10px; padding: 0 10px; } /* -- math display ---------------------------------------------------------- */ img.math { vertical-align: middle; } div.body div.math p { text-align: center; } span.eqno { float: right; } /* -- printout stylesheet --------------------------------------------------- */ @media print { div.document, div.documentwrapper, div.bodywrapper { margin: 0 !important; width: 100%; } div.sphinxsidebar, div.related, div.footer, #top-link { display: none; } }graph-algorithms-planarity-08d7b51/doc/build/html/_static/comment-bright.png000066400000000000000000000066541522057144000272150ustar00rootroot00000000000000‰PNG  IHDRóÿa OiCCPPhotoshop ICC profilexÚ�SgTSé=÷ÞôBKˆ€”KoR RB‹€‘&*! Jˆ!¡ÙQÁEEÈ ˆŽŽ€ŒQ, Š Øä!¢Žƒ£ˆŠÊûá{£kÖ¼÷æÍþµ×>ç¬ó�³ÏÀ –H3Q5€ ©BàƒÇÄÆáä.@� $p³d!sý#ø~<<+"À¾xÓ ÀM›À0‡ÿêB™\€„Àt‘8K€@zŽB¦@F€�˜&S `ËcbãP-`'æÓ€�ø™{[”! ‘ eˆDh;¬ÏVŠEX0fKÄ9Ø-0IWfH°·ÀÎ ² 0Qˆ…){`È##x„™FòW<ñ+®ç*x™²<¹$9E�[-qWW.(ÎI+6aaš@.Ây™2�4àóÌ ‘àƒóýxήÎÎ6޶_-ê¿ÿ"bbãþåÏ«p@át~Ñþ,/³€;€mþ¢%îh^  u÷‹f²@µ éÚWópø~<ß5°j>{‘-¨]cöK'XtÀâ÷ò»oÁÔ(€hƒáÏwÿï?ýG %€fI’q^D$.Tʳ?ÇD �*°AôÁ,ÀÁÜÁ ü`6„B$ÄÂBB d€r`)¬‚B(†Í°*`/Ô@4ÀQh†“p.ÂU¸=púažÁ(¼� AÈa!ÚˆbŠX#Ž™…ø!ÁH‹$ ɈQ"K‘5H1RŠT UHò=r9‡\Fº‘;È2‚ü†¼G1”�²Q=Ô µC¹¨7„F¢ Ðdt1š� ›Ðr´=Œ6¡çЫhÚ�>CÇ0Àè3Äl0.ÆÃB±8, “c˱"¬ «Æ°V¬»‰õcϱw�EÀ 6wB aAHXLXNØH¨ $4Ú 7 „QÂ'"“¨K´&ºùÄb21‡XH,#Ö�/{ˆCÄ7$‰C2'¹�I±¤TÒÒFÒnR#é,©›4H#“ÉÚdk²9”, +È…ä�äÃä3ää!ò[ �b@q¤øSâ(RÊjJåå4åe˜2AU£šRݨ¡T5�ZB­¡¶R¯Q‡¨4uš9̓IK¥­¢•Óhh÷i¯ètºÝ•N—ÐWÒËéGè—èôw †ƒÇˆg(›gw¯˜L¦Ó‹ÇT071ë˜ç™™oUX*¶*|‘Ê •J•&•*/T©ª¦ªÞª UóUËT�©^S}®FU3Sã© Ô–«Uª�PëSSg©;¨‡ªg¨oT?¤~Yý‰YÃLÃOC¤Q ±_ã¼Æ c³x,!k «†u�5Ä&±ÍÙ|v*»˜ý»‹=ª©¡9C3J3W³Ró”f?ã˜qøœtN ç(§—ó~ŠÞï)â)¦4L¹1e\kª–—–X«H«Q«Gë½6®í§�¦½E»Yû�AÇJ'\'Gg�Î�çSÙSݧ §M=:õ®.ªk¥¡»Dw¿n§î˜ž¾^€žLo§Þy½çú}/ýTýmú§õG X³ $Û Î<Å5qo</ÇÛñQC]Ã@C¥a•a—á„‘¹Ñ<£ÕF�FŒiÆ\ã$ãmÆmÆ£&&!&KMêMîšRM¹¦)¦;L;LÇÍÌÍ¢ÍÖ™5›=1×2ç›ç›×›ß·`ZxZ,¶¨¶¸eI²äZ¦Yî¶¼n…Z9Y¥XUZ]³F­�­%Ö»­»§§¹N“N«žÖgðñ¶É¶©·°åØÛ®¶m¶}agbg·Å®Ã“}º}�ý= ‡Ù«Z~s´r:V:ޚΜî?}Åô–é/gXÏÏØ3ã¶Ë)Äi�S›ÓGgg¹sƒóˆ‹‰K‚Ë.—>.›ÆÝȽäJtõq]ázÒõ�›³›Âí¨Û¯î6îiî‡ÜŸÌ4Ÿ)žY3sÐÃÈCàQåÑ? Ÿ•0k߬~OCO�gµç#/c/‘W­×°·¥wª÷aï>ö>rŸã>ã<7Þ2ÞY_Ì7À·È·ËOÃož_…ßC#ÿdÿzÿѧ€%g‰�A�[ûøz|!¿Ž?:Ûeö²ÙíAŒ ¹AA�‚­‚åÁ­!hÈì�­!÷ç˜Î‘Îi…P~èÖÐaæa‹Ã~ '…‡…W†?ŽpˆXÑ1—5wÑÜCsßDúD–DÞ›g1O9¯-J5*>ª.j<Ú7º4º?Æ.fYÌÕX�XIlK9.*®6nl¾ßüíó‡â�â ã{˜/È]py¡ÎÂô…§©.,:–@LˆN8”ðA*¨Œ%òw%Ž yÂÂg"/Ñ6шØC\*NòH*Mz’쑼5y$Å3¥,幄'©�¼L LÝ›:žšv m2=:½1ƒ’‘�qBª!M“¶gêgæfvˬe…²þÅn‹·/•Ék³�¬Y- ¶B¦èTZ(×*²geWf¿Í‰Ê9–«ž+Íí̳ÊÛ�7œïŸÿíÂá’¶¥†KW-X潬j9²‰Š®Û—Ø(Üxå‡oÊ¿™Ü”´©«Ä¹dÏfÒféæÞ-ž[–ª—æ—n ÙÚ´ ßV´íõöEÛ/—Í(Û»ƒ¶C¹£¿<¸¼e§ÉÎÍ;?T¤TôTúT6îÒݵa×ønÑî{¼ö4ìÕÛ[¼÷ý>ɾÛUUMÕfÕeûIû³÷?®‰ªéø–ûm]­NmqíÇÒý#¶×¹ÔÕÒ=TR�Ö+ëGǾþ�ïw- 6 U�œÆâ#pDyäé÷ ß÷ :ÚvŒ{¬áÓvg/jBšòšF›Sšû[b[ºOÌ>ÑÖêÞzüGÛœ499â?rýéü§CÏdÏ&žþ¢þË®/~øÕë×Îјѡ—ò—“¿m|¥ýêÀë¯ÛÆÂƾÉx31^ôVûíÁwÜwï£ßOä| (ÿhù±õSЧû“““ÿ˜óüc3-ÛbKGDÿÿÿ ½§“ pHYs  šœtIMEÚ 6 B©\<ÞIDAT8Ë…’Kh]e…¿½ÿs1mAÛÄÚ`j‚Ïh[-ˆE(FEŠÁaAœ! bI« àÈ�*–B�X‘"Ø�4)NŠõUR‚Zˆ¹­!’×Mhj“›ssÎùÿíà–¨àãmØ‹Å^‹-\ggßÏ ÷ßì�]o|ÑÑÒ¬[3±¶4§Á§6»”û©òèø¯×>zd‘¿ ]½#Œ»î8ÙþüáÇOݺ±t{5·uIÍXN!I=@Vf¾®Ÿ=v×ÀÞþ1ûº�}e>;ØÉö×fvìénøvËÍÅxaÉHrÏʪJ’¦Fȹ`œÈðDò¹WZ�®]ÀžSíýŸø%S)ÌWAÌœb¹ |0K=âSo7D†~\~qâÍ-ïÀËŸ\ùaóMÅ“Z,S'*æô™‘È} óF`—†ÎNn�zæ674¸öËUÈç¬ó�³ÏÀ –H3Q5€ ©BàƒÇÄÆáä.@� $p³d!sý#ø~<<+"À¾xÓ ÀM›À0‡ÿêB™\€„Àt‘8K€@zŽB¦@F€�˜&S `ËcbãP-`'æÓ€�ø™{[”! ‘ eˆDh;¬ÏVŠEX0fKÄ9Ø-0IWfH°·ÀÎ ² 0Qˆ…){`È##x„™FòW<ñ+®ç*x™²<¹$9E�[-qWW.(ÎI+6aaš@.Ây™2�4àóÌ ‘àƒóýxήÎÎ6޶_-ê¿ÿ"bbãþåÏ«p@át~Ñþ,/³€;€mþ¢%îh^  u÷‹f²@µ éÚWópø~<ß5°j>{‘-¨]cöK'XtÀâ÷ò»oÁÔ(€hƒáÏwÿï?ýG %€fI’q^D$.Tʳ?ÇD �*°AôÁ,ÀÁÜÁ ü`6„B$ÄÂBB d€r`)¬‚B(†Í°*`/Ô@4ÀQh†“p.ÂU¸=púažÁ(¼� AÈa!ÚˆbŠX#Ž™…ø!ÁH‹$ ɈQ"K‘5H1RŠT UHò=r9‡\Fº‘;È2‚ü†¼G1”�²Q=Ô µC¹¨7„F¢ Ðdt1š� ›Ðr´=Œ6¡çЫhÚ�>CÇ0Àè3Äl0.ÆÃB±8, “c˱"¬ «Æ°V¬»‰õcϱw�EÀ 6wB aAHXLXNØH¨ $4Ú 7 „QÂ'"“¨K´&ºùÄb21‡XH,#Ö�/{ˆCÄ7$‰C2'¹�I±¤TÒÒFÒnR#é,©›4H#“ÉÚdk²9”, +È…ä�äÃä3ää!ò[ �b@q¤øSâ(RÊjJåå4åe˜2AU£šRݨ¡T5�ZB­¡¶R¯Q‡¨4uš9̓IK¥­¢•Óhh÷i¯ètºÝ•N—ÐWÒËéGè—èôw †ƒÇˆg(›gw¯˜L¦Ó‹ÇT071ë˜ç™™oUX*¶*|‘Ê •J•&•*/T©ª¦ªÞª UóUËT�©^S}®FU3Sã© Ô–«Uª�PëSSg©;¨‡ªg¨oT?¤~Yý‰YÃLÃOC¤Q ±_ã¼Æ c³x,!k «†u�5Ä&±ÍÙ|v*»˜ý»‹=ª©¡9C3J3W³Ró”f?ã˜qøœtN ç(§—ó~ŠÞï)â)¦4L¹1e\kª–—–X«H«Q«Gë½6®í§�¦½E»Yû�AÇJ'\'Gg�Î�çSÙSݧ §M=:õ®.ªk¥¡»Dw¿n§î˜ž¾^€žLo§Þy½çú}/ýTýmú§õG X³ $Û Î<Å5qo</ÇÛñQC]Ã@C¥a•a—á„‘¹Ñ<£ÕF�FŒiÆ\ã$ãmÆmÆ£&&!&KMêMîšRM¹¦)¦;L;LÇÍÌÍ¢ÍÖ™5›=1×2ç›ç›×›ß·`ZxZ,¶¨¶¸eI²äZ¦Yî¶¼n…Z9Y¥XUZ]³F­�­%Ö»­»§§¹N“N«žÖgðñ¶É¶©·°åØÛ®¶m¶}agbg·Å®Ã“}º}�ý= ‡Ù«Z~s´r:V:ޚΜî?}Åô–é/gXÏÏØ3ã¶Ë)Äi�S›ÓGgg¹sƒóˆ‹‰K‚Ë.—>.›ÆÝȽäJtõq]ázÒõ�›³›Âí¨Û¯î6îiî‡ÜŸÌ4Ÿ)žY3sÐÃÈCàQåÑ? Ÿ•0k߬~OCO�gµç#/c/‘W­×°·¥wª÷aï>ö>rŸã>ã<7Þ2ÞY_Ì7À·È·ËOÃož_…ßC#ÿdÿzÿѧ€%g‰�A�[ûøz|!¿Ž?:Ûeö²ÙíAŒ ¹AA�‚­‚åÁ­!hÈì�­!÷ç˜Î‘Îi…P~èÖÐaæa‹Ã~ '…‡…W†?ŽpˆXÑ1—5wÑÜCsßDúD–DÞ›g1O9¯-J5*>ª.j<Ú7º4º?Æ.fYÌÕX�XIlK9.*®6nl¾ßüíó‡â�â ã{˜/È]py¡ÎÂô…§©.,:–@LˆN8”ðA*¨Œ%òw%Ž yÂÂg"/Ñ6шØC\*NòH*Mz’쑼5y$Å3¥,幄'©�¼L LÝ›:žšv m2=:½1ƒ’‘�qBª!M“¶gêgæfvˬe…²þÅn‹·/•Ék³�¬Y- ¶B¦èTZ(×*²geWf¿Í‰Ê9–«ž+Íí̳ÊÛ�7œïŸÿíÂá’¶¥†KW-X潬j9²‰Š®Û—Ø(Üxå‡oÊ¿™Ü”´©«Ä¹dÏfÒféæÞ-ž[–ª—æ—n ÙÚ´ ßV´íõöEÛ/—Í(Û»ƒ¶C¹£¿<¸¼e§ÉÎÍ;?T¤TôTúT6îÒݵa×ønÑî{¼ö4ìÕÛ[¼÷ý>ɾÛUUMÕfÕeûIû³÷?®‰ªéø–ûm]­NmqíÇÒý#¶×¹ÔÕÒ=TR�Ö+ëGǾþ�ïw- 6 U�œÆâ#pDyäé÷ ß÷ :ÚvŒ{¬áÓvg/jBšòšF›Sšû[b[ºOÌ>ÑÖêÞzüGÛœ499â?rýéü§CÏdÏ&žþ¢þË®/~øÕë×Îјѡ—ò—“¿m|¥ýêÀë¯ÛÆÂƾÉx31^ôVûíÁwÜwï£ßOä| (ÿhù±õSЧû“““ÿ˜óüc3-ÛbKGDÿÿÿ ½§“ pHYs  šœtIMEÚ!â›ÈÝ,IDAT8Ëe’_H�uÇ?Ïï}ßsŽž3ÍyòË•¶¦‹U2MvQÉÖŠFÔE¬.ŠÑÍÃÅ‚­ÄŠbÑE$DD­‹ËZF5b@QÌ"š:�2§›š¦�¾ïû{Ÿn.êsõå�çû<_ø yî?ô½m÷�²ýè·wV™ê@t£R`}�Z íÄÐ_£# _=œá_@ÝËý ßw^óRë®·•%6gC-έ(K>ä| $„Éï{¯}ç¬ó�³ÏÀ –H3Q5€ ©BàƒÇÄÆáä.@� $p³d!sý#ø~<<+"À¾xÓ ÀM›À0‡ÿêB™\€„Àt‘8K€@zŽB¦@F€�˜&S `ËcbãP-`'æÓ€�ø™{[”! ‘ eˆDh;¬ÏVŠEX0fKÄ9Ø-0IWfH°·ÀÎ ² 0Qˆ…){`È##x„™FòW<ñ+®ç*x™²<¹$9E�[-qWW.(ÎI+6aaš@.Ây™2�4àóÌ ‘àƒóýxήÎÎ6޶_-ê¿ÿ"bbãþåÏ«p@át~Ñþ,/³€;€mþ¢%îh^  u÷‹f²@µ éÚWópø~<ß5°j>{‘-¨]cöK'XtÀâ÷ò»oÁÔ(€hƒáÏwÿï?ýG %€fI’q^D$.Tʳ?ÇD �*°AôÁ,ÀÁÜÁ ü`6„B$ÄÂBB d€r`)¬‚B(†Í°*`/Ô@4ÀQh†“p.ÂU¸=púažÁ(¼� AÈa!ÚˆbŠX#Ž™…ø!ÁH‹$ ɈQ"K‘5H1RŠT UHò=r9‡\Fº‘;È2‚ü†¼G1”�²Q=Ô µC¹¨7„F¢ Ðdt1š� ›Ðr´=Œ6¡çЫhÚ�>CÇ0Àè3Äl0.ÆÃB±8, “c˱"¬ «Æ°V¬»‰õcϱw�EÀ 6wB aAHXLXNØH¨ $4Ú 7 „QÂ'"“¨K´&ºùÄb21‡XH,#Ö�/{ˆCÄ7$‰C2'¹�I±¤TÒÒFÒnR#é,©›4H#“ÉÚdk²9”, +È…ä�äÃä3ää!ò[ �b@q¤øSâ(RÊjJåå4åe˜2AU£šRݨ¡T5�ZB­¡¶R¯Q‡¨4uš9̓IK¥­¢•Óhh÷i¯ètºÝ•N—ÐWÒËéGè—èôw †ƒÇˆg(›gw¯˜L¦Ó‹ÇT071ë˜ç™™oUX*¶*|‘Ê •J•&•*/T©ª¦ªÞª UóUËT�©^S}®FU3Sã© Ô–«Uª�PëSSg©;¨‡ªg¨oT?¤~Yý‰YÃLÃOC¤Q ±_ã¼Æ c³x,!k «†u�5Ä&±ÍÙ|v*»˜ý»‹=ª©¡9C3J3W³Ró”f?ã˜qøœtN ç(§—ó~ŠÞï)â)¦4L¹1e\kª–—–X«H«Q«Gë½6®í§�¦½E»Yû�AÇJ'\'Gg�Î�çSÙSݧ §M=:õ®.ªk¥¡»Dw¿n§î˜ž¾^€žLo§Þy½çú}/ýTýmú§õG X³ $Û Î<Å5qo</ÇÛñQC]Ã@C¥a•a—á„‘¹Ñ<£ÕF�FŒiÆ\ã$ãmÆmÆ£&&!&KMêMîšRM¹¦)¦;L;LÇÍÌÍ¢ÍÖ™5›=1×2ç›ç›×›ß·`ZxZ,¶¨¶¸eI²äZ¦Yî¶¼n…Z9Y¥XUZ]³F­�­%Ö»­»§§¹N“N«žÖgðñ¶É¶©·°åØÛ®¶m¶}agbg·Å®Ã“}º}�ý= ‡Ù«Z~s´r:V:ޚΜî?}Åô–é/gXÏÏØ3ã¶Ë)Äi�S›ÓGgg¹sƒóˆ‹‰K‚Ë.—>.›ÆÝȽäJtõq]ázÒõ�›³›Âí¨Û¯î6îiî‡ÜŸÌ4Ÿ)žY3sÐÃÈCàQåÑ? Ÿ•0k߬~OCO�gµç#/c/‘W­×°·¥wª÷aï>ö>rŸã>ã<7Þ2ÞY_Ì7À·È·ËOÃož_…ßC#ÿdÿzÿѧ€%g‰�A�[ûøz|!¿Ž?:Ûeö²ÙíAŒ ¹AA�‚­‚åÁ­!hÈì�­!÷ç˜Î‘Îi…P~èÖÐaæa‹Ã~ '…‡…W†?ŽpˆXÑ1—5wÑÜCsßDúD–DÞ›g1O9¯-J5*>ª.j<Ú7º4º?Æ.fYÌÕX�XIlK9.*®6nl¾ßüíó‡â�â ã{˜/È]py¡ÎÂô…§©.,:–@LˆN8”ðA*¨Œ%òw%Ž yÂÂg"/Ñ6шØC\*NòH*Mz’쑼5y$Å3¥,幄'©�¼L LÝ›:žšv m2=:½1ƒ’‘�qBª!M“¶gêgæfvˬe…²þÅn‹·/•Ék³�¬Y- ¶B¦èTZ(×*²geWf¿Í‰Ê9–«ž+Íí̳ÊÛ�7œïŸÿíÂá’¶¥†KW-X潬j9²‰Š®Û—Ø(Üxå‡oÊ¿™Ü”´©«Ä¹dÏfÒféæÞ-ž[–ª—æ—n ÙÚ´ ßV´íõöEÛ/—Í(Û»ƒ¶C¹£¿<¸¼e§ÉÎÍ;?T¤TôTúT6îÒݵa×ønÑî{¼ö4ìÕÛ[¼÷ý>ɾÛUUMÕfÕeûIû³÷?®‰ªéø–ûm]­NmqíÇÒý#¶×¹ÔÕÒ=TR�Ö+ëGǾþ�ïw- 6 U�œÆâ#pDyäé÷ ß÷ :ÚvŒ{¬áÓvg/jBšòšF›Sšû[b[ºOÌ>ÑÖêÞzüGÛœ499â?rýéü§CÏdÏ&žþ¢þË®/~øÕë×Îјѡ—ò—“¿m|¥ýêÀë¯ÛÆÂƾÉx31^ôVûíÁwÜwï£ßOä| (ÿhù±õSЧû“““ÿ˜óüc3-ÛbKGDÿÿÿ ½§“ pHYs  šœtIMEÚ 1;ïV·¿§IDAT8Ëu‘ËkÜUÇ?ßsgœ4ÔØøhª‚`µ�©ÖG1 RQ‚”îܸp%èBªø”n"‚bÐ� XJ ‹.4V iZð##T;m£µ!�4™üæžãbâP­~7÷rîù>ιbwïý†cû†; m;‡oª”Ó�AÜàΆ ζZ^«/®þôä£Ãç¸|îs¯ÝÉø{Óý;†¯y¿»Rº¥ð¸Â=È9(rÉt¦Vo¼¾û¡­ûG÷Í1±wíÞÿ#_àÓ©¹›{»¿ìî*•›E&ç å!�€€ˆÀƒ(—Lç–VŸßuïÀ«�oœéêûÁᲵ‘DŽÀ€ P„‡²G”“4ÿçÊ ��Ü:&€¯ç~™êî*ݳÖre�ˆuá: ‚áá�S­-,ßUšœ©^Ÿ’ú›E&·™JY[ÃPà!RˆìB ŖޞʖR@_ÎôÈ�€dBfó”€NvHfÂ�"è2ØTÊî]­ˆR‘’� ³ö j§'BàÖ1‰ddAak…/DIJD… ’D2‘ÌH&L`&L† $Ex,6‹|Ö~_\©�¿Pœ‘ $™ýMH`I˜©=Ÿ @¨±Z|õÈÎÁ|ttv´gcåЕ—WTZ'¤õ3rŽÈîje"ܵx¾9ÿö›¯°W> ¹mb©Ñ|by¥ˆ•fFRx{wí%Dúõ�å¹Z½±€áCíÿÞüô$õwdüÀôðÖ�«ÞH¦mW÷nètaµ(ŠM<~;9¿ôáž]C/ñ_¸ãåŸ;÷ÉãÕ�«§æã‹Õ#Ÿ}ûÀáÉïoÿ`zS§áÚ·ù_>:;x컓§?Ÿ©yóÝ©�ÿ|}æ’~ûwam-/ž®7ž=¾0úìS÷5è»ØíR翚¾P"*Ö¯ IEND®B`‚graph-algorithms-planarity-08d7b51/doc/build/html/_static/default.css000066400000000000000000000077101522057144000257200ustar00rootroot00000000000000/* * default.css_t * ~~~~~~~~~~~~~ * * Sphinx stylesheet -- default theme. * * :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @import url("basic.css"); /* -- page layout ----------------------------------------------------------- */ body { font-family: sans-serif; font-size: 100%; background-color: #11303d; color: #000; margin: 0; padding: 0; } div.document { background-color: #1c4e63; } div.documentwrapper { float: left; width: 100%; } div.bodywrapper { margin: 0 0 0 230px; } div.body { background-color: #ffffff; color: #000000; padding: 0 20px 30px 20px; } div.footer { color: #ffffff; width: 100%; padding: 9px 0 9px 0; text-align: center; font-size: 75%; } div.footer a { color: #ffffff; text-decoration: underline; } div.related { background-color: #133f52; line-height: 30px; color: #ffffff; } div.related a { color: #ffffff; } div.sphinxsidebar { } div.sphinxsidebar h3 { font-family: 'Trebuchet MS', sans-serif; color: #ffffff; font-size: 1.4em; font-weight: normal; margin: 0; padding: 0; } div.sphinxsidebar h3 a { color: #ffffff; } div.sphinxsidebar h4 { font-family: 'Trebuchet MS', sans-serif; color: #ffffff; font-size: 1.3em; font-weight: normal; margin: 5px 0 0 0; padding: 0; } div.sphinxsidebar p { color: #ffffff; } div.sphinxsidebar p.topless { margin: 5px 10px 10px 10px; } div.sphinxsidebar ul { margin: 10px; padding: 0; color: #ffffff; } div.sphinxsidebar a { color: #98dbcc; } div.sphinxsidebar input { border: 1px solid #98dbcc; font-family: sans-serif; font-size: 1em; } /* -- hyperlink styles ------------------------------------------------------ */ a { color: #355f7c; text-decoration: none; } a:visited { color: #355f7c; text-decoration: none; } a:hover { text-decoration: underline; } /* -- body styles ----------------------------------------------------------- */ div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 { font-family: 'Trebuchet MS', sans-serif; background-color: #f2f2f2; font-weight: normal; color: #20435c; border-bottom: 1px solid #ccc; margin: 20px -20px 10px -20px; padding: 3px 0 3px 10px; } div.body h1 { margin-top: 0; font-size: 200%; } div.body h2 { font-size: 160%; } div.body h3 { font-size: 140%; } div.body h4 { font-size: 120%; } div.body h5 { font-size: 110%; } div.body h6 { font-size: 100%; } a.headerlink { color: #c60f0f; font-size: 0.8em; padding: 0 4px 0 4px; text-decoration: none; } a.headerlink:hover { background-color: #c60f0f; color: white; } div.body p, div.body dd, div.body li { text-align: justify; line-height: 130%; } div.admonition p.admonition-title + p { display: inline; } div.admonition p { margin-bottom: 5px; } div.admonition pre { margin-bottom: 5px; } div.admonition ul, div.admonition ol { margin-bottom: 5px; } div.note { background-color: #eee; border: 1px solid #ccc; } div.seealso { background-color: #ffc; border: 1px solid #ff6; } div.topic { background-color: #eee; } div.warning { background-color: #ffe4e4; border: 1px solid #f66; } p.admonition-title { display: inline; } p.admonition-title:after { content: ":"; } pre { padding: 5px; background-color: #eeffcc; color: #333333; line-height: 120%; border: 1px solid #ac9; border-left: none; border-right: none; } tt { background-color: #ecf0f3; padding: 0 1px 0 1px; font-size: 0.95em; } th { background-color: #ede; } .warning tt { background: #efc2c2; } .note tt { background: #d6d6d6; } .viewcode-back { font-family: sans-serif; } div.viewcode-block:target { background-color: #f4debf; border-top: 1px solid #ac9; border-bottom: 1px solid #ac9; }graph-algorithms-planarity-08d7b51/doc/build/html/_static/doctools.js000066400000000000000000000147331522057144000257510ustar00rootroot00000000000000/* * doctools.js * ~~~~~~~~~~~ * * Sphinx JavaScript utilities for all documentation. * * :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ /** * select a different prefix for underscore */ $u = _.noConflict(); /** * make the code below compatible with browsers without * an installed firebug like debugger if (!window.console || !console.firebug) { var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; window.console = {}; for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {}; } */ /** * small helper function to urldecode strings */ jQuery.urldecode = function(x) { return decodeURIComponent(x).replace(/\+/g, ' '); } /** * small helper function to urlencode strings */ jQuery.urlencode = encodeURIComponent; /** * This function returns the parsed url parameters of the * current request. Multiple values per key are supported, * it will always return arrays of strings for the value parts. */ jQuery.getQueryParameters = function(s) { if (typeof s == 'undefined') s = document.location.search; var parts = s.substr(s.indexOf('?') + 1).split('&'); var result = {}; for (var i = 0; i < parts.length; i++) { var tmp = parts[i].split('=', 2); var key = jQuery.urldecode(tmp[0]); var value = jQuery.urldecode(tmp[1]); if (key in result) result[key].push(value); else result[key] = [value]; } return result; }; /** * highlight a given string on a jquery object by wrapping it in * span elements with the given class name. */ jQuery.fn.highlightText = function(text, className) { function highlight(node) { if (node.nodeType == 3) { var val = node.nodeValue; var pos = val.toLowerCase().indexOf(text); if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { var span = document.createElement("span"); span.className = className; span.appendChild(document.createTextNode(val.substr(pos, text.length))); node.parentNode.insertBefore(span, node.parentNode.insertBefore( document.createTextNode(val.substr(pos + text.length)), node.nextSibling)); node.nodeValue = val.substr(0, pos); } } else if (!jQuery(node).is("button, select, textarea")) { jQuery.each(node.childNodes, function() { highlight(this); }); } } return this.each(function() { highlight(this); }); }; /** * Small JavaScript module for the documentation. */ var Documentation = { init : function() { this.fixFirefoxAnchorBug(); this.highlightSearchWords(); this.initIndexTable(); }, /** * i18n support */ TRANSLATIONS : {}, PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, LOCALE : 'unknown', // gettext and ngettext don't access this so that the functions // can safely bound to a different name (_ = Documentation.gettext) gettext : function(string) { var translated = Documentation.TRANSLATIONS[string]; if (typeof translated == 'undefined') return string; return (typeof translated == 'string') ? translated : translated[0]; }, ngettext : function(singular, plural, n) { var translated = Documentation.TRANSLATIONS[singular]; if (typeof translated == 'undefined') return (n == 1) ? singular : plural; return translated[Documentation.PLURALEXPR(n)]; }, addTranslations : function(catalog) { for (var key in catalog.messages) this.TRANSLATIONS[key] = catalog.messages[key]; this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); this.LOCALE = catalog.locale; }, /** * add context elements like header anchor links */ addContextElements : function() { $('div[id] > :header:first').each(function() { $('\u00B6'). attr('href', '#' + this.id). attr('title', _('Permalink to this headline')). appendTo(this); }); $('dt[id]').each(function() { $('\u00B6'). attr('href', '#' + this.id). attr('title', _('Permalink to this definition')). appendTo(this); }); }, /** * workaround a firefox stupidity */ fixFirefoxAnchorBug : function() { if (document.location.hash && $.browser.mozilla) window.setTimeout(function() { document.location.href += ''; }, 10); }, /** * highlight the search words provided in the url in the text */ highlightSearchWords : function() { var params = $.getQueryParameters(); var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; if (terms.length) { var body = $('div.body'); window.setTimeout(function() { $.each(terms, function() { body.highlightText(this.toLowerCase(), 'highlighted'); }); }, 10); $('') .appendTo($('#searchbox')); } }, /** * init the domain index toggle buttons */ initIndexTable : function() { var togglers = $('img.toggler').click(function() { var src = $(this).attr('src'); var idnum = $(this).attr('id').substr(7); $('tr.cg-' + idnum).toggle(); if (src.substr(-9) == 'minus.png') $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); else $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); }).css('display', ''); if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { togglers.click(); } }, /** * helper function to hide the search marks again */ hideSearchWords : function() { $('#searchbox .highlight-link').fadeOut(300); $('span.highlighted').removeClass('highlighted'); }, /** * make the url absolute */ makeURL : function(relativeURL) { return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; }, /** * get the current relative url */ getCurrentURL : function() { var path = document.location.pathname; var parts = path.split(/\//); $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { if (this == '..') parts.pop(); }); var url = parts.join('/'); return path.substring(url.lastIndexOf('/') + 1, path.length - 1); } }; // quick alias for translations _ = Documentation.gettext; $(document).ready(function() { Documentation.init(); }); graph-algorithms-planarity-08d7b51/doc/build/html/_static/down-pressed.png000066400000000000000000000005601522057144000266760ustar00rootroot00000000000000‰PNG  IHDRóÿasRGB®ÎébKGDùC» pHYs × ×B(›xtIMEÚ -vF#ðIDAT8ËÍÒ!OAàïÚJ, ++@ I v¢bÿ@Wñ7F’ HNâ±ú# ‚4¡8Ì6¹4×6Tñ’MvvÞ¼7³»êœûöD�s¿‡a�óx�â1†U îq‚;<¦ˆÏ E¸Â-f)âºj%ßpˆo4xFà78G…>æ)â-ƒ ž ¡ÂEYm4%7YTk-¾–Q¶a–"NWAo-y†eqÒá¾,�)â ÓÒYÓÑú´ptŽÐå½\hóq´Îím˜sÔz�¦ìG]ÄN�ñ�‡Òa…‡röçß¶¨s^lã vh\î2Ù%ðâßãŽ0EeRvØIEND®B`‚graph-algorithms-planarity-08d7b51/doc/build/html/_static/down.png000066400000000000000000000005531522057144000252350ustar00rootroot00000000000000‰PNG  IHDRóÿasRGB®ÎébKGDùC» pHYs × ×B(›xtIMEÚ"ÅíU{ëIDAT8ËÍÒ¡NCAÐóÚJ, ++@ ™4>‡¨â/ÐUü’¤�^,†~T�&Ô3M^^^ÛPÅM6ÙÙ¹sïÌî*¥ôí‰RJ¿‡a)e¼GñÃ*ƒœà�ñ¹¡èW¸Å<"®«Fò ‡øF�gÜã78G…>q ƒ†ÁOI¨p‘«‰:s“õAÕjñ5GÙ†yDœ®ƒ^+y†U:ép_%G§@D|aš�Õ­O“£s„Æ(ïy¡M,"â¨Íím˜sÔx�:÷£.b§@D|`–V˜åÙŸÛ²”²ÜÆìиÜe²KàÅ¿Ç/êG!‚ ™IEND®B`‚graph-algorithms-planarity-08d7b51/doc/build/html/_static/file.png000066400000000000000000000006101522057144000251770ustar00rootroot00000000000000‰PNG  IHDRóÿabKGDÿÿÿ ½§“ pHYs  šœtIMEÕ  )¶TIDAT8Ë­‘±JÄ@†¿Ir('[ "&xØÙYZ ‚Xø0‚!i|†_@±Ô÷•t§ÓDÄæÏ] ¹#¹Äxÿjv˜ùç› Y–ÐN‡ažE‘i«(ŠÌÄÉ™yž£µ@D¦£&±ˆ`Û6®ë–P¦Zk’$)5%"ôz½Ê.NñA#A�œba‘`Vsø¾_3ñc°,«™àä2m¼Ýñþjó [kŸìlv¹y|!IÕ´ðþyô;ÀðvÈé� "Œß®°—a©?ŸAúðÄ7Œ`ô˜ñÇc^énôk?¸²Bg}»TЙ¹D#ÁÑÞ "R¹D1÷£�çyüEŽRê*ŽãÝ6MJ©3þK_U«t8F~ÇIEND®B`‚graph-algorithms-planarity-08d7b51/doc/build/html/_static/jquery.js000066400000000000000000002672541522057144000254520ustar00rootroot00000000000000/*! jQuery v1.7.1 jquery.com | jquery.org/license */ (function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
"+""+"
",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
t
",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() {for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window);graph-algorithms-planarity-08d7b51/doc/build/html/_static/minus.png000066400000000000000000000003071522057144000254160ustar00rootroot00000000000000‰PNG  IHDR &Îàq pHYs  šœtIME× <®8åtEXtCommentöÌ–¿RIDATÓczô(BÅñãÇáÒpö¿ÿ¨èˆip»‘¹P÷îÝÃc· ¸ |¶IEND®B`‚graph-algorithms-planarity-08d7b51/doc/build/html/_static/pygments.css000066400000000000000000000075341522057144000261460ustar00rootroot00000000000000.highlight .hll { background-color: #ffffcc } .highlight { background: #eeffcc; } .highlight .c { color: #408090; font-style: italic } /* Comment */ .highlight .err { border: 1px solid #FF0000 } /* Error */ .highlight .k { color: #007020; font-weight: bold } /* Keyword */ .highlight .o { color: #666666 } /* Operator */ .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ .highlight .cp { color: #007020 } /* Comment.Preproc */ .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #A00000 } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #FF0000 } /* Generic.Error */ .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ .highlight .gi { color: #00A000 } /* Generic.Inserted */ .highlight .go { color: #303030 } /* Generic.Output */ .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ .highlight .gt { color: #0040D0 } /* Generic.Traceback */ .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #007020 } /* Keyword.Pseudo */ .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #902000 } /* Keyword.Type */ .highlight .m { color: #208050 } /* Literal.Number */ .highlight .s { color: #4070a0 } /* Literal.String */ .highlight .na { color: #4070a0 } /* Name.Attribute */ .highlight .nb { color: #007020 } /* Name.Builtin */ .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ .highlight .no { color: #60add5 } /* Name.Constant */ .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ .highlight .ne { color: #007020 } /* Name.Exception */ .highlight .nf { color: #06287e } /* Name.Function */ .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #bb60d5 } /* Name.Variable */ .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mf { color: #208050 } /* Literal.Number.Float */ .highlight .mh { color: #208050 } /* Literal.Number.Hex */ .highlight .mi { color: #208050 } /* Literal.Number.Integer */ .highlight .mo { color: #208050 } /* Literal.Number.Oct */ .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ .highlight .sc { color: #4070a0 } /* Literal.String.Char */ .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ .highlight .s2 { color: #4070a0 } /* Literal.String.Double */ .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ .highlight .sx { color: #c65d09 } /* Literal.String.Other */ .highlight .sr { color: #235388 } /* Literal.String.Regex */ .highlight .s1 { color: #4070a0 } /* Literal.String.Single */ .highlight .ss { color: #517918 } /* Literal.String.Symbol */ .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */graph-algorithms-planarity-08d7b51/doc/build/html/_static/searchtools.js000066400000000000000000000372551522057144000264550ustar00rootroot00000000000000/* * searchtools.js_t * ~~~~~~~~~~~~~~~~ * * Sphinx JavaScript utilties for the full-text search. * * :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ /** * helper function to return a node containing the * search summary for a given text. keywords is a list * of stemmed words, hlwords is the list of normal, unstemmed * words. the first one is used to find the occurance, the * latter for highlighting it. */ jQuery.makeSearchSummary = function(text, keywords, hlwords) { var textLower = text.toLowerCase(); var start = 0; $.each(keywords, function() { var i = textLower.indexOf(this.toLowerCase()); if (i > -1) start = i; }); start = Math.max(start - 120, 0); var excerpt = ((start > 0) ? '...' : '') + $.trim(text.substr(start, 240)) + ((start + 240 - text.length) ? '...' : ''); var rv = $('
').text(excerpt); $.each(hlwords, function() { rv = rv.highlightText(this, 'highlighted'); }); return rv; } /** * Porter Stemmer */ var Stemmer = function() { var step2list = { ational: 'ate', tional: 'tion', enci: 'ence', anci: 'ance', izer: 'ize', bli: 'ble', alli: 'al', entli: 'ent', eli: 'e', ousli: 'ous', ization: 'ize', ation: 'ate', ator: 'ate', alism: 'al', iveness: 'ive', fulness: 'ful', ousness: 'ous', aliti: 'al', iviti: 'ive', biliti: 'ble', logi: 'log' }; var step3list = { icate: 'ic', ative: '', alize: 'al', iciti: 'ic', ical: 'ic', ful: '', ness: '' }; var c = "[^aeiou]"; // consonant var v = "[aeiouy]"; // vowel var C = c + "[^aeiouy]*"; // consonant sequence var V = v + "[aeiou]*"; // vowel sequence var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 var s_v = "^(" + C + ")?" + v; // vowel in stem this.stemWord = function (w) { var stem; var suffix; var firstch; var origword = w; if (w.length < 3) return w; var re; var re2; var re3; var re4; firstch = w.substr(0,1); if (firstch == "y") w = firstch.toUpperCase() + w.substr(1); // Step 1a re = /^(.+?)(ss|i)es$/; re2 = /^(.+?)([^s])s$/; if (re.test(w)) w = w.replace(re,"$1$2"); else if (re2.test(w)) w = w.replace(re2,"$1$2"); // Step 1b re = /^(.+?)eed$/; re2 = /^(.+?)(ed|ing)$/; if (re.test(w)) { var fp = re.exec(w); re = new RegExp(mgr0); if (re.test(fp[1])) { re = /.$/; w = w.replace(re,""); } } else if (re2.test(w)) { var fp = re2.exec(w); stem = fp[1]; re2 = new RegExp(s_v); if (re2.test(stem)) { w = stem; re2 = /(at|bl|iz)$/; re3 = new RegExp("([^aeiouylsz])\\1$"); re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); if (re2.test(w)) w = w + "e"; else if (re3.test(w)) { re = /.$/; w = w.replace(re,""); } else if (re4.test(w)) w = w + "e"; } } // Step 1c re = /^(.+?)y$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; re = new RegExp(s_v); if (re.test(stem)) w = stem + "i"; } // Step 2 re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; suffix = fp[2]; re = new RegExp(mgr0); if (re.test(stem)) w = stem + step2list[suffix]; } // Step 3 re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; suffix = fp[2]; re = new RegExp(mgr0); if (re.test(stem)) w = stem + step3list[suffix]; } // Step 4 re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; re2 = /^(.+?)(s|t)(ion)$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; re = new RegExp(mgr1); if (re.test(stem)) w = stem; } else if (re2.test(w)) { var fp = re2.exec(w); stem = fp[1] + fp[2]; re2 = new RegExp(mgr1); if (re2.test(stem)) w = stem; } // Step 5 re = /^(.+?)e$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; re = new RegExp(mgr1); re2 = new RegExp(meq1); re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) w = stem; } re = /ll$/; re2 = new RegExp(mgr1); if (re.test(w) && re2.test(w)) { re = /.$/; w = w.replace(re,""); } // and turn initial Y back to y if (firstch == "y") w = firstch.toLowerCase() + w.substr(1); return w; } } /** * Search Module */ var Search = { _index : null, _queued_query : null, _pulse_status : -1, init : function() { var params = $.getQueryParameters(); if (params.q) { var query = params.q[0]; $('input[name="q"]')[0].value = query; this.performSearch(query); } }, loadIndex : function(url) { $.ajax({type: "GET", url: url, data: null, success: null, dataType: "script", cache: true}); }, setIndex : function(index) { var q; this._index = index; if ((q = this._queued_query) !== null) { this._queued_query = null; Search.query(q); } }, hasIndex : function() { return this._index !== null; }, deferQuery : function(query) { this._queued_query = query; }, stopPulse : function() { this._pulse_status = 0; }, startPulse : function() { if (this._pulse_status >= 0) return; function pulse() { Search._pulse_status = (Search._pulse_status + 1) % 4; var dotString = ''; for (var i = 0; i < Search._pulse_status; i++) dotString += '.'; Search.dots.text(dotString); if (Search._pulse_status > -1) window.setTimeout(pulse, 500); }; pulse(); }, /** * perform a search for something */ performSearch : function(query) { // create the required interface elements this.out = $('#search-results'); this.title = $('

' + _('Searching') + '

').appendTo(this.out); this.dots = $('').appendTo(this.title); this.status = $('

').appendTo(this.out); this.output = $('
'); } // Prettify the comment rating. comment.pretty_rating = comment.rating + ' point' + (comment.rating == 1 ? '' : 's'); // Make a class (for displaying not yet moderated comments differently) comment.css_class = comment.displayed ? '' : ' moderate'; // Create a div for this comment. var context = $.extend({}, opts, comment); var div = $(renderTemplate(commentTemplate, context)); // If the user has voted on this comment, highlight the correct arrow. if (comment.vote) { var direction = (comment.vote == 1) ? 'u' : 'd'; div.find('#' + direction + 'v' + comment.id).hide(); div.find('#' + direction + 'u' + comment.id).show(); } if (opts.moderator || comment.text != '[deleted]') { div.find('a.reply').show(); if (comment.proposal_diff) div.find('#sp' + comment.id).show(); if (opts.moderator && !comment.displayed) div.find('#cm' + comment.id).show(); if (opts.moderator || (opts.username == comment.username)) div.find('#dc' + comment.id).show(); } return div; } /** * A simple template renderer. Placeholders such as <%id%> are replaced * by context['id'] with items being escaped. Placeholders such as <#id#> * are not escaped. */ function renderTemplate(template, context) { var esc = $(document.createElement('div')); function handle(ph, escape) { var cur = context; $.each(ph.split('.'), function() { cur = cur[this]; }); return escape ? esc.text(cur || "").html() : cur; } return template.replace(/<([%#])([\w\.]*)\1>/g, function() { return handle(arguments[2], arguments[1] == '%' ? true : false); }); } /** Flash an error message briefly. */ function showError(message) { $(document.createElement('div')).attr({'class': 'popup-error'}) .append($(document.createElement('div')) .attr({'class': 'error-message'}).text(message)) .appendTo('body') .fadeIn("slow") .delay(2000) .fadeOut("slow"); } /** Add a link the user uses to open the comments popup. */ $.fn.comment = function() { return this.each(function() { var id = $(this).attr('id').substring(1); var count = COMMENT_METADATA[id]; var title = count + ' comment' + (count == 1 ? '' : 's'); var image = count > 0 ? opts.commentBrightImage : opts.commentImage; var addcls = count == 0 ? ' nocomment' : ''; $(this) .append( $(document.createElement('a')).attr({ href: '#', 'class': 'sphinx-comment-open' + addcls, id: 'ao' + id }) .append($(document.createElement('img')).attr({ src: image, alt: 'comment', title: title })) .click(function(event) { event.preventDefault(); show($(this).attr('id').substring(2)); }) ) .append( $(document.createElement('a')).attr({ href: '#', 'class': 'sphinx-comment-close hidden', id: 'ah' + id }) .append($(document.createElement('img')).attr({ src: opts.closeCommentImage, alt: 'close', title: 'close' })) .click(function(event) { event.preventDefault(); hide($(this).attr('id').substring(2)); }) ); }); }; var opts = { processVoteURL: '/_process_vote', addCommentURL: '/_add_comment', getCommentsURL: '/_get_comments', acceptCommentURL: '/_accept_comment', deleteCommentURL: '/_delete_comment', commentImage: '/static/_static/comment.png', closeCommentImage: '/static/_static/comment-close.png', loadingImage: '/static/_static/ajax-loader.gif', commentBrightImage: '/static/_static/comment-bright.png', upArrow: '/static/_static/up.png', downArrow: '/static/_static/down.png', upArrowPressed: '/static/_static/up-pressed.png', downArrowPressed: '/static/_static/down-pressed.png', voting: false, moderator: false }; if (typeof COMMENT_OPTIONS != "undefined") { opts = jQuery.extend(opts, COMMENT_OPTIONS); } var popupTemplate = '\
\

\ Sort by:\ best rated\ newest\ oldest\

\
Comments
\
\ loading comments...
\
    \
    \

    Add a comment\ (markup):

    \
    \ reStructured text markup: *emph*, **strong**, \ ``code``, \ code blocks: :: and an indented block after blank line
    \
    \ \

    \ \ Propose a change ▹\ \ \ Propose a change ▿\ \

    \ \ \ \ \ \
    \
    '; var commentTemplate = '\
    \
    \
    \ \ \ \ \ \ \
    \
    \ \ \ \ \ \ \
    \
    \
    \

    \ <%username%>\ <%pretty_rating%>\ <%time.delta%>\

    \
    <#text#>
    \

    \ \ reply ▿\ proposal ▹\ proposal ▿\ \ \

    \
    \
    <#proposal_diff#>\
            
    \
      \
      \
      \
      \ '; var replyTemplate = '\
    • \
      \
      \ \ \ \ \ \ \
      \
    • '; $(document).ready(function() { init(); }); })(jQuery); $(document).ready(function() { // add comment anchors for all paragraphs that are commentable $('.sphinx-has-comment').comment(); // highlight search words in search results $("div.context").each(function() { var params = $.getQueryParameters(); var terms = (params.q) ? params.q[0].split(/\s+/) : []; var result = $(this); $.each(terms, function() { result.highlightText(this.toLowerCase(), 'highlighted'); }); }); // directly open comment window if requested var anchor = document.location.hash; if (anchor.substring(0, 9) == '#comment-') { $('#ao' + anchor.substring(9)).click(); document.location.hash = '#s' + anchor.substring(9); } }); graph-algorithms-planarity-08d7b51/doc/build/html/genindex.html000066400000000000000000000160331522057144000246210ustar00rootroot00000000000000 Index — planarity 0.3 documentation

      Index

      A | D | I | K | M | N | P | W

      A

      ascii() (in module planarity.planarity_functions), [1]

      D

      draw() (in module planarity.planarity_networkx), [1]

      I

      is_planar() (in module planarity.planarity_functions), [1]

      K

      kuratowski_edges() (in module planarity.planarity_functions), [1]
      kuratowski_subgraph() (in module planarity.planarity_networkx), [1]

      M

      mapping() (in module planarity.planarity_functions), [1]

      N

      networkx_graph() (in module planarity.planarity_networkx), [1]

      P

      PGraph (class in planarity), [1]
      pgraph_graph() (in module planarity.planarity_networkx), [1]
      planarity.planarity_functions (module), [1]
      planarity.planarity_networkx (module), [1]

      W

      write() (in module planarity.planarity_functions), [1]
      graph-algorithms-planarity-08d7b51/doc/build/html/index.html000066400000000000000000000272641522057144000241370ustar00rootroot00000000000000 Planarity — planarity 0.3 documentation

      Planarity¶

      A Python interface to graph planarity algorithms.

      This provides a wrapper for Boyer’s (C) planarity algorithms: http://code.google.com/p/planarity/

      Release:0.3
      Date:June 09, 2013

      Functions¶

      Functional interface to planarity.

      planarity.planarity_functions.is_planar(graph)[source]¶

      Test planarity of graph.

      planarity.planarity_functions.kuratowski_edges(graph)[source]¶

      Return edges of forbidden subgraph of non-planar graph.

      planarity.planarity_functions.ascii(graph)[source]¶

      Draw text representation of a planar graph.

      planarity.planarity_functions.write(graph, path='stdout')[source]¶

      Write an adjacency list representation of graph to path.

      planarity.planarity_functions.mapping(graph)[source]¶

      Return dictionary of internal mapping of nodes to integers.

      NetworkX Interface¶

      NetworkX interface to planarity.

      planarity.planarity_networkx.kuratowski_subgraph(graph)[source]¶

      Return forbidden subgraph of nonplanar graph G.

      planarity.planarity_networkx.pgraph_graph(graph)[source]¶

      Return pgraph graph built from NetworkX graph.

      planarity.planarity_networkx.networkx_graph(pgraph)[source]¶

      Return NetworkX graph built from planarity pgraph.

      planarity.planarity_networkx.draw(graph, labels=True)[source]¶

      Draw planar graph with Matplotlib.

      Wrapper Class¶

      class planarity.PGraph¶

      Methods

      ascii
      edges
      embed_drawplanar
      embed_planar
      is_planar
      kuratowski_edges
      mapping
      nodes
      write

      Indices and tables¶

      Table Of Contents

      This Page

      graph-algorithms-planarity-08d7b51/doc/build/html/objects.inv000066400000000000000000000005521522057144000243000ustar00rootroot00000000000000# Sphinx inventory version 2 # Project: planarity # Version: 0.3 # The remainder of this file is compressed using zlib. xÚ­“KjÃ0†÷9… ÝÚ‰·¹@È¢èÌDšÈÂz¡‘q|û&‘m\p!Mµ£FŸþÑÃ8¡¬À£(.¨YQ1?fL”M4zË>�è4²ÓCÚH´+‹&u\‘J !ðægaÒÆ²¯Tp‰¯ÁBPq(稾v–Gå,ÝMLr±g¯ÐrÜ-¶LÙ⃫$‹±w¡½e•^ðMýÔÉ+«Ö¹¿çK ®ÔP³7 ÏãÉ€÷ÊÊ<0Eu’óàúû³œWÛˆ®§VÕÔ]2^éŒB"ý�z>Nn¸¢·[œ‚Œvñ—ÞtõáºH¸ograph-algorithms-planarity-08d7b51/doc/build/html/py-modindex.html000066400000000000000000000076101522057144000252560ustar00rootroot00000000000000 Python Module Index — planarity 0.3 documentation

      Python Module Index

      p
       
      p
      planarity
          planarity.planarity_functions
          planarity.planarity_networkx
      graph-algorithms-planarity-08d7b51/doc/build/html/reference/000077500000000000000000000000001522057144000240655ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/doc/build/html/reference/index.html000066400000000000000000000260351522057144000260700ustar00rootroot00000000000000 Reference — planarity 0.3 documentation

      Reference¶

      Release:0.3
      Date:June 09, 2013

      Functions¶

      Functional interface to planarity.

      planarity.planarity_functions.is_planar(graph)[source]¶

      Test planarity of graph.

      planarity.planarity_functions.kuratowski_edges(graph)[source]¶

      Return edges of forbidden subgraph of non-planar graph.

      planarity.planarity_functions.ascii(graph)[source]¶

      Draw text representation of a planar graph.

      planarity.planarity_functions.write(graph, path='stdout')[source]¶

      Write an adjacency list representation of graph to path.

      planarity.planarity_functions.mapping(graph)[source]¶

      Return dictionary of internal mapping of nodes to integers.

      NetworkX Interface¶

      NetworkX interface to planarity.

      planarity.planarity_networkx.kuratowski_subgraph(graph)[source]¶

      Return forbidden subgraph of nonplanar graph G.

      planarity.planarity_networkx.pgraph_graph(graph)[source]¶

      Return pgraph graph built from NetworkX graph.

      planarity.planarity_networkx.networkx_graph(pgraph)[source]¶

      Return NetworkX graph built from planarity pgraph.

      planarity.planarity_networkx.draw(graph, labels=True)[source]¶

      Draw planar graph with Matplotlib.

      Wrapper Class¶

      class planarity.PGraph¶

      Methods

      ascii
      edges
      embed_drawplanar
      embed_planar
      is_planar
      kuratowski_edges
      mapping
      nodes
      write

      Table Of Contents

      This Page

      graph-algorithms-planarity-08d7b51/doc/build/html/search.html000066400000000000000000000064361522057144000242730ustar00rootroot00000000000000 Search — planarity 0.3 documentation

      Search

      Please activate JavaScript to enable the search functionality.

      From here you can search these documents. Enter your search words into the box below and click "search". Note that the search function will automatically search for all of the words. Pages containing fewer words won't appear in the result list.

      graph-algorithms-planarity-08d7b51/doc/build/html/searchindex.js000066400000000000000000000026731522057144000247720ustar00rootroot00000000000000Search.setIndex({objects:{planarity:{planarity_functions:[1,0,1,""],PGraph:[1,2,1,""],planarity_networkx:[1,0,1,""]},"planarity.planarity_functions":{write:[1,1,1,""],is_planar:[1,1,1,""],ascii:[1,1,1,""],mapping:[1,1,1,""],kuratowski_edges:[1,1,1,""]},"planarity.planarity_networkx":{networkx_graph:[1,1,1,""],draw:[1,1,1,""],kuratowski_subgraph:[1,1,1,""],pgraph_graph:[1,1,1,""]}},terms:{represent:[0,1],planar:[0,1],code:0,edg:[0,1],stdout:[0,1],text:[0,1],forbidden:[0,1],planarity_funct:[0,1],non:[0,1],indic:0,planarity_networkx:[0,1],date:[0,1],intern:[0,1],networkx:[0,1],tabl:0,http:0,ascii:[0,1],pgraph_graph:[0,1],index:0,kuratowski_edg:[0,1],from:[0,1],googl:0,graph:[0,1],nonplanar:[0,1],wrapper:[0,1],label:[0,1],write:[0,1],adjac:[0,1],interfac:[0,1],test:[0,1],modul:0,refer:1,"function":[0,1],map:[0,1],draw:[0,1],sourc:[0,1],"return":[0,1],subgraph:[0,1],python:0,june:[0,1],kuratowski_subgraph:[0,1],networkx_graph:[0,1],is_planar:[0,1],embed_drawplanar:[0,1],matplotlib:[0,1],dictionari:[0,1],releas:[0,1],path:[0,1],"true":[0,1],"class":[0,1],built:[0,1],search:0,algorithm:0,provid:0,list:[0,1],node:[0,1],integ:[0,1],method:[0,1],thi:0,pgraph:[0,1],com:0,page:0,boyer:0,embed_planar:[0,1]},objtypes:{"0":"py:module","1":"py:function","2":"py:class"},titles:["Planarity","Reference"],objnames:{"0":["py","module","Python module"],"1":["py","function","Python function"],"2":["py","class","Python class"]},filenames:["index","reference/index"]})graph-algorithms-planarity-08d7b51/doc/source/000077500000000000000000000000001522057144000213645ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/doc/source/conf.py000066400000000000000000000177061522057144000226760ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # planarity documentation build configuration file, created by # sphinx-quickstart on Thu Jun 30 15:49:39 2011. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' sys.path.append(os.path.abspath('../sphinxext')) # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.pngmath', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode','sphinx.ext.autosummary','numpydoc'] #autosummary_generate=True # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = 'planarity' copyright = '2016, Aric Hagberg' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '0.3' # The full version, including alpha/beta/rc tags. release = '0.3' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'planaritydoc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'planarity.tex', u'planarity Documentation', u'Aric Hagberg', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Additional stuff for the LaTeX preamble. #latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'planarity', u'planarity Documentation', [u'Aric Hagberg'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------------ # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'planarity', u'planarity Documentation', u'Aric Hagberg', 'planarity', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {'http://docs.python.org/': None} graph-algorithms-planarity-08d7b51/doc/source/index.rst000066400000000000000000000014231522057144000232250ustar00rootroot00000000000000.. planarity documentation master file, created by sphinx-quickstart on Thu Jun 30 15:49:39 2011. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. Planarity ========= A Python interface to graph planarity algorithms. This provides a wrapper for Boyer's (C) planarity algorithms: http://code.google.com/p/planarity/ :Release: |version| :Date: |today| Functions --------- .. automodule:: planarity.planarity_functions :members: NetworkX Interface ------------------ .. automodule:: planarity.planarity_networkx :members: Wrapper Class ------------- .. autoclass:: planarity.PGraph .. automethod:: ascii Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` graph-algorithms-planarity-08d7b51/doc/source/reference/000077500000000000000000000000001522057144000233225ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/doc/source/reference/index.rst000066400000000000000000000005151522057144000251640ustar00rootroot00000000000000========= Reference ========= :Release: |version| :Date: |today| Functions --------- .. automodule:: planarity.planarity_functions :members: NetworkX Interface ------------------ .. automodule:: planarity.planarity_networkx :members: Wrapper Class ------------- .. autoclass:: planarity.PGraph .. automethod:: ascii graph-algorithms-planarity-08d7b51/doc/source/reference/index.rst~000066400000000000000000000005471522057144000253670ustar00rootroot00000000000000========= Reference ========= :Release: |version| :Date: |today| Functions --------- .. automodule:: nxtools.planarity.planarity_functions :members: NetworkX Interface ------------------ .. automodule:: nxtools.planarity.planarity_networkx :members: Wrapper Class ------------- .. autoclass:: nxtools.planarity.PGraph .. automethod:: ascii graph-algorithms-planarity-08d7b51/doc/sphinxext/000077500000000000000000000000001522057144000221165ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/doc/sphinxext/LICENSE.txt000066400000000000000000000030271522057144000237430ustar00rootroot00000000000000------------------------------------------------------------------------------- The files - numpydoc.py - autosummary.py - autosummary_generate.py - docscrape.py - docscrape_sphinx.py - phantom_import.py have the following license: Copyright (C) 2008 Stefan van der Walt , Pauli Virtanen Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. graph-algorithms-planarity-08d7b51/doc/sphinxext/docscrape.py000066400000000000000000000357051522057144000244450ustar00rootroot00000000000000"""Extract reference documentation from the NumPy source tree. """ import inspect import textwrap import re import pydoc from StringIO import StringIO from warnings import warn class Reader(object): """A line-based string reader. """ def __init__(self, data): """ Parameters ---------- data : str String with lines separated by '\n'. """ if isinstance(data,list): self._str = data else: self._str = data.split('\n') # store string as list of lines self.reset() def __getitem__(self, n): return self._str[n] def reset(self): self._l = 0 # current line nr def read(self): if not self.eof(): out = self[self._l] self._l += 1 return out else: return '' def seek_next_non_empty_line(self): for l in self[self._l:]: if l.strip(): break else: self._l += 1 def eof(self): return self._l >= len(self._str) def read_to_condition(self, condition_func): start = self._l for line in self[start:]: if condition_func(line): return self[start:self._l] self._l += 1 if self.eof(): return self[start:self._l+1] return [] def read_to_next_empty_line(self): self.seek_next_non_empty_line() def is_empty(line): return not line.strip() return self.read_to_condition(is_empty) def read_to_next_unindented_line(self): def is_unindented(line): return (line.strip() and (len(line.lstrip()) == len(line))) return self.read_to_condition(is_unindented) def peek(self,n=0): if self._l + n < len(self._str): return self[self._l + n] else: return '' def is_empty(self): return not ''.join(self._str).strip() class NumpyDocString(object): def __init__(self, docstring, config={}): docstring = textwrap.dedent(docstring).split('\n') self._doc = Reader(docstring) self._parsed_data = { 'Signature': '', 'Summary': [''], 'Extended Summary': [], 'Parameters': [], 'Returns': [], 'Raises': [], 'Warns': [], 'Other Parameters': [], 'Attributes': [], 'Methods': [], 'See Also': [], 'Notes': [], 'Warnings': [], 'References': '', 'Examples': '', 'index': {} } self._parse() def __getitem__(self,key): return self._parsed_data[key] def __setitem__(self,key,val): if not self._parsed_data.has_key(key): warn("Unknown section %s" % key) else: self._parsed_data[key] = val def _is_at_section(self): self._doc.seek_next_non_empty_line() if self._doc.eof(): return False l1 = self._doc.peek().strip() # e.g. Parameters if l1.startswith('.. index::'): return True l2 = self._doc.peek(1).strip() # ---------- or ========== return l2.startswith('-'*len(l1)) or l2.startswith('='*len(l1)) def _strip(self,doc): i = 0 j = 0 for i,line in enumerate(doc): if line.strip(): break for j,line in enumerate(doc[::-1]): if line.strip(): break return doc[i:len(doc)-j] def _read_to_next_section(self): section = self._doc.read_to_next_empty_line() while not self._is_at_section() and not self._doc.eof(): if not self._doc.peek(-1).strip(): # previous line was empty section += [''] section += self._doc.read_to_next_empty_line() return section def _read_sections(self): while not self._doc.eof(): data = self._read_to_next_section() name = data[0].strip() if name.startswith('..'): # index section yield name, data[1:] elif len(data) < 2: yield StopIteration else: yield name, self._strip(data[2:]) def _parse_param_list(self,content): r = Reader(content) params = [] while not r.eof(): header = r.read().strip() if ' : ' in header: arg_name, arg_type = header.split(' : ')[:2] else: arg_name, arg_type = header, '' desc = r.read_to_next_unindented_line() desc = dedent_lines(desc) params.append((arg_name,arg_type,desc)) return params _name_rgx = re.compile(r"^\s*(:(?P\w+):`(?P[a-zA-Z0-9_.-]+)`|" r" (?P[a-zA-Z0-9_.-]+))\s*", re.X) def _parse_see_also(self, content): """ func_name : Descriptive text continued text another_func_name : Descriptive text func_name1, func_name2, :meth:`func_name`, func_name3 """ items = [] def parse_item_name(text): """Match ':role:`name`' or 'name'""" m = self._name_rgx.match(text) if m: g = m.groups() if g[1] is None: return g[3], None else: return g[2], g[1] raise ValueError("%s is not a item name" % text) def push_item(name, rest): if not name: return name, role = parse_item_name(name) items.append((name, list(rest), role)) del rest[:] current_func = None rest = [] for line in content: if not line.strip(): continue m = self._name_rgx.match(line) if m and line[m.end():].strip().startswith(':'): push_item(current_func, rest) current_func, line = line[:m.end()], line[m.end():] rest = [line.split(':', 1)[1].strip()] if not rest[0]: rest = [] elif not line.startswith(' '): push_item(current_func, rest) current_func = None if ',' in line: for func in line.split(','): if func.strip(): push_item(func, []) elif line.strip(): current_func = line elif current_func is not None: rest.append(line.strip()) push_item(current_func, rest) return items def _parse_index(self, section, content): """ .. index: default :refguide: something, else, and more """ def strip_each_in(lst): return [s.strip() for s in lst] out = {} section = section.split('::') if len(section) > 1: out['default'] = strip_each_in(section[1].split(','))[0] for line in content: line = line.split(':') if len(line) > 2: out[line[1]] = strip_each_in(line[2].split(',')) return out def _parse_summary(self): """Grab signature (if given) and summary""" if self._is_at_section(): return summary = self._doc.read_to_next_empty_line() summary_str = " ".join([s.strip() for s in summary]).strip() if re.compile('^([\w., ]+=)?\s*[\w\.]+\(.*\)$').match(summary_str): self['Signature'] = summary_str if not self._is_at_section(): self['Summary'] = self._doc.read_to_next_empty_line() else: self['Summary'] = summary if not self._is_at_section(): self['Extended Summary'] = self._read_to_next_section() def _parse(self): self._doc.reset() self._parse_summary() for (section,content) in self._read_sections(): if not section.startswith('..'): section = ' '.join([s.capitalize() for s in section.split(' ')]) if section in ('Parameters', 'Returns', 'Raises', 'Warns', 'Other Parameters', 'Attributes', 'Methods'): self[section] = self._parse_param_list(content) elif section.startswith('.. index::'): self['index'] = self._parse_index(section, content) elif section == 'See Also': self['See Also'] = self._parse_see_also(content) else: self[section] = content # string conversion routines def _str_header(self, name, symbol='-'): return [name, len(name)*symbol] def _str_indent(self, doc, indent=4): out = [] for line in doc: out += [' '*indent + line] return out def _str_signature(self): if self['Signature']: return [self['Signature'].replace('*','\*')] + [''] else: return [''] def _str_summary(self): if self['Summary']: return self['Summary'] + [''] else: return [] def _str_extended_summary(self): if self['Extended Summary']: return self['Extended Summary'] + [''] else: return [] def _str_param_list(self, name): out = [] if self[name]: out += self._str_header(name) for param,param_type,desc in self[name]: out += ['%s : %s' % (param, param_type)] out += self._str_indent(desc) out += [''] return out def _str_section(self, name): out = [] if self[name]: out += self._str_header(name) out += self[name] out += [''] return out def _str_see_also(self, func_role): if not self['See Also']: return [] out = [] out += self._str_header("See Also") last_had_desc = True for func, desc, role in self['See Also']: if role: link = ':%s:`%s`' % (role, func) elif func_role: link = ':%s:`%s`' % (func_role, func) else: link = "`%s`_" % func if desc or last_had_desc: out += [''] out += [link] else: out[-1] += ", %s" % link if desc: out += self._str_indent([' '.join(desc)]) last_had_desc = True else: last_had_desc = False out += [''] return out def _str_index(self): idx = self['index'] out = [] out += ['.. index:: %s' % idx.get('default','')] for section, references in idx.iteritems(): if section == 'default': continue out += [' :%s: %s' % (section, ', '.join(references))] return out def __str__(self, func_role=''): out = [] out += self._str_signature() out += self._str_summary() out += self._str_extended_summary() for param_list in ('Parameters', 'Returns', 'Other Parameters', 'Raises', 'Warns'): out += self._str_param_list(param_list) out += self._str_section('Warnings') out += self._str_see_also(func_role) for s in ('Notes','References','Examples'): out += self._str_section(s) for param_list in ('Attributes', 'Methods'): out += self._str_param_list(param_list) out += self._str_index() return '\n'.join(out) def indent(str,indent=4): indent_str = ' '*indent if str is None: return indent_str lines = str.split('\n') return '\n'.join(indent_str + l for l in lines) def dedent_lines(lines): """Deindent a list of lines maximally""" return textwrap.dedent("\n".join(lines)).split("\n") def header(text, style='-'): return text + '\n' + style*len(text) + '\n' class FunctionDoc(NumpyDocString): def __init__(self, func, role='func', doc=None, config={}): self._f = func self._role = role # e.g. "func" or "meth" if doc is None: if func is None: raise ValueError("No function or docstring given") doc = inspect.getdoc(func) or '' NumpyDocString.__init__(self, doc) if not self['Signature'] and func is not None: func, func_name = self.get_func() try: # try to read signature argspec = inspect.getargspec(func) argspec = inspect.formatargspec(*argspec) argspec = argspec.replace('*','\*') signature = '%s%s' % (func_name, argspec) except TypeError, e: signature = '%s()' % func_name self['Signature'] = signature def get_func(self): func_name = getattr(self._f, '__name__', self.__class__.__name__) if inspect.isclass(self._f): func = getattr(self._f, '__call__', self._f.__init__) else: func = self._f return func, func_name def __str__(self): out = '' func, func_name = self.get_func() signature = self['Signature'].replace('*', '\*') roles = {'func': 'function', 'meth': 'method'} if self._role: if not roles.has_key(self._role): print "Warning: invalid role %s" % self._role out += '.. %s:: %s\n \n\n' % (roles.get(self._role,''), func_name) out += super(FunctionDoc, self).__str__(func_role=self._role) return out class ClassDoc(NumpyDocString): def __init__(self, cls, doc=None, modulename='', func_doc=FunctionDoc, config={}): if not inspect.isclass(cls) and cls is not None: raise ValueError("Expected a class or None, but got %r" % cls) self._cls = cls if modulename and not modulename.endswith('.'): modulename += '.' self._mod = modulename if doc is None: if cls is None: raise ValueError("No class or documentation string given") doc = pydoc.getdoc(cls) NumpyDocString.__init__(self, doc) if config.get('show_class_members', True): if not self['Methods']: self['Methods'] = [(name, '', '') for name in sorted(self.methods)] if not self['Attributes']: self['Attributes'] = [(name, '', '') for name in sorted(self.properties)] @property def methods(self): if self._cls is None: return [] return [name for name,func in inspect.getmembers(self._cls) if not name.startswith('_') and callable(func)] @property def properties(self): if self._cls is None: return [] return [name for name,func in inspect.getmembers(self._cls) if not name.startswith('_') and func is None] graph-algorithms-planarity-08d7b51/doc/sphinxext/docscrape.pyc000066400000000000000000000451151522057144000246040ustar00rootroot00000000000000ó Ë´Qc@sÓdZddlZddlZddlZddlZddlmZddlmZdefd„ƒYZ defd„ƒYZ d d „Z d „Z d d „Z de fd„ƒYZde fd„ƒYZdS(s=Extract reference documentation from the NumPy source tree. iÿÿÿÿN(tStringIO(twarntReadercBsteZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d d „Z d „Z RS( s!A line-based string reader. cCs;t|tƒr||_n|jdƒ|_|jƒdS(sr Parameters ---------- data : str String with lines separated by ' '. s N(t isinstancetlistt_strtsplittreset(tselftdata((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pyt__init__s cCs |j|S(N(R(Rtn((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pyt __getitem__scCs d|_dS(Ni(t_l(R((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pyR"scCs4|jƒs,||j}|jd7_|SdSdS(Nit(teofR (Rtout((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pytread%s   cCs;x4||jD]%}|jƒr$Pq|jd7_qWdS(Ni(R tstrip(Rtl((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pytseek_next_non_empty_line-s cCs|jt|jƒkS(N(R tlenR(R((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pyR4scCsi|j}xY||D]M}||ƒr4|||j!S|jd7_|jƒr|||jd!SqWgS(Ni(R R(Rtcondition_functstarttline((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pytread_to_condition7s   cCs |jƒd„}|j|ƒS(NcSs |jƒ S(N(R(R((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pytis_emptyCs(RR(RR((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pytread_to_next_empty_lineAs  cCsd„}|j|ƒS(NcSs(|jƒo't|jƒƒt|ƒkS(N(RRtlstrip(R((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pyt is_unindentedHs(R(RR((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pytread_to_next_unindented_lineGs icCs3|j|t|jƒkr+||j|SdSdS(NR(R RR(RR ((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pytpeekLscCsdj|jƒjƒ S(NR(tjoinRR(R((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pyRRs(t__name__t __module__t__doc__R R RRRRRRRRR(((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pyR s         tNumpyDocStringcBsïeZid„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z e j de j ƒZ d „Zd „Zd „Zd „Zd d„Zdd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zdd„ZRS(cCs±tj|ƒjdƒ}t|ƒ|_idd6dgd6gd6gd6gd6gd6gd 6gd 6gd 6gd 6gd 6gd6gd6dd6dd6id6|_|jƒdS(Ns Rt SignaturetSummarysExtended Summaryt ParameterstReturnstRaisestWarnssOther Parameterst AttributestMethodssSee AlsotNotestWarningst ReferencestExamplestindex(ttextwraptdedentRRt_doct _parsed_datat_parse(Rt docstringtconfig((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pyR Ws(  cCs |j|S(N(R5(Rtkey((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pyR pscCs4|jj|ƒs#td|ƒn ||j|\w+):`(?P[a-zA-Z0-9_.-]+)`| (?P[a-zA-Z0-9_.-]+))\s*cs¢g‰‡fd†‰‡‡fd†}d}g}x[|D]S}|jƒsRq:nˆjj|ƒ}|rì||jƒjƒjdƒrì|||ƒ||jƒ ||jƒ}}|jddƒdjƒg}|ds�g}q�q:|jdƒsk|||ƒd}d|krSxK|jdƒD]"}|jƒr*||gƒq*q*Wq�|jƒr�|}q�q:|dk r:|j|jƒƒq:q:W|||ƒˆS( sµ func_name : Descriptive text continued text another_func_name : Descriptive text func_name1, func_name2, :meth:`func_name`, func_name3 cskˆjj|ƒ}|rW|jƒ}|ddkrB|ddfS|d|dfSntd|ƒ‚dS(sMatch ':role:`name`' or 'name'iiis%s is not a item nameN(t _name_rgxtmatchtgroupstNonet ValueError(ttexttmtg(R(sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pytparse_item_nameÇs cs@|s dSˆ|ƒ\}}ˆj|t|ƒ|fƒ|2dS(N(RPR(RMtresttrole(titemsRa(sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pyt push_itemÒs t:iit t,N(R\RRYRZtendR@RRP(RRQRet current_funcRbRR_tfunc((RdRRasA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pyt_parse_see_also½s8   % !         cCs®d„}i}|jdƒ}t|ƒdkrT||djdƒƒd|d\}}|dkrXq:n|d|dj|ƒfg7}q:W|S(NR1s .. index:: %sRpRs :%s: %ss, (tgett iteritemsR (RtidxRRJt references((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pyt _str_indexqs  $RcCsåg}||jƒ7}||jƒ7}||jƒ7}x!d D]}||j|ƒ7}q=W||jdƒ7}||j|ƒ7}x!dD]}||j|ƒ7}q‡Wx!dD]}||j|ƒ7}q«W||jƒ7}d j|ƒS(NR'R(sOther ParametersR)R*R.R-R/R0R+R,s (s ParameterssReturnssOther ParameterssRaisessWarns(sNotess ReferencessExamples(s AttributessMethods(R~RR€RƒR„RˆR�R (RR…Rt param_listRn((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pyt__str__{s   (R!R"R R R<RDRIRKRNRXRrRstXRYRlRqRvR6RyR{R~RR€RƒR„RˆR�R�(((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pyR$Vs0        7           icsFd|‰|dkrˆS|jdƒ}dj‡fd†|DƒƒS(NRgs c3s|]}ˆ|VqdS(N((t.0R(t indent_str(sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pys ’s(R\RR (tstrRztlines((R’sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pyRz�s   cCstjdj|ƒƒjdƒS(s"Deindent a list of lines maximallys (R2R3R R(R”((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pyRO”sR=cCs|d|t|ƒdS(Ns (R(R^tstyle((sA/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape.pyRT˜st FunctionDoccBs,eZddid„Zd„Zd„ZRS(Rkc Csÿ||_||_|dkrQ|dkr9tdƒ‚ntj|ƒpKd}ntj||ƒ|d rû|dk rû|jƒ\}}yDtj |ƒ}tj |Œ}|j ddƒ}d||f}Wnt k rí}d|}nX||dtj|ƒ r/|dk r/td|ƒ‚n||_|r[|jdƒ r[|d7}n||_|dkr�|dkr‹tdƒ‚ntj|ƒ}nt j ||ƒ|j dt ƒr:|dsûgt |jƒD]}|ddf^qÙ|ds    Jÿ8   2graph-algorithms-planarity-08d7b51/doc/sphinxext/docscrape_sphinx.py000066400000000000000000000171171522057144000260330ustar00rootroot00000000000000import re, inspect, textwrap, pydoc import sphinx from docscrape import NumpyDocString, FunctionDoc, ClassDoc class SphinxDocString(NumpyDocString): def __init__(self, docstring, config={}): self.use_plots = config.get('use_plots', False) NumpyDocString.__init__(self, docstring, config=config) # string conversion routines def _str_header(self, name, symbol='`'): return ['.. rubric:: ' + name, ''] def _str_field_list(self, name): return [':' + name + ':'] def _str_indent(self, doc, indent=4): out = [] for line in doc: out += [' '*indent + line] return out def _str_signature(self): return [''] if self['Signature']: return ['``%s``' % self['Signature']] + [''] else: return [''] def _str_summary(self): return self['Summary'] + [''] def _str_extended_summary(self): return self['Extended Summary'] + [''] def _str_param_list(self, name): out = [] if self[name]: out += self._str_field_list(name) out += [''] for param,param_type,desc in self[name]: out += self._str_indent(['**%s** : %s' % (param.strip(), param_type)]) out += [''] out += self._str_indent(desc,8) out += [''] return out @property def _obj(self): if hasattr(self, '_cls'): return self._cls elif hasattr(self, '_f'): return self._f return None def _str_member_list(self, name): """ Generate a member listing, autosummary:: table where possible, and a table where not. """ out = [] if self[name]: out += ['.. rubric:: %s' % name, ''] prefix = getattr(self, '_name', '') if prefix: prefix = '~%s.' % prefix autosum = [] others = [] for param, param_type, desc in self[name]: param = param.strip() if not self._obj or hasattr(self._obj, param): autosum += [" %s%s" % (prefix, param)] else: others.append((param, param_type, desc)) if autosum: out += ['.. autosummary::', ' :toctree:', ''] out += autosum if others: maxlen_0 = max([len(x[0]) for x in others]) maxlen_1 = max([len(x[1]) for x in others]) hdr = "="*maxlen_0 + " " + "="*maxlen_1 + " " + "="*10 fmt = '%%%ds %%%ds ' % (maxlen_0, maxlen_1) n_indent = maxlen_0 + maxlen_1 + 4 out += [hdr] for param, param_type, desc in others: out += [fmt % (param.strip(), param_type)] out += self._str_indent(desc, n_indent) out += [hdr] out += [''] return out def _str_section(self, name): out = [] if self[name]: out += self._str_header(name) out += [''] content = textwrap.dedent("\n".join(self[name])).split("\n") out += content out += [''] return out def _str_see_also(self, func_role): out = [] if self['See Also']: see_also = super(SphinxDocString, self)._str_see_also(func_role) out = ['.. seealso::', ''] out += self._str_indent(see_also[2:]) return out def _str_warnings(self): out = [] if self['Warnings']: out = ['.. warning::', ''] out += self._str_indent(self['Warnings']) return out def _str_index(self): idx = self['index'] out = [] if len(idx) == 0: return out out += ['.. index:: %s' % idx.get('default','')] for section, references in idx.iteritems(): if section == 'default': continue elif section == 'refguide': out += [' single: %s' % (', '.join(references))] else: out += [' %s: %s' % (section, ','.join(references))] return out def _str_references(self): out = [] if self['References']: out += self._str_header('References') if isinstance(self['References'], str): self['References'] = [self['References']] out.extend(self['References']) out += [''] # Latex collects all references to a separate bibliography, # so we need to insert links to it if sphinx.__version__ >= "0.6": out += ['.. only:: latex',''] else: out += ['.. latexonly::',''] items = [] for line in self['References']: m = re.match(r'.. \[([a-z0-9._-]+)\]', line, re.I) if m: items.append(m.group(1)) out += [' ' + ", ".join(["[%s]_" % item for item in items]), ''] return out def _str_examples(self): examples_str = "\n".join(self['Examples']) if (self.use_plots and 'import matplotlib' in examples_str and 'plot::' not in examples_str): out = [] out += self._str_header('Examples') out += ['.. plot::', ''] out += self._str_indent(self['Examples']) out += [''] return out else: return self._str_section('Examples') def __str__(self, indent=0, func_role="obj"): out = [] out += self._str_signature() out += self._str_index() + [''] out += self._str_summary() out += self._str_extended_summary() for param_list in ('Parameters', 'Returns', 'Other Parameters', 'Raises', 'Warns'): out += self._str_param_list(param_list) out += self._str_warnings() out += self._str_see_also(func_role) out += self._str_section('Notes') out += self._str_references() out += self._str_examples() for param_list in ('Attributes', 'Methods'): out += self._str_member_list(param_list) out = self._str_indent(out,indent) return '\n'.join(out) class SphinxFunctionDoc(SphinxDocString, FunctionDoc): def __init__(self, obj, doc=None, config={}): self.use_plots = config.get('use_plots', False) FunctionDoc.__init__(self, obj, doc=doc, config=config) class SphinxClassDoc(SphinxDocString, ClassDoc): def __init__(self, obj, doc=None, func_doc=None, config={}): self.use_plots = config.get('use_plots', False) ClassDoc.__init__(self, obj, doc=doc, func_doc=None, config=config) class SphinxObjDoc(SphinxDocString): def __init__(self, obj, doc=None, config={}): self._f = obj SphinxDocString.__init__(self, doc, config=config) def get_doc_object(obj, what=None, doc=None, config={}): if what is None: if inspect.isclass(obj): what = 'class' elif inspect.ismodule(obj): what = 'module' elif callable(obj): what = 'function' else: what = 'object' if what == 'class': return SphinxClassDoc(obj, func_doc=SphinxFunctionDoc, doc=doc, config=config) elif what in ('function', 'method'): return SphinxFunctionDoc(obj, doc=doc, config=config) else: if doc is None: doc = pydoc.getdoc(obj) return SphinxObjDoc(obj, doc, config=config) graph-algorithms-planarity-08d7b51/doc/sphinxext/docscrape_sphinx.pyc000066400000000000000000000233631522057144000261760ustar00rootroot00000000000000ó Ë´Qc@sÌddlZddlZddlZddlZddlZddlmZmZmZdefd„ƒYZ de efd„ƒYZ de efd„ƒYZ d e fd „ƒYZ ddid „ZdS( iÿÿÿÿN(tNumpyDocStringt FunctionDoctClassDoctSphinxDocStringcBs¶eZid„Zdd„Zd„Zdd„Zd„Zd„Zd„Zd „Z e d „ƒZ d „Z d „Z d „Zd„Zd„Zd„Zd„Zddd„ZRS(cCs/|jdtƒ|_tj||d|ƒdS(Nt use_plotstconfig(tgettFalseRRt__init__(tselft docstringR((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyRst`cCsd|dgS(Ns .. rubric:: t((R tnametsymbol((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyt _str_header scCsd|dgS(Nt:((R R ((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyt_str_field_listsicCs0g}x#|D]}|d||g7}q W|S(Nt ((R tdoctindenttouttline((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyt _str_indents cCs2dgS|dr'd|dgdgSdgSdS(NR t Signatures``%s``((R ((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyt_str_signatures cCs|ddgS(NtSummaryR ((R ((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyt _str_summaryscCs|ddgS(NsExtended SummaryR ((R ((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyt_str_extended_summary!scCs«g}||r§||j|ƒ7}|dg7}xt||D]e\}}}||jd|jƒ|fgƒ7}|dg7}||j|dƒ7}|dg7}q;Wn|S(NR s **%s** : %si(RRtstrip(R R Rtparamt param_typetdesc((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyt_str_param_list$s   cCs0t|dƒr|jSt|dƒr,|jSdS(Nt_clst_f(thasattrR"R#tNone(R ((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyt_obj1s cCsg}||rÿ|d|dg7}t|ddƒ}|rId|}ng}g}xs||D]g\}}}|jƒ}|j s—t|j|ƒr±|d||fg7}q`|j|||fƒq`W|rñ|dddg7}||7}n|rïtg|D]} t| dƒ^qƒ} tg|D]} t| d ƒ^q*ƒ} d | d d | d d} d | | f} | | d}|| g7}xJ|D]B\}}}|| |jƒ|fg7}||j||ƒ7}q™W|| g7}n|dg7}n|S(sp Generate a member listing, autosummary:: table where possible, and a table where not. s.. rubric:: %sR t_names~%s.s %s%ss.. autosummary::s :toctree:iit=s i s%%%ds %%%ds is ==========(tgetattrRR&R$tappendtmaxtlenR(R R RtprefixtautosumtothersRRR txtmaxlen_0tmaxlen_1thdrtfmttn_indent((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyt_str_member_list9s:    )) cCssg}||ro||j|ƒ7}|dg7}tjdj||ƒƒjdƒ}||7}|dg7}n|S(NR s (Rttextwraptdedenttjointsplit(R R Rtcontent((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyt _str_sectionbs  % cCsRg}|drNtt|ƒj|ƒ}ddg}||j|dƒ7}n|S(NsSee Alsos .. seealso::R i(tsuperRt _str_see_alsoR(R t func_roleRtsee_also((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyR>ls   cCs:g}|dr6ddg}||j|dƒ7}n|S(NtWarningss .. warning::R (R(R R((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyt _str_warningsts   cCs¿|d}g}t|ƒdkr&|S|d|jddƒg7}xu|jƒD]g\}}|dkrnqPqP|dkr—|ddj|ƒg7}qP|d |d j|ƒfg7}qPW|S( Ntindexis .. index:: %stdefaultR trefguides single: %ss, s %s: %st,(R,Rt iteritemsR9(R tidxRtsectiont references((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyt _str_index{s   $cCs'g}|dr#||jdƒ7}t|dtƒrJ|dg|dR<RYR\R6RR9(R RR?Rt param_list((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyt__str__¯s"  (t__name__t __module__RRRRRRRR!tpropertyR&R6R<R>RBRKRYR\Rf(((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyRs"         )     tSphinxFunctionDoccBseZdid„ZRS(cCs5|jdtƒ|_tj||d|d|ƒdS(NRRR(RRRRR(R R]RR((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyRÃsN(RgRhR%R(((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyRjÂstSphinxClassDoccBseZddid„ZRS(c Cs;|jdtƒ|_tj||d|ddd|ƒdS(NRRtfunc_docR(RRRRRR%(R R]RRlR((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyRÈsN(RgRhR%R(((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyRkÇst SphinxObjDoccBseZdid„ZRS(cCs#||_tj||d|ƒdS(NR(R#RR(R R]RR((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyRÍs N(RgRhR%R(((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyRmÌscCsÙ|dkrZtj|ƒr$d}qZtj|ƒr<d}qZt|ƒrQd}qZd}n|dkr‚t|dtd|d|ƒS|d kr¤t|d|d|ƒS|dkrÂtj|ƒ}nt ||d|ƒSdS( NtclasstmoduletfunctiontobjectRlRRtmethod(sfunctionsmethod( R%tinspecttisclasstismoduletcallableRkRjtpydoctgetdocRm(R]twhatRR((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pytget_doc_objectÑs          (RRRsR7RwRPt docscrapeRRRRRjRkRmR%Rz(((sH/home/aric/Software/Projects/planarity/doc/sphinxext/docscrape_sphinx.pyts0 ½graph-algorithms-planarity-08d7b51/doc/sphinxext/numpydoc.py000066400000000000000000000130711522057144000243300ustar00rootroot00000000000000""" ======== numpydoc ======== Sphinx extension that handles docstrings in the Numpy standard format. [1] It will: - Convert Parameters etc. sections to field lists. - Convert See Also section to a See also entry. - Renumber references. - Extract the signature from the docstring, if it can't be determined otherwise. .. [1] http://projects.scipy.org/numpy/wiki/CodingStyleGuidelines#docstring-standard """ import sphinx if sphinx.__version__ < '1.0.1': raise RuntimeError("Sphinx 1.0.1 or newer is required") import os, re, pydoc from docscrape_sphinx import get_doc_object, SphinxDocString from sphinx.util.compat import Directive import inspect def mangle_docstrings(app, what, name, obj, options, lines, reference_offset=[0]): cfg = dict(use_plots=app.config.numpydoc_use_plots, show_class_members=app.config.numpydoc_show_class_members) if what == 'module': # Strip top title title_re = re.compile(ur'^\s*[#*=]{4,}\n[a-z0-9 -]+\n[#*=]{4,}\s*', re.I|re.S) lines[:] = title_re.sub(u'', u"\n".join(lines)).split(u"\n") else: doc = get_doc_object(obj, what, u"\n".join(lines), config=cfg) lines[:] = unicode(doc).split(u"\n") if app.config.numpydoc_edit_link and hasattr(obj, '__name__') and \ obj.__name__: if hasattr(obj, '__module__'): v = dict(full_name=u"%s.%s" % (obj.__module__, obj.__name__)) else: v = dict(full_name=obj.__name__) lines += [u'', u'.. htmlonly::', ''] lines += [u' %s' % x for x in (app.config.numpydoc_edit_link % v).split("\n")] # replace reference numbers so that there are no duplicates references = [] for line in lines: line = line.strip() m = re.match(ur'^.. \[([a-z0-9_.-])\]', line, re.I) if m: references.append(m.group(1)) # start renaming from the longest string, to avoid overwriting parts references.sort(key=lambda x: -len(x)) if references: for i, line in enumerate(lines): for r in references: if re.match(ur'^\d+$', r): new_r = u"R%d" % (reference_offset[0] + int(r)) else: new_r = u"%s%d" % (r, reference_offset[0]) lines[i] = lines[i].replace(u'[%s]_' % r, u'[%s]_' % new_r) lines[i] = lines[i].replace(u'.. [%s]' % r, u'.. [%s]' % new_r) reference_offset[0] += len(references) def mangle_signature(app, what, name, obj, options, sig, retann): # Do not try to inspect classes that don't define `__init__` if (inspect.isclass(obj) and (not hasattr(obj, '__init__') or 'initializes x; see ' in pydoc.getdoc(obj.__init__))): return '', '' if not (callable(obj) or hasattr(obj, '__argspec_is_invalid_')): return if not hasattr(obj, '__doc__'): return doc = SphinxDocString(pydoc.getdoc(obj)) if doc['Signature']: sig = re.sub(u"^[^(]*", u"", doc['Signature']) return sig, u'' def setup(app, get_doc_object_=get_doc_object): global get_doc_object get_doc_object = get_doc_object_ app.connect('autodoc-process-docstring', mangle_docstrings) app.connect('autodoc-process-signature', mangle_signature) app.add_config_value('numpydoc_edit_link', None, False) app.add_config_value('numpydoc_use_plots', None, False) app.add_config_value('numpydoc_show_class_members', True, True) # Extra mangling domains #app.add_domain(NumpyPythonDomain) app.add_domain(NumpyCDomain) #------------------------------------------------------------------------------ # Docstring-mangling domains #------------------------------------------------------------------------------ from docutils.statemachine import ViewList from sphinx.domains.c import CDomain from sphinx.domains.python import PythonDomain class ManglingDomainBase(object): directive_mangling_map = {} def __init__(self, *a, **kw): super(ManglingDomainBase, self).__init__(*a, **kw) self.wrap_mangling_directives() def wrap_mangling_directives(self): for name, objtype in self.directive_mangling_map.items(): self.directives[name] = wrap_mangling_directive( self.directives[name], objtype) class NumpyPythonDomain(ManglingDomainBase, PythonDomain): name = 'np' directive_mangling_map = { 'function': 'function', 'class': 'class', 'exception': 'class', 'method': 'function', 'classmethod': 'function', 'staticmethod': 'function', 'attribute': 'attribute', } class NumpyCDomain(ManglingDomainBase, CDomain): name = 'np-c' directive_mangling_map = { 'function': 'function', 'member': 'attribute', 'macro': 'function', 'type': 'class', 'var': 'object', } def wrap_mangling_directive(base_directive, objtype): class directive(base_directive): def run(self): env = self.state.document.settings.env name = None if self.arguments: m = re.match(r'^(.*\s+)?(.*?)(\(.*)?', self.arguments[0]) name = m.group(2).strip() if not name: name = self.arguments[0] lines = list(self.content) mangle_docstrings(env.app, objtype, name, None, None, lines) self.content = ViewList(lines, self.content.parent) return base_directive.run(self) return directive graph-algorithms-planarity-08d7b51/doc/sphinxext/numpydoc.pyc000066400000000000000000000146611522057144000245010ustar00rootroot00000000000000ó Ë´Qc@s/dZddlZejdkr0edƒ‚nddlZddlZddlZddlmam Z ddl m Z ddl Z dgd„Z d „Ztd „Zdd lmZdd lmZdd lmZdefd„ƒYZdeefd„ƒYZdeefd„ƒYZd„ZdS(s• ======== numpydoc ======== Sphinx extension that handles docstrings in the Numpy standard format. [1] It will: - Convert Parameters etc. sections to field lists. - Convert See Also section to a See also entry. - Renumber references. - Extract the signature from the docstring, if it can't be determined otherwise. .. [1] http://projects.scipy.org/numpy/wiki/CodingStyleGuidelines#docstring-standard iÿÿÿÿNs1.0.1s!Sphinx 1.0.1 or newer is required(tget_doc_objecttSphinxDocString(t DirectiveicCsœtd|jjd|jjƒ}|dkrqtjdtjtjBƒ}|jddj |ƒƒj dƒ|(n7t ||dj |ƒd|ƒ} t | ƒj dƒ|(|jj rYt|dƒrY|jrYt|d ƒrýtd d |j|jfƒ} ntd |jƒ} |dd d g7}|g|jj | j dƒD]} d| ^q?7}ng} xQ|D]I} | jƒ} tjd| tjƒ}|rf| j|jdƒƒqfqfW| jdd„ƒ| r‚x³t|ƒD]¢\}} x“| D]‹}tjd|ƒrd|dt|ƒ}nd||df}||jd|d|ƒ||<||jd|d|ƒ||?su^\d+$uR%diu%s%du[%s]_u.. [%s](tdictRtnumpydoc_use_plotstnumpydoc_show_class_memberstretcompiletItStsubtjointsplitRtunicodetnumpydoc_edit_linkthasattrRRtstriptmatchtappendtgrouptsortt enumeratetinttreplaceR (tapptwhattnametobjtoptionstlinestreference_offsettcfgttitle_retdoctvR t referencestlinetmtitrtnew_r((s@/home/aric/Software/Projects/planarity/doc/sphinxext/numpydoc.pytmangle_docstringssD  (! "1   cCs³tj|ƒr;t|dƒ s7dtj|jƒkr;d St|ƒpSt|dƒsZdSt|dƒsmdSttj|ƒƒ}|dr¯tj dd|dƒ}|dfSdS( Nt__init__sinitializes x; see R t__argspec_is_invalid_t__doc__t Signatureu^[^(]*u(R R ( tinspecttisclassRtpydoctgetdocR6tcallableRRR(R$R%R&R'R(tsigtretannR-((s@/home/aric/Software/Projects/planarity/doc/sphinxext/numpydoc.pytmangle_signatureNs cCsp|a|jdtƒ|jdtƒ|jddtƒ|jddtƒ|jdttƒ|jt ƒdS(Nsautodoc-process-docstringsautodoc-process-signatureRRR( RtconnectR5RAtadd_config_valuetNonetFalsetTruet add_domaint NumpyCDomain(R$tget_doc_object_((s@/home/aric/Software/Projects/planarity/doc/sphinxext/numpydoc.pytsetup]s(tViewList(tCDomain(t PythonDomaintManglingDomainBasecBs eZiZd„Zd„ZRS(cOs'tt|ƒj||Ž|jƒdS(N(tsuperRNR6twrap_mangling_directives(tselftatkw((s@/home/aric/Software/Projects/planarity/doc/sphinxext/numpydoc.pyR6vscCsAx:|jjƒD])\}}t|j||ƒ|j|s" $ 0     graph-algorithms-planarity-08d7b51/examples/000077500000000000000000000000001522057144000211355ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/examples/classic/000077500000000000000000000000001522057144000225565ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/examples/classic/ascii.py000066400000000000000000000006211522057144000242170ustar00rootroot00000000000000import planarity # Example of the complete graph of 5 nodes, K5 # K5 is not planar # use text strings as labels edgelist = [('a', 'b'), ('a', 'c'), ('a', 'd'), ('a', 'e'), ('b', 'c'),('b', 'd'),('b', 'e'), ('c', 'd'), ('c', 'e'), ('d', 'e')] # remove an edge edgelist.remove(('a','b')) # graph is now planar # make text drawing print(planarity.ascii(edgelist)) graph-algorithms-planarity-08d7b51/examples/classic/graph_formats.py000066400000000000000000000016661522057144000257750ustar00rootroot00000000000000import planarity # Example of the complete graph of 5 nodes, K5 # K5 is not planar # any of the following formats can bed used for representing the graph edgelist = [(0, 1), (0, 2), (0, 3), (0, 4), (1, 2),(1, 3),(1, 4), (2, 3), (2, 4), (3, 4)] dictofdicts = {0: {1: {}, 2: {}, 3: {}, 4: {}}, 1: {2: {}, 3: {}, 4: {}}, 2: {3: {}, 4: {}}, 3: {4: {}}, 4: {}} dictofsets = {0: set([1,2,3,4]), 1: set([2,3,4]), 2: set([3,4]), 3: set([4]), 4: set([])} dictoflists = {0: list([1,2,3,4]), 1: list([2,3,4]), 2: list([3,4]), 3: list([4]), 4: list([])} print(planarity.is_planar(edgelist)) # False print(planarity.is_planar(dictofdicts)) # False print(planarity.is_planar(dictofsets)) # False print(planarity.is_planar(dictoflists)) # False graph-algorithms-planarity-08d7b51/examples/classic/kuratowski.py000066400000000000000000000011501522057144000253300ustar00rootroot00000000000000import planarity # Example of the complete graph of 5 nodes, K5 # K5 is not planar # use text strings as labels edgelist = [('a', 'b'), ('a', 'c'), ('a', 'd'), ('a', 'e'), ('b', 'c'),('b', 'd'),('b', 'e'), ('c', 'd'), ('c', 'e'), ('d', 'e')] print(planarity.is_planar(edgelist)) # False # print forbidden Kuratowski subgraph (K5) print(planarity.kuratowski_edges(edgelist)) # remove an edge edgelist.remove(('a','b')) # graph is now planar print(planarity.is_planar(edgelist)) # True # no forbidden subgraph, empty list returned print(planarity.kuratowski_edges(edgelist)) graph-algorithms-planarity-08d7b51/examples/classic/networkx_draw.py000066400000000000000000000002321522057144000260230ustar00rootroot00000000000000import planarity import networkx as nx import matplotlib.pyplot as plt G=nx.wheel_graph(10) planarity.draw(G) plt.axis('off') plt.savefig('wheel.png') graph-algorithms-planarity-08d7b51/examples/classic/networkx_interface.py000066400000000000000000000004151522057144000270310ustar00rootroot00000000000000import planarity import networkx as nx # Example of the complete graph of 5 nodes, K5 G=nx.complete_graph(5) # K5 is not planar print(planarity.is_planar(G)) # False # find forbidden Kuratowski subgraph K=planarity.kuratowski_subgraph(G) print(K.edges()) # K5 edges graph-algorithms-planarity-08d7b51/examples/classic/pgraph_class.py000066400000000000000000000010341522057144000255740ustar00rootroot00000000000000import planarity # Example of the complete graph of 5 nodes, K5 # K5 is not planar # any of the following formats can bed used for representing the graph edgelist = [(0, 1), (0, 2), (0, 3), (0, 4), (1, 2),(1, 3),(1, 4), (2, 3), (2, 4), (3, 4)] P=planarity.PGraph(edgelist) print(P.nodes()) # indexed from 1..n print(P.mapping()) # the node mapping print(P.edges()) # edges print(P.is_planar()) # False print(P.kuratowski_edges()) edgelist.remove((0,1)) P=planarity.PGraph(edgelist) print(P.ascii()) graph-algorithms-planarity-08d7b51/examples/classic/write_adjlist.py000066400000000000000000000007231522057144000257760ustar00rootroot00000000000000import planarity # Example of the complete graph of 5 nodes, K5 # K5 is not planar # use text strings as labels edgelist = [('a', 'b'), ('a', 'c'), ('a', 'd'), ('a', 'e'), ('b', 'c'),('b', 'd'),('b', 'e'), ('c', 'd'), ('c', 'e'), ('d', 'e')] # write adjlist to file in "planarity adjlist" format planarity.write(edgelist,'k5.adjlist') # nodes are mapped to integers from 1 to n # get mapping print(planarity.mapping(edgelist)) graph-algorithms-planarity-08d7b51/examples/full/000077500000000000000000000000001522057144000220775ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/examples/full/demo_init_with_string.py000066400000000000000000000027311522057144000270440ustar00rootroot00000000000000"""Script to check whether we may read from and write to string""" #!/usr/bin/env python from planarity import ( QUIETMODE_NONE, gp_SetQuietMode, G6ReadIterator, G6WriteIterator, Graph, ) if __name__ == "__main__": gp_SetQuietMode(QUIETMODE_NONE) # Example from p. 84 of the nauty and Traces User's Guide; see # https://pallini.di.uniroma1.it/Guide.html g6_encoded_graph = '''>>graph6< str: quiet_mode_name_correspondence = { QUIETMODE_NONE: "QUIETMODE_NONE", QUIETMODE_ERRORS: "QUIETMODE_ERRORS", QUIETMODE_MESSAGES: "QUIETMODE_MESSAGES", QUIETMODE_ALL: "QUIETMODE_ALL", } return quiet_mode_name_correspondence.get(quiet_mode_val, "UNKNOWN") if __name__ == "__main__": filename = 'DOES_NOT_EXIST.g6' if (len(sys.argv) < 2) else sys.argv[1] quiet_mode_val = gp_GetQuietMode() if (quiet_mode_val != QUIETMODE_ALL): raise RuntimeError( "graphLib default quietMode expected to be QUIETMODE_ALL.") graph = Graph() reader = G6ReadIterator(graph) try: print( f"Trying to init reader with nonexistent file '{filename}'.\n" "\tgp_ErroMessage() MUST NOT appear before stacktrace, as " f"quietMode is {get_quiet_mode_str(quiet_mode_val)}:" ) print('-'*25) reader.g6_InitReaderWithFileName(filename) except RuntimeError as e: print('-'*25) traceback.print_exception(e) print() print('='*50) print() gp_SetQuietMode(QUIETMODE_NONE) try: print( f"Trying to init reader with nonexistent file '{filename}'.\n" "\tgp_ErroMessage() MUST appear before stacktrace, as quietModeFlag " f"is {get_quiet_mode_str(quiet_mode_val)}:" ) print('-'*25) reader.g6_InitReaderWithFileName(filename) except RuntimeError as e: print('-'*25) traceback.print_exception(e) # Shouldn't actually get to this point if you chose an invalid filename, but # for demonstrative purposes, we should always call the method to free the # reader before exiting scope. reader.g6_FreeReader() graph-algorithms-planarity-08d7b51/examples/full/demo_specific_graph.py000066400000000000000000000204141522057144000264240ustar00rootroot00000000000000""" A simple script that imports the planarity Cython package, reads in a graph, calls gp_Embed() and tests embed result integrity, then writes the result to file. Functions: def specific_graph( infile: Path, outdir: Optional[Path], command: str, output_mode: str, ) -> int """ #!/usr/bin/env python __all__ = ["specific_graph"] # STANDARD LIBRARY IMPORTS import argparse from pathlib import Path import re from typing import Optional # THIRD PARTY IMPORTS from planarity import ( QUIETMODE_NONE, gp_SetQuietMode, OK, NONEMBEDDABLE, NOTOK, WRITE_ADJLIST, WRITE_ADJMATRIX, WRITE_G6, Graph, ) # LOCAL IMPORTS from planarity_app_utils import ( PLANARITY_PACKAGE_INFO, PLANARITY_ALGORITHM_SPECIFIERS, ALGORITHM_SPECIFIER_NAME_CORRESPONDENCE, ALGORITHM_SPECIFIER_OUTPUT_CORRESPONDENCE, EMBED_RESULT_NAME_CORRESPONDENCE, extend_graph, get_embed_flags, ) def specific_graph( infile: Path, outdir: Optional[Path], command: str, output_mode: int, ) -> int: """Run gp_Embed() for the specified algorithm and output the result to file When the embed result is OK, writes the embedding (po), planar drawing (d), or an empty graph (234). When the embed_result is NONEMBEDDABLE, writes the obstruction (pdo) or the target homeomorph (234). Args: infile: name of graph input file to read outdir: parent directory under which to make output directory command: algorithm command specifier output_mode: the desired output format, i.e., WRITE_ADJLIST, WRITE_ADJMATRIX, or WRITE_G6 Returns: OK, NONEMBEDDABLE, or NOTOK based on the embed_result Raises: ValueError: If invalid command specifier provided, if the output_mode is invalid, or if the outdir is invalid RuntimeError: If unable to extend graph for the specified command, or if embedding result does not match integrity check result """ gp_SetQuietMode(QUIETMODE_NONE) if output_mode not in (WRITE_ADJLIST, WRITE_ADJMATRIX, WRITE_G6): raise ValueError( f"Invalid output_mode = {output_mode}" ) embed_flags = get_embed_flags(command) if outdir is None: outdir = infile.parent if outdir.is_file(): raise ValueError( f"Output directory '{outdir}' corresponds to a file." ) outdir = Path.joinpath(outdir, f"{infile.stem}") Path.mkdir(outdir, parents=True, exist_ok=True) outfile = Path.joinpath(outdir, f"{infile.stem}.s.{command}.out.txt") graph_for_embedding_check = Graph() graph_for_embedding = Graph() graph_for_embedding_check.gp_Read(str(infile)) order = graph_for_embedding_check.gp_GetN() graph_for_embedding.gp_EnsureVertexCapacity(order) graph_for_embedding.gp_CopyGraph(graph_for_embedding_check) extend_graph(graph_for_embedding, command) embed_result = graph_for_embedding.gp_Embed(embed_flags) if ( graph_for_embedding.gp_TestEmbedResultIntegrity( graph_for_embedding_check, embed_result ) != embed_result ): raise RuntimeError( f"Failed embed integrity check for command '{command}' on graph in " f"'{infile}'." ) if ( (embed_result == OK and command in ("p", "d", "o")) or (embed_result == NONEMBEDDABLE and command in ("2", "3", "4")) ): graph_for_embedding.gp_Write(str(outfile), output_mode) if embed_result == OK and command == "d": choice = input( "Do you wish to render the drawing to screen (s) " "or file (f)? (Select any other input to dismiss.)\n\t" ) if choice.lower() == "s": _, rendition_string = graph_for_embedding.gp_DrawPlanar_RenderToString() print(rendition_string) elif choice.lower() == "f": render_outfile = Path.joinpath( outdir, f"{infile.stem}.s.{command}.render.txt" ) graph_for_embedding.gp_DrawPlanar_RenderToFile(str(render_outfile)) return embed_result def print_embed_result(command: str, embed_result: int) -> None: """Renders the embed result for the given algorithm extension Args: command: algorithm command specifier embed_result: OK, NONEMBEDDABLE, or NOTOK based on the embed_result from specific_graph() Raises: ValueError: If the command is not a valid algorithm extension specifier, or if the embed_result does not correspond to a valid return code. """ if command not in PLANARITY_ALGORITHM_SPECIFIERS(): raise ValueError( f"Command '{command}' is not one of " f"({', '.join(PLANARITY_ALGORITHM_SPECIFIERS())})" ) if embed_result not in (OK, NONEMBEDDABLE, NOTOK): raise ValueError( f"Embed result '{embed_result}' does not correspond to OK ({OK}), " f"NONEMBEDDABLE ({NONEMBEDDABLE}), or NOTOK ({NOTOK})." ) print( f"{ALGORITHM_SPECIFIER_NAME_CORRESPONDENCE().get(command)} " "embed result was " f"{EMBED_RESULT_NAME_CORRESPONDENCE().get(embed_result)}." ) if embed_result == NOTOK: return print( f"\tThe graph is {'not ' if embed_result == NONEMBEDDABLE else ''}" f"{ALGORITHM_SPECIFIER_OUTPUT_CORRESPONDENCE().get(command)}" ) if __name__ == "__main__": parser = argparse.ArgumentParser( formatter_class=argparse.RawTextHelpFormatter, usage="python %(prog)s [options]", description="Python implementation of Planarity SpecificGraph()\n\n" "Reproduces Planarity's SpecificGraph() using graphLib functions " "exposed by the Cython wrapper.\n", ) parser.add_argument( "-i", "--infile", required=True, type=Path, help="Path to graph input file containing a single input graph; if a " ".g6 input file is specified, only the first graph in the file will be " "processed.", ) parser.add_argument( "-o", "--outdir", required=False, type=Path, default=None, help="Path of directory in which to make the output directory which " "will contain the output from running all chosen graph algorithm " "commands on the input graph. Defaults to:\n" "\t{infile_parent_dir}/{infile_stem}/\n" "Where output filenames will be of the form:\n" "\t{infile_stem}.s.{command}.out.txt\n" "For each specified graph algorithm command.", ) parser.add_argument( "-c", "--commands", type=str, required=False, default=None, help="Delimited list of algorithm command specifiers you wish to use " "when testing all graphs in the input file(s). Defaults to:\n" f"\t{','.join(PLANARITY_ALGORITHM_SPECIFIERS())}", ) parser.add_argument( "-m", "--mode", type=str, required=False, default="a", help="Desired graph output format: .g6 (g), Adjacency List (a), or " "Adjacency Matrix (m). Defaults to 'a'\n", ) args = parser.parse_args() print(PLANARITY_PACKAGE_INFO()) commands = [ command.strip() for command in re.split(r'[ ,.;]', args.commands) ] if args.commands else PLANARITY_ALGORITHM_SPECIFIERS() output_mode = (WRITE_ADJLIST if args.mode == "a" else (WRITE_ADJMATRIX if args.mode == "m" else (WRITE_G6 if args.mode == "g" else None))) if not output_mode: raise ValueError( f"Invalid argument for mode = {args.mode}; only accepted values " "are g (.g6), a (Adjacency List), or m (Adjacency Matrix)" ) for command in commands: embed_result = specific_graph( infile=args.infile, outdir=args.outdir, command=command, output_mode=output_mode, ) print_embed_result(command=command, embed_result=embed_result) graph-algorithms-planarity-08d7b51/examples/full/planarity_app_utils.py000066400000000000000000000077151522057144000265460ustar00rootroot00000000000000"""Utilities to support planarity app implementation""" __all__ = [ "PLANARITY_PACKAGE_INFO", "PLANARITY_ALGORITHM_SPECIFIERS", "ALGORITHM_SPECIFIER_NAME_CORRESPONDENCE", "ALGORITHM_SPECIFIER_OUTPUT_CORRESPONDENCE", "EMBED_RESULT_NAME_CORRESPONDENCE", "extend_graph", "get_embed_flags", ] from planarity import ( gp_GetProjectVersionFull, gp_GetLibPlanarityVersionFull, Graph, ) from planarity import ( OK, NONEMBEDDABLE, NOTOK, EMBEDFLAGS_PLANAR, EMBEDFLAGS_DRAWPLANAR, EMBEDFLAGS_OUTERPLANAR, EMBEDFLAGS_SEARCHFORK23, EMBEDFLAGS_SEARCHFORK33, EMBEDFLAGS_SEARCHFORK4, ) def PLANARITY_PACKAGE_INFO() -> str: return ( "\n===================================================\n" "This program imports the planarity package, which\n" "is based on the Edge Addition Planarity Suite\n" f"version {gp_GetProjectVersionFull()}, which contains " "the libPlanarity\ngraph library version " f"{gp_GetLibPlanarityVersionFull()}." "\n===================================================\n" ) def PLANARITY_ALGORITHM_SPECIFIERS() -> tuple[str, ...]: """Returns immutable tuple containing algorithm command specifiers""" return ("p", "d", "o", "2", "3", "4") def ALGORITHM_SPECIFIER_NAME_CORRESPONDENCE() -> dict[str, str]: """Returns mapping of command specifier to name""" return { "p": "Planarity", "d": "Draw Planar", "o": "Outerplanarity", "2": "K_{2, 3} Search", "3": "K_{3, 3} Search", "4": "K_4 Search", } def ALGORITHM_SPECIFIER_OUTPUT_CORRESPONDENCE() -> dict[str, str]: """Returns mapping of command specifier to output type""" return { "p": "planar", "d": "planar", "o": "outerplanar", "2": "K_{2, 3}-free", "3": "K_{3, 3}-free", "4": "K_4-free", } def EMBED_RESULT_NAME_CORRESPONDENCE() -> dict[int, str]: """Returns mapping of embed result to name""" return { OK: "OK", NONEMBEDDABLE: "NONEMBEDDABLE", NOTOK: "NOTOK", } def extend_graph(theGraph: Graph, command: str) -> None: """Extend the graph with structures, methods, and method overloads required by the specified algorithm. Args: graph: The Graph object to be extended command: The algorithm command specifier Raises: ValueError: If the command is not recognized RuntimeError: If the underlying C function to extend the graph with the pertinent structures fails. """ if command not in PLANARITY_ALGORITHM_SPECIFIERS(): raise ValueError(f"Unsupported algorithm specifier: {command}") command_attach_extension_function_correspondence = { "p": theGraph.gp_ExtendWith_Planarity, "d": theGraph.gp_ExtendWith_DrawPlanar, "o": theGraph.gp_ExtendWith_Outerplanarity, "2": theGraph.gp_ExtendWith_K23Search, "3": theGraph.gp_ExtendWith_K33Search, "4": theGraph.gp_ExtendWith_K4Search, } command_attach_extension_function_correspondence.get( command, lambda *a, **k: None )() def get_embed_flags(command: str) -> int: """Get embedFlags corresponding to the command Args: command: The algorithm command specifier Returns: int: The corresponding embed flag from the C graphLib exposed by the Cython wrapper. Raises: ValueError: If an invalid command is provided """ command_embed_flag_correspondence = { "p": EMBEDFLAGS_PLANAR, "d": EMBEDFLAGS_DRAWPLANAR, "o": EMBEDFLAGS_OUTERPLANAR, "2": EMBEDFLAGS_SEARCHFORK23, "3": EMBEDFLAGS_SEARCHFORK33, "4": EMBEDFLAGS_SEARCHFORK4, } embed_flags = command_embed_flag_correspondence.get(command) if embed_flags is None: raise ValueError(f"Unsupported algorithm specifier: {command}") return embed_flags graph-algorithms-planarity-08d7b51/planarity/000077500000000000000000000000001522057144000213225ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/planarity/__init__.pxd000066400000000000000000000000001522057144000235640ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/planarity/__init__.py000066400000000000000000000053221522057144000234350ustar00rootroot00000000000000from .classic.planarity import PGraph from .classic.planarity_functions import * from .classic.planarity_networkx import * # Surfaced from planarityc/graphLib/lowLevelUtils/apiutils.h from .full.graphLib import ( QUIETMODE_NONE, QUIETMODE_ERRORS, QUIETMODE_MESSAGES, QUIETMODE_ALL, ) from .full.graphLib import ( gp_GetQuietMode, gp_SetQuietMode, ) # Surfaced from planarity/c/graphLib/graphLib.h from .full.graphLib import ( OK, NOTOK, TRUE, FALSE, NIL, ) from .full.graphLib import ( gp_GetProjectVersionFull, gp_GetLibPlanarityVersionFull, ) # Surfaced from planarity/c/graphLib/graph.h from .full.graphLib import ( VERTEX_VISITED_MASK, VERTEX_MARKED_MASK, EDGE_VISITED_MASK, EDGE_MARKED_MASK, EDGE_TYPE_MASK, EDGE_TYPE_CHILD, EDGE_TYPE_FORWARD, EDGE_TYPE_PARENT, EDGE_TYPE_BACK, EDGE_TYPE_NOTDEFINED, EDGE_TYPE_TREE, EDGEFLAG_INVERTED_MASK, EDGEFLAG_DIRECTION_INONLY, EDGEFLAG_DIRECTION_OUTONLY, EDGEFLAG_DIRECTION_MASK, DEFAULT_EDGE_CAPACITY_FACTOR, AT_EDGE_CAPACITY_LIMIT, ) # Surfaced from planarity/c/graphLib/io/graphIO.h from .full.graphLib import ( WRITE_ADJLIST, WRITE_ADJMATRIX, WRITE_G6, GRAPHFLAGS_ZEROBASEDIO, ) # Surfaced from planarity/c/graphLib/planarityRelated/graphPlanarity.h from .full.graphLib import ( PLANARITY_NAME, GRAPHFLAGS_EXTENDEDWITH_PLANARITY, NONEMBEDDABLE, EMBEDFLAGS_PLANAR, EMBEDFLAGS_DRAWPLANAR, EMBEDFLAGS_OUTERPLANAR, EMBEDFLAGS_SEARCHFORK23, EMBEDFLAGS_SEARCHFORK33, EMBEDFLAGS_SEARCHFORK4, MINORTYPE_NONE, MINORTYPE_A, MINORTYPE_B, MINORTYPE_C, MINORTYPE_D, MINORTYPE_E, MINORTYPE_E1, MINORTYPE_E2, MINORTYPE_E3, MINORTYPE_E4, MINORTYPE_E5, MINORTYPE_E6, MINORTYPE_E7, ) # Surfaced from planarity/c/graphLib/planarityRelated/graphOuterplanarity.h from .full.graphLib import ( OUTERPLANARITY_NAME, GRAPHFLAGS_EXTENDEDWITH_OUTERPLANARITY, ) # Surfaced from planarity/c/graphLib/planarityRelated/graphDrawPlanar.h from .full.graphLib import ( DRAWPLANAR_NAME, ) # Surfaced from planarity/c/graphLib/homeomorphSearch/graphK23Search.h from .full.graphLib import ( K23SEARCH_NAME, ) # Surfaced from planarity/c/graphLib/homeomorphSearch/graphK33Search.h from .full.graphLib import ( K33SEARCH_NAME, ) # Surfaced from planarity/c/graphLib/homeomorphSearch/graphK4Search.h from .full.graphLib import ( K4SEARCH_NAME, ) from .full.graph import Graph from .full.g6IterationUtils import G6ReadIterator, G6WriteIterator # NOTE: In the future, we could automatically generate the version number by # configuring setuptools-scm, but presently this seems simpler. __version__ = "1.0.0" graph-algorithms-planarity-08d7b51/planarity/c/000077500000000000000000000000001522057144000215445ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/planarity/c/LICENSE.TXT000066400000000000000000000050451522057144000232330ustar00rootroot00000000000000The Edge Addition Planarity Suite Copyright (c) 1997-2026, John M. Boyer All rights reserved. Includes a reference implementation of the following: * John M. Boyer. "Subgraph Homeomorphism via the Edge Addition Planarity Algorithm". Journal of Graph Algorithms and Applications, Vol. 16, no. 2, pp. 381-410, 2012. http://dx.doi.org/10.7155/jgaa.00268 * John M. Boyer. "A New Method for Efficiently Generating Planar Graph Visibility Representations". In P. Eades and P. Healy, editors, Proceedings of the 13th International Conference on Graph Drawing 2005, Lecture Notes Comput. Sci., Volume 3843, pp. 508-511, Springer-Verlag, 2006. http://dx.doi.org/10.1007/11618058_47 * John M. Boyer and Wendy J. Myrvold. "On the Cutting Edge: Simplified O(n) Planarity by Edge Addition". Journal of Graph Algorithms and Applications, Vol. 8, No. 3, pp. 241-273, 2004. http://dx.doi.org/10.7155/jgaa.00091 * John M. Boyer. "Simplified O(n) Algorithms for Planar Graph Embedding, Kuratowski Subgraph Isolation, and Related Problems". Ph.D. Dissertation, University of Victoria, 2001. https://dspace.library.uvic.ca/handle/1828/9918 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of The Edge Addition Planarity Suite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. graph-algorithms-planarity-08d7b51/planarity/c/README000066400000000000000000000001501522057144000224200ustar00rootroot00000000000000Source from John M. Boyer copied from https://github.com/graph-algorithms/edge-addition-planarity-suite graph-algorithms-planarity-08d7b51/planarity/c/graphLib/000077500000000000000000000000001522057144000232745ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/planarity/c/graphLib/extensionSystem/000077500000000000000000000000001522057144000265155ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/planarity/c/graphLib/extensionSystem/graphExtensions.c000066400000000000000000000534321522057144000320510ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include #include #include "../lowLevelUtils/appconst.h" #include "graphExtensions.private.h" #include "graphExtensions.h" #include "graphFunctionTable.h" /* Imported functions */ extern void _InitFunctionTable(graphP theGraph); /* Private function */ void _FreeExtension(graphExtensionP extension); void _OverloadFunctions(graphP theGraph, graphFunctionTableP functions); void _FixupFunctionTables(graphP theGraph, graphExtensionP curr); graphExtensionP _FindNearestOverload(graphP theGraph, graphExtensionP target, int functionIndex); /******************************************************************** * The moduleIDGenerator is used to help ensure that all extensions * added during a run-time have a different integer identifier. * An ID identifies an extension, which may be added to multiple * graphs. It is used in lieu of identifying extensions by a string * name, which is noticeably expensive when a frequently called * overload function seeks the extension context for a graph. ********************************************************************/ static int moduleIDGenerator = 0; /******************************************************************** The extension mechanism allows new modules to equip a graph with the data structures and functions needed to implement new algorithms without impeding the performance of the core graph planar embedding algorithms on graphs that have not been so equipped. The following steps must be used to create a graph extension: 1) Create a moduleID variable initialized to zero that will be assigned a positive integer the first time the extension is added to a graph by gp_AddExtension() 2) Define an extension context structure to contain all of the data and function pointers that extend the graph. The context must include a graphFunctionTableStruct to allow overloading of functions. An instance of this context structure is passed to the "context" parameter of gp_AddExtension(). 3) Define a function capable of copying your context data. It receives void pointers to destination and source contexts, and then copies the extension-specific data from source to destination. This function's pointer is passed to the "copyData" parameter of gp_AddExtension() 4) Define a function that can free the memory used by your context data structure. It will receive a void pointer indicating the instance of your context data structure that you passed as the "context" parameter to gp_AddExtension(). The free function pointer should be passed as the "freeContext" parameter to gp_AddExtension() 5) The expected method of attaching your feature to a graph is to create a function called gp_ExtendWith_Feature(), where 'Feature' is the name of your module. The attach function allocates your context data structure, initializes the extension data, assigns overload function pointers, and invokes gp_AddExtension(). NOTE: It is advisable to use memset on the context function table before assigning any function overloads because any function not being overloaded must have a NULL pointer. NOTE: The gp_AddExtension() method puts the overload function pointers into the graph's function table, and the base function pointers that were overloaded are placed in the context function table. This allows the extension's functions to have access to base function behaviors, since many extension functions will extend rather than replace the base behavior. 6) There are a few functions that you must overload in order to successfully manage data structures that are parallel to the main graph data structures. The core graph data structure has function pointers to functions that can be overloaded. In addition to invoking gp_AddExtension(), you need to set pointers to your own versions of the functions you are overloading. You will also need to store a copy of the prior pointer in your feature's context data structure so that you can invoke the "base" behavior from your function overload, e.g. if your feature is attached but not active or if your feature augments the base behavior rather than replacing it. a) If extra data must be maintained at the graph, vertex or edge levels, then fpEnsureVertexCapacity(), fpEnsureEdgeCapacity(), and fpResetGraphStorage() must be overloaded. b) For a parallel array of edge data, the extension must currently provides its own _Feature_DeleteEdge() that initializes its edge extension data along with calling gp_DeleteEdge(). c) If any data must be persisted in the file format, then overloads of fpReadPostprocess() and fpWritePostprocess() are needed. 7) Define internal functions for _Feature_ClearStructures(), _Feature_CreateStructures(), _Feature_InitStructures(), and _Feature_CopyData(); a) The _Feature_ClearStructures() should simply null out pointers to extra structures on its first invocation, but thereafter it should free them and then null them. Since the null-only step is done only once in gp_ExtendWith_Feature(), it seems reasonable to not bother with a more complicated _Feature_ClearStructures(). But, as an extension is developed, the data structures change, so it is best to keep all this logic in one place. b) The _Feature_CreateStructures() should just allocate memory for but not initialize any vertex level and edge level data structures. Data structures maintained at the graph level, such as a stack or a list collection, should be created _and_ initialized. c) The _Feature_InitStructures() should invoke just the functions needed to initialize the custom VertexRec, VertexInfo and EdgeRec data members, if any. d) The _Feature_CopyData() should invoke just the functions needed to copy the custom VertexRec, VertexInfo and EdgeRec data members, if any, from a source extension context to a destination extension context. For custom EdgeRec arrays, if the destination has more capacitiy than the source, then the implementation should also ensure the extra EdgeRecs are initialized in the destination. 8) Define a function gp_Detach_Feature() that invokes gp_RemoveExtension() This should be done for consistency, so that users of a feature do not attach it with gp_ExtendWith_Feature() and remove it with gp_RemoveExtension(). However, it may sometimes be necessary to run more code than just gp_RemoveExtension() when detaching a feature, e.g., some final result values of a feature may be saved to data available in the core graph or in other features. ********************************************************************/ /******************************************************************** gp_AddExtension() @param theGraph - pointer to the graph to which the extension is being added @param pModuleID - address of the variable that contains the feature's extension identifier. If the variable is equal to zero, it is assigned a positive number. Thereafter, the variable value can be used to find and remove the extension from any graph @param context - the data storage for the extension being added The context is owned by the extension and freed with freeContext() @param copyData - a function capable of copying the context data @param freeContext - a function capable of freeing the context data @param functions - pointer to a table of functions stored in the data context. The table of functions is an input and output parameter. On input, the table consists of new function pointers for functions being overloaded. Any function not being overloaded must be NULL. The non-NULL function pointers are used to overload the functions in the graph, and the prior pointer values in the graph are stored in the function table as output. The context data therefore has the pointer to the base function corresponding to any function its extension module overloaded. The new extension is created and added to the graph. ********************************************************************/ int gp_AddExtension(graphP theGraph, int *pModuleID, void *context, void *(*dupContext)(void *, void *), int (*copyData)(void *, void *), void (*freeContext)(void *), graphFunctionTableP functions) { graphExtensionP newExtension = NULL; if (theGraph == NULL || pModuleID == NULL || context == NULL || copyData == NULL || freeContext == NULL || functions == NULL) { return NOTOK; } // If the extension already exists, then don't redefine it. if (gp_FindExtension(theGraph, *pModuleID, NULL) == TRUE) { return NOTOK; } // Assign a unique ID to the extension if it does not already have one if (*pModuleID == 0) { *pModuleID = ++moduleIDGenerator; } // Allocate the new extension if ((newExtension = (graphExtensionP)malloc(sizeof(graphExtensionStruct))) == NULL) { return NOTOK; } // Assign the data payload of the extension newExtension->moduleID = *pModuleID; newExtension->context = context; newExtension->dupContext = dupContext; newExtension->copyData = copyData; newExtension->freeContext = freeContext; newExtension->functions = functions; _OverloadFunctions(theGraph, functions); // Make the new linkages newExtension->next = (struct graphExtensionStruct *)theGraph->extensions; theGraph->extensions = newExtension; // The new extension was successfully added return OK; } /******************************************************************** _OverloadFunctions() For each non-NULL function pointer, the pointer becomes the new value for the function in the graph, and the old function pointer in the graph is placed in the overload table. This way, when an extension function is invoked, it can choose to invoke the base function before or after whatever extension behavior it provides. Also, when it comes time to remove an extension, this extension system has access to the overload tables of all extensions so that it can unhook the functions of the module being removed from the chains of calls for each overloaded function. This will involve some pointer changes in the overload tables of extensions other than the one being removed. ********************************************************************/ void _OverloadFunctions(graphP theGraph, graphFunctionTableP functions) { void **currFunctionTable = (void **)theGraph->functions; void **newFunctionTable = (void **)functions; int numFunctions = sizeof(graphFunctionTableStruct) / sizeof(void *); int K; for (K = 0; K < numFunctions; K++) { if (newFunctionTable[K] != NULL) { void *fp = currFunctionTable[K]; currFunctionTable[K] = newFunctionTable[K]; newFunctionTable[K] = fp; } } } /******************************************************************** gp_FindExtension() @param theGraph - the graph whose extension list is to be searched @param moduleID - the identifier of the module whose extension context is desired @param pContext - the return parameter that receives the value of the extension, if found. This may be NULL if the extension was not found or if the extension context value was NULL. @return TRUE if the extension was found, NOTOK if not found If FALSE is returned, then the context returned is guaranteed to be NULL If TRUE is returned, the context returned may be NULL if that is the current value of the module extension ********************************************************************/ int gp_FindExtension(graphP theGraph, int moduleID, void **pContext) { graphExtensionP first = NULL, next = NULL; if (pContext != NULL) { *pContext = NULL; } if (theGraph == NULL || moduleID == 0) { return FALSE; } first = theGraph->extensions; while (first != NULL) { next = (graphExtensionP)first->next; if (first->moduleID == moduleID) { if (pContext != NULL) { *pContext = first->context; } return TRUE; } first = next; } return FALSE; } /******************************************************************** gp_GetExtension() Calling this function is equivalent to invoking gp_FindExtension() except that some debuggers have difficulty stepping into a function that (properly) start by setting a local variable pointer to NULL when the debugger has watch expressions that dereference a pointer of the same name. In such cases, MyContext *context = NULL; gp_FindExtension(theGraph, MYEXTENSION_ID, &context); can be replaced by MyContext *context = gp_GetExtension(theGraph, MYEXTENSION_ID); @param theGraph - the graph whose extension list is to be searched @param moduleID - the identifier of the module whose extension context is desired @return void pointer to the extension if found, or NULL if not found. ********************************************************************/ void *gp_GetExtension(graphP theGraph, int moduleID) { void *context = NULL; int result = gp_FindExtension(theGraph, moduleID, &context); return result ? context : NULL; } /******************************************************************** gp_RemoveExtension() @param theGraph - the graph from which to remove an extension @param moduleID - the ID of the module whose extension context is to be removed @return OK if the module is successfully removed or not in the list NOTOK for internal errors, such as invalid parameters ********************************************************************/ int gp_RemoveExtension(graphP theGraph, int moduleID) { graphExtensionP prev = NULL, curr = NULL, next = NULL; if (theGraph == NULL || moduleID == 0) return NOTOK; curr = theGraph->extensions; while (curr != NULL) { next = (graphExtensionP)curr->next; if (curr->moduleID == moduleID) break; prev = curr; curr = next; } // An extension can only be removed if it is found. Otherwise, // we return OK because the extension degenerately removed // (since it is already gone) if (curr != NULL) { _FixupFunctionTables(theGraph, curr); // Unhook the curr extension if (prev != NULL) prev->next = (struct graphExtensionStruct *)next; else theGraph->extensions = next; // Free the curr extension _FreeExtension(curr); } return OK; } /******************************************************************** _FixupFunctionTables() Removes the functions in the curr function table from the function call lists established by the function tables of all extensions and theGraph. Since new extensions are prepended, extensions before curr may have further overloaded the functions in the curr function table. For a non-NULL function pointer in the curr table, if there is a preceding extension with the same function pointer non-NULL, then the function table of the closest such preceding extension points to the original overload function of the curr extension, and the curr extension contains the pointer to the base function behavior, so now the function table of that preceding extension must be changed to the function pointer value in the curr extension. ********************************************************************/ void _FixupFunctionTables(graphP theGraph, graphExtensionP curr) { void **currFunctionTable = (void **)(curr->functions); int numFunctions = sizeof(*(curr->functions)) / sizeof(void *); int K; for (K = 0; K < numFunctions; K++) { if (currFunctionTable[K] != NULL) { void **nearestOverloadFunctionTable = (void **)&theGraph->functions; graphExtensionP pred = _FindNearestOverload(theGraph, curr, K); if (pred != NULL) nearestOverloadFunctionTable = (void **)pred->functions; nearestOverloadFunctionTable[K] = currFunctionTable[K]; } } } /******************************************************************** _FindNearestOverload() ********************************************************************/ graphExtensionP _FindNearestOverload(graphP theGraph, graphExtensionP target, int functionIndex) { graphExtensionP curr = theGraph->extensions; graphExtensionP found = NULL; void **functionTable; while (curr != target) { functionTable = (void **)curr->functions; if (functionTable[functionIndex] != NULL) found = curr; curr = (graphExtensionP)curr->next; } return found; } /******************************************************************** gp_DupExtensions() ********************************************************************/ int gp_DupExtensions(graphP dstGraph, graphP srcGraph) { graphExtensionP next = NULL, newNext = NULL, newLast = NULL; if (srcGraph == NULL || dstGraph == NULL) return NOTOK; gp_FreeExtensions(dstGraph); next = srcGraph->extensions; while (next != NULL) { if ((newNext = (graphExtensionP)malloc(sizeof(graphExtensionStruct))) == NULL) { gp_FreeExtensions(dstGraph); return NOTOK; } newNext->moduleID = next->moduleID; newNext->context = next->dupContext(next->context, dstGraph); newNext->dupContext = next->dupContext; newNext->copyData = next->copyData; newNext->freeContext = next->freeContext; newNext->functions = next->functions; newNext->next = NULL; if (newLast != NULL) newLast->next = (struct graphExtensionStruct *)newNext; else dstGraph->extensions = newNext; newLast = newNext; next = (graphExtensionP)next->next; } return OK; } /******************************************************************** gp_CopyExtensions() ********************************************************************/ // This number can just be made bigger if ever needed #define MAXNUMSUPPORTEDEXTENSIONS 32 int gp_CopyExtensions(graphP dstGraph, graphP srcGraph) { graphExtensionP dstExtension = NULL, srcExtension = NULL; graphExtensionP srcExtensionIDMap[MAXNUMSUPPORTEDEXTENSIONS+1]; if (srcGraph == NULL || dstGraph == NULL) return NOTOK; if (gp_GetN(dstGraph) != gp_GetN(srcGraph) || gp_GetN(dstGraph) == 0) return NOTOK; // NULL out the pointers in the srcExtensionIDMap memset(srcExtensionIDMap, 0, (MAXNUMSUPPORTEDEXTENSIONS+1)*sizeof(graphExtensionP)); // Run through the srcGraph extensions linked list and put the pointer to // each extension in the srcExtensionIDMap at the index location indicated // by the extension module ID. This mapping is needed because the srcGraph // may have been extended with the extensions in a different order than the // dstGraph, but the moduleID for each extension is the same across graphs. srcExtension = srcGraph->extensions; while (srcExtension != NULL) { if (srcExtension->moduleID < 0 || srcExtension->moduleID > MAXNUMSUPPORTEDEXTENSIONS) return NOTOK; srcExtensionIDMap[srcExtension->moduleID] = srcExtension; srcExtension = (graphExtensionP)srcExtension->next; } // For each extension in the dstGraph, if the srcGraph has the same extension, // then we invoke the extension's copyData to copy from srcGraph to dstGraph. // If the dstGraph has an extension that the srcGraph does not have, then // NULL is passed for the srcGraph extension, which is expected to cause // the extension's copyData() to reset/reinitialize the dstGraph structures. dstExtension = dstGraph->extensions; while (dstExtension != NULL) { srcExtension = srcExtensionIDMap[dstExtension->moduleID]; if (dstExtension->copyData(dstExtension->context, srcExtension ? srcExtension->context : NULL) != OK) return NOTOK; dstExtension = (graphExtensionP)dstExtension->next; } return OK; } /******************************************************************** gp_FreeExtensions() @param pFirst - pointer to head pointer of graph extension list Each graph extension is freed, including invoking the freeContext function provided when the extension was added. ********************************************************************/ void gp_FreeExtensions(graphP theGraph) { if (theGraph != NULL) { graphExtensionP curr = theGraph->extensions; graphExtensionP next = NULL; while (curr != NULL) { next = (graphExtensionP)curr->next; _FreeExtension(curr); curr = next; } theGraph->extensions = NULL; _InitFunctionTable(theGraph); } } /******************************************************************** _FreeExtension() ********************************************************************/ void _FreeExtension(graphExtensionP extension) { if (extension->context != NULL && extension->freeContext != NULL) { extension->freeContext(extension->context); } free(extension); } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/extensionSystem/graphExtensions.h000066400000000000000000000017321522057144000320520ustar00rootroot00000000000000#ifndef GRAPH_EXTENSIONS_H #define GRAPH_EXTENSIONS_H /* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #ifdef __cplusplus extern "C" { #endif #include "../graph.h" int gp_AddExtension(graphP theGraph, int *pModuleID, void *context, void *(*dupContext)(void *, void *), int (*copyData)(void *, void *), void (*freeContext)(void *), graphFunctionTableP overloadTable); int gp_FindExtension(graphP theGraph, int moduleID, void **pContext); void *gp_GetExtension(graphP theGraph, int moduleID); int gp_DupExtensions(graphP dstGraph, graphP srcGraph); int gp_CopyExtensions(graphP dstGraph, graphP srcGraph); void gp_FreeExtensions(graphP theGraph); int gp_RemoveExtension(graphP theGraph, int moduleID); #ifdef __cplusplus } #endif #endif graph-algorithms-planarity-08d7b51/planarity/c/graphLib/extensionSystem/graphExtensions.private.h000066400000000000000000000013101522057144000335130ustar00rootroot00000000000000#ifndef GRAPH_EXTENSIONS_PRIVATE_H #define GRAPH_EXTENSIONS_PRIVATE_H /* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "graphFunctionTable.h" #ifdef __cplusplus extern "C" { #endif struct graphExtensionStruct { int moduleID; void *context; void *(*dupContext)(void *, void *); int (*copyData)(void *, void *); void (*freeContext)(void *); graphFunctionTableP functions; struct graphExtensionStruct *next; }; typedef struct graphExtensionStruct graphExtensionStruct; typedef graphExtensionStruct *graphExtensionP; #ifdef __cplusplus } #endif #endif graph-algorithms-planarity-08d7b51/planarity/c/graphLib/extensionSystem/graphFunctionTable.h000066400000000000000000000043001522057144000324420ustar00rootroot00000000000000#ifndef GRAPHFUNCTIONTABLE_H #define GRAPHFUNCTIONTABLE_H /* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #ifdef __cplusplus extern "C" { #endif /* NOTE: If you add any FUNCTION POINTERS to this function table, then you must also initialize them in _InitFunctionTable() in graph.c. */ typedef struct graphStruct graphStruct; typedef graphStruct *graphP; struct graphFunctionTableStruct { // These function pointers allow extension modules to overload some of // the behaviors of protected functions. Only advanced applications // will overload these functions int (*fpEmbeddingInitialize)(graphP); void (*fpEmbedBackEdgeToDescendant)(graphP, int, int, int, int); void (*fpWalkUp)(graphP, int, int); int (*fpWalkDown)(graphP, int, int); int (*fpMergeBicomps)(graphP, int, int, int, int); void (*fpMergeVertex)(graphP, int, int, int); int (*fpHandleInactiveVertex)(graphP, int, int *, int *); int (*fpHandleBlockedBicomp)(graphP, int, int, int); int (*fpEmbedPostprocess)(graphP, int, int); int (*fpMarkDFSPath)(graphP, int, int); int (*fpCheckEmbeddingIntegrity)(graphP, graphP); int (*fpCheckObstructionIntegrity)(graphP, graphP); // These function pointers allow extension modules to overload some // of the behaviors of gp_* function in the public API int (*fpEnsureVertexCapacity)(graphP, int); void (*fpResetGraphStorage)(graphP); int (*fpEnsureEdgeCapacity)(graphP, int); int (*fpSortVertices)(graphP); int (*fpReadPostprocess)(graphP, char *); int (*fpWritePostprocess)(graphP, char **); void (*fpHideEdge)(graphP, int); void (*fpRestoreEdge)(graphP, int); int (*fpHideVertex)(graphP, int); int (*fpRestoreVertex)(graphP); int (*fpContractEdge)(graphP, int); int (*fpIdentifyVertices)(graphP, int, int, int); }; typedef struct graphFunctionTableStruct graphFunctionTableStruct; typedef graphFunctionTableStruct *graphFunctionTableP; #ifdef __cplusplus } #endif #endif graph-algorithms-planarity-08d7b51/planarity/c/graphLib/graph.c000066400000000000000000003236031522057144000245500ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "graph.h" #include "graph.private.h" // To enable performing of certain initialization calls for the // DFSUtils, Planarity, and Outerplanarity pseudo-extensions. #include "planarityRelated/graphPlanarity.h" #include "planarityRelated/graphPlanarity.private.h" #include "planarityRelated/graphOuterplanarity.h" #include /* Imported functions for FUNCTION POINTERS */ extern int _EmbeddingInitialize(graphP theGraph); extern int _SortVertices(graphP theGraph); extern void _EmbedBackEdgeToDescendant(graphP theGraph, int RootSide, int RootVertex, int W, int WPrevLink); extern void _WalkUp(graphP theGraph, int v, int e); extern int _WalkDown(graphP theGraph, int v, int RootVertex); extern int _MergeBicomps(graphP theGraph, int v, int RootVertex, int W, int WPrevLink); extern void _MergeVertex(graphP theGraph, int W, int WPrevLink, int R); extern int _HandleBlockedBicomp(graphP theGraph, int v, int RootVertex, int R); extern int _HandleInactiveVertex(graphP theGraph, int BicompRoot, int *pW, int *pWPrevLink); extern int _MarkDFSPath(graphP theGraph, int ancestor, int descendant); extern int _EmbedPostprocess(graphP theGraph, int v, int edgeEmbeddingResult); extern int _CheckEmbeddingIntegrity(graphP theGraph, graphP origGraph); extern int _CheckObstructionIntegrity(graphP theGraph, graphP origGraph); extern int _ReadPostprocess(graphP theGraph, char *extraData); extern int _WritePostprocess(graphP theGraph, char **pExtraData); /* Internal util functions for FUNCTION POINTERS */ int _HideVertex(graphP theGraph, int vertex); void _HideEdge(graphP theGraph, int e); void _RestoreEdge(graphP theGraph, int e); int _ContractEdge(graphP theGraph, int e); int _IdentifyVertices(graphP theGraph, int u, int v, int eBefore); int _RestoreVertex(graphP theGraph); /******************************************************************** Private functions, except exported within library ********************************************************************/ void _InitIsolatorContext(graphP theGraph); void _ClearAllVisitedFlagsInGraph(graphP theGraph); void _ClearVertexVisitedFlags(graphP theGraph, int includeVirtualVertices); void _ClearEdgeVisitedFlags(graphP theGraph); int _ClearAllVisitedFlagsInBicomp(graphP theGraph, int BicompRoot); int _ClearAllVisitedFlagsInOtherBicomps(graphP theGraph, int BicompRoot); void _ClearEdgeVisitedFlagsInUnembeddedEdges(graphP theGraph); int _FillVertexVisitedInfoInBicomp(graphP theGraph, int BicompRoot, int FillValue); int _ClearObstructionMarksInBicomp(graphP theGraph, int BicompRoot); int _gp_FindEdge(graphP theGraph, int u, int v); int _ClearAllVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x); int _SetAllVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x); int _ComputeEdgeRecordType(graphP theGraph, int a, int b, int edgeType); int _RestoreEdgeType(graphP theGraph, int u, int v); int _HideInternalEdges(graphP theGraph, int vertex); int _RestoreInternalEdges(graphP theGraph, int stackBottom); int _RestoreHiddenEdges(graphP theGraph, int stackBottom); int _GetBicompSize(graphP theGraph, int BicompRoot); int _DeleteUnmarkedEdgesInBicomp(graphP theGraph, int BicompRoot); int _ClearInvertedFlagsInBicomp(graphP theGraph, int BicompRoot); void _InitFunctionTable(graphP theGraph); /******************************************************************** Private functions. ********************************************************************/ void _InitVertices(graphP theGraph); void _InitEdges(graphP theGraph); void _ClearGraph(graphP theGraph); int _GetRandomNumber(int NMin, int NMax); int _getUnprocessedChild(graphP theGraph, int parent); int _hasUnprocessedChild(graphP theGraph, int parent); void _AttachEdgeRecord(graphP theGraph, int v, int e, int link, int newEdge); void _DetachEdgeRecord(graphP theGraph, int e); void _RestoreEdgeRecord(graphP theGraph, int e); /* Private functions for which there are FUNCTION POINTERS */ void _InitVertexRec(graphP theGraph, int v); void _InitVertexInfo(graphP theGraph, int v); void _InitEdgeRec(graphP theGraph, int e); int _EnsureVertexCapacity(graphP theGraph, int N); void _ResetGraphStorage(graphP theGraph); int _EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity); /******************************************************************** gp_New() Constructor for graph object. Can create two graphs if restricted to no dynamic memory. ********************************************************************/ graphP gp_New(void) { graphP theGraph = (graphP)calloc(1, sizeof(graphStruct)); graphFunctionTableP functionTable = (graphFunctionTableP)calloc(1, sizeof(graphFunctionTableStruct)); graphPrivateDataP theGraphPrivateData = (graphPrivateDataP)calloc(1, sizeof(graphPrivateDataStruct)); if (theGraph != NULL && functionTable != NULL && theGraphPrivateData != NULL) { theGraph->privateData = (void *)theGraphPrivateData; theGraph->functions = functionTable; _InitFunctionTable(theGraph); _ClearGraph(theGraph); } else { if (theGraph != NULL) { free(theGraph); theGraph = NULL; } if (functionTable != NULL) { free(functionTable); functionTable = NULL; } if (theGraphPrivateData != NULL) { free(theGraphPrivateData); theGraphPrivateData = NULL; } } return theGraph; } /******************************************************************** _InitFunctionTable() If you add functions to the function table, then they must be initialized here, but you must also add the new function pointer to the definition of the graphFunctionTableStruct in graphFunctionTable.h Function headers for the functions used to initialize the table are classified at the top of this file as either imported from other compilation units (extern) or private to this compilation unit. Search for FUNCTION POINTERS in this file to see where to add the function header. ********************************************************************/ void _InitFunctionTable(graphP theGraph) { if (theGraph != NULL && theGraph->functions != NULL) { theGraph->functions->fpEmbeddingInitialize = _EmbeddingInitialize; theGraph->functions->fpEmbedBackEdgeToDescendant = _EmbedBackEdgeToDescendant; theGraph->functions->fpWalkUp = _WalkUp; theGraph->functions->fpWalkDown = _WalkDown; theGraph->functions->fpMergeBicomps = _MergeBicomps; theGraph->functions->fpMergeVertex = _MergeVertex; theGraph->functions->fpHandleBlockedBicomp = _HandleBlockedBicomp; theGraph->functions->fpHandleInactiveVertex = _HandleInactiveVertex; theGraph->functions->fpEmbedPostprocess = _EmbedPostprocess; theGraph->functions->fpMarkDFSPath = _MarkDFSPath; theGraph->functions->fpCheckEmbeddingIntegrity = _CheckEmbeddingIntegrity; theGraph->functions->fpCheckObstructionIntegrity = _CheckObstructionIntegrity; theGraph->functions->fpEnsureVertexCapacity = _EnsureVertexCapacity; theGraph->functions->fpResetGraphStorage = _ResetGraphStorage; theGraph->functions->fpEnsureEdgeCapacity = _EnsureEdgeCapacity; theGraph->functions->fpSortVertices = _SortVertices; theGraph->functions->fpReadPostprocess = _ReadPostprocess; theGraph->functions->fpWritePostprocess = _WritePostprocess; theGraph->functions->fpHideEdge = _HideEdge; theGraph->functions->fpRestoreEdge = _RestoreEdge; theGraph->functions->fpHideVertex = _HideVertex; theGraph->functions->fpRestoreVertex = _RestoreVertex; theGraph->functions->fpContractEdge = _ContractEdge; theGraph->functions->fpIdentifyVertices = _IdentifyVertices; } } /******************************************************************** gp_EnsureVertexCapacity() Allocates memory for N vertices and N virtual vertices. Once N > 0 vertices have been allocated, this method currently does not support being called a second time to add more vertices. This method will also ensure that the edge capacity is allocated or reallocated to be at least (DEFAULT_EDGE_CAPACITY_FACTOR * N), i.e., a capacity for twice that many edge records, two per edge (plus 2 for the default of using one-based arrays). The edge capacity can be set before this function using gp_EnsureEdgeCapacity(). The edgeHoles stack, initially empty, is set to the edgeCapacity, which is big enough to push every edge (to indicate an edge, only one of its two edge records need be pushed). The numEdgeHoles is set to 0; it tracks the edgeHoles stack size, so the number of edge records in use can be efficiently computed. The stack, initially empty, is made big enough for a pair of integers per edge (2 * edgeCapacity), or 6N integers if the edgeCapacity was set below the default. Space for 2 extra integers is added so depth-first search can push (NIL, NIL) to start at a DFS tree root. The BicompRootLists and sortedDFSChildLists are set to a size of N, and they start out empty. DVI and PVI are set to store N of their respective vertex info records. An instance of the isolator context is created. Returns OK on success, NOTOK on aany failure. On NOTOK, graph extensions are freed so that the graph is returned to the post-condition of gp_New(). ********************************************************************/ int gp_EnsureVertexCapacity(graphP theGraph, int N) { // valid params check if (theGraph == NULL || N <= 0) return NOTOK; // Should not call init a second time; use reinit if (gp_GetN(theGraph) > 0) return NOTOK; return theGraph->functions->fpEnsureVertexCapacity(theGraph, N); } int _EnsureVertexCapacity(graphP theGraph, int N) { int Vsize, VIsize, Esize, stackSize; // Compute the vertex and edge capacities of the graph theGraph->N = N; theGraph->NV = N; theGraph->edgeCapacity = theGraph->edgeCapacity > 0 ? theGraph->edgeCapacity : DEFAULT_EDGE_CAPACITY_FACTOR * N; theGraph->numEdgeHoles = 0; VIsize = gp_UpperBoundVertices(theGraph); Vsize = gp_UpperBoundVertexStorage(theGraph); Esize = gp_UpperBoundEdgeStorage(theGraph); // Stack size is 2 integers per edge record plus 2 to start depth-first search at a tree root stackSize = (theGraph->edgeCapacity << 2) + 2; // In case of small edgeCapacity, ensure minimum based on number of vertices stackSize = stackSize <= 2 * 2 * DEFAULT_EDGE_CAPACITY_FACTOR * N ? 2 * 2 * DEFAULT_EDGE_CAPACITY_FACTOR * N + 2 : stackSize; // Allocate memory as described above if ((theGraph->V = (vertexRecP)calloc(Vsize, sizeof(vertexRec))) == NULL || (theGraph->E = (edgeRecP)calloc(Esize, sizeof(edgeRec))) == NULL || (theGraph->edgeHoles = sp_New(theGraph->edgeCapacity)) == NULL || (theGraph->theStack = sp_New(stackSize)) == NULL || (theGraphBicompRootLists(theGraph) = LCNew(VIsize)) == NULL || (theGraphDVI(theGraph) = (DFSUtils_VertexInfoP)calloc(VIsize, sizeof(DFSUtils_VertexInfo))) == NULL || (theGraphPVI(theGraph) = (Planarity_VertexInfoP)calloc(VIsize, sizeof(Planarity_VertexInfo))) == NULL || (theGraphSortedDFSChildLists(theGraph) = LCNew(VIsize)) == NULL || (theGraphExtFace(theGraph) = (extFaceLinkRecP)calloc(Vsize, sizeof(extFaceLinkRec))) == NULL || (theGraphIC(theGraph) = (isolatorContextP)calloc(1, sizeof(isolatorContextStruct))) == NULL || 0) { _ClearGraph(theGraph); return NOTOK; } // Initialize memory _InitVertices(theGraph); _InitEdges(theGraph); _InitIsolatorContext(theGraph); return OK; } /******************************************************************** _InitVertices() ********************************************************************/ void _InitVertices(graphP theGraph) { memset(theGraph->V, NIL_CHAR, gp_UpperBoundVertexStorage(theGraph) * sizeof(vertexRec)); memset(theGraphDVI(theGraph), NIL_CHAR, gp_UpperBoundVertices(theGraph) * sizeof(DFSUtils_VertexInfo)); memset(theGraphPVI(theGraph), NIL_CHAR, gp_UpperBoundVertices(theGraph) * sizeof(Planarity_VertexInfo)); memset(theGraphExtFace(theGraph), NIL_CHAR, gp_UpperBoundVertexStorage(theGraph) * sizeof(extFaceLinkRec)); #ifdef USE_1BASEDARRAYS // For 1-based arrays, the memset() initializes the flags correctly #else for (int v = gp_LowerBoundVertexStorage(theGraph); v < gp_UpperBoundVertexStorage(theGraph); ++v) gp_InitFlags(theGraph, v); #endif } /******************************************************************** _InitEdges() ********************************************************************/ void _InitEdges(graphP theGraph) { memset(theGraph->E, NIL_CHAR, gp_UpperBoundEdgeStorage(theGraph) * sizeof(edgeRec)); #ifdef USE_1BASEDARRAYS #else for (int e = gp_LowerBoundEdgeStorage(theGraph); e < gp_UpperBoundEdgeStorage(theGraph); ++e) gp_InitEdgeFlags(theGraph, e); #endif } /******************************************************************** gp_ResetGraphStorage() Resets the graph to the state immediately after processing by gp_EnsureVertexCapacity(). ********************************************************************/ void gp_ResetGraphStorage(graphP theGraph) { if (theGraph == NULL || gp_GetN(theGraph) <= 0) return; theGraph->functions->fpResetGraphStorage(theGraph); } void _ResetGraphStorage(graphP theGraph) { theGraph->M = 0; theGraph->embedFlags = 0; theGraph->graphFlags &= ~GRAPHFLAGS_DFSNUMBERED; theGraph->graphFlags &= ~GRAPHFLAGS_SORTEDBYDFI; _InitVertices(theGraph); _InitEdges(theGraph); _InitIsolatorContext(theGraph); LCReset(theGraphBicompRootLists(theGraph)); LCReset(theGraphSortedDFSChildLists(theGraph)); sp_ClearStack(theGraph->theStack); sp_ClearStack(theGraph->edgeHoles); theGraph->numEdgeHoles = 0; } /******************************************************************** gp_EnsureEdgeCapacity() This method ensures that theGraph is or will be capable of storing at least requiredEdgeCapacity edge records. Two edge records are needed per edge. This method is most performant when invoked immediately after gp_New(), since it must only set the edgeCapacity and then let normal processing by gp_EnsureVertexCapacity() occur. This method is also a constant time operation if the graph already has at least the requiredEdgeCapacity, since it will return OK without making any structural changes. This method is generally more performant if it is invoked before attaching extensions to the graph. Some extensions associate parallel data with edge records, which is a faster operation if the associated data storage is created and initialized only after the proper edgeCapacity is specified. The array of edge records is allocated or reallocated to satisfy the requiredEdgeCapacity. The new array contains the old edges and edge holes, if any, at the same locations. All newly created edge records are initialized. Also, if the edge capacity was lower than required, then the edgeCapacity member of theGraph is increased and both theStack and the edgeHoles are expanded (since the sizes of both are based on the edge capacity). Extensions that add to data associated with edges must overload this method to ensure the reqquired capacity in the parallel extension data structures. Returns NOTOK on failure to reallocate the edge record array to satisfy the requiredEdgeCapacity OK if reallocation succeeds or is not required ********************************************************************/ int gp_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity) { if (theGraph == NULL || requiredEdgeCapacity <= 0) return NOTOK; if (theGraph->edgeCapacity >= requiredEdgeCapacity) return OK; // In the special case where gp_EnsureVertexCapacity() has not yet // been called, we can simply set the higher edgeCapacity since normal // behavior of gp_EnsureVertexCapacity() will then allocate the // correct number of edge records. if (gp_GetN(theGraph) == 0) { theGraph->edgeCapacity = requiredEdgeCapacity; return OK; } // Try to expand the edge capacity return theGraph->functions->fpEnsureEdgeCapacity(theGraph, requiredEdgeCapacity); } int _EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity) { stackP newStack = NULL; int newEsize = gp_LowerBoundEdgeStorage(theGraph) + (requiredEdgeCapacity << 1); // If the new size is less than or equal to the current edge storage size, // then the graph already has the required edge capacity if (newEsize <= gp_UpperBoundEdgeStorage(theGraph)) return OK; // Expand theStack. Depth-first search needs 2 integers per edge record // (2 edge records per edge), plus 2 to start the DFS on a tree root // if (sp_GetCapacity(theGraph->theStack) < 2 * (2 * requiredEdgeCapacity) + 2) { int newStackSize = 2 * (2 * requiredEdgeCapacity) + 2; if (newStackSize < 2 * DEFAULT_EDGE_CAPACITY_FACTOR * gp_GetN(theGraph) + 2) { // NOTE: We enforce a minimum stack based on number of vertices // if edgeCapacity is small. Currently, this will not // happen because we only 'ensure' edge capacity, i.e., // the capacity can only ever get bigger. However, this // rule is enforced in case future methods are added // that reduce edge capacity newStackSize = 2 * DEFAULT_EDGE_CAPACITY_FACTOR * gp_GetN(theGraph) + 2; } if ((newStack = sp_New(newStackSize)) == NULL) return NOTOK; sp_CopyContent(newStack, theGraph->theStack); sp_Free(&theGraph->theStack); theGraph->theStack = newStack; } // Expand edgeHoles (at most, every edge is a hole if all edges deleted) if ((newStack = sp_New(requiredEdgeCapacity)) == NULL) { return NOTOK; } sp_CopyContent(newStack, theGraph->edgeHoles); sp_Free(&theGraph->edgeHoles); theGraph->edgeHoles = newStack; theGraph->numEdgeHoles = sp_GetCurrentSize(theGraph->edgeHoles); // Reallocate the edgeRec array to the new size, theGraph->E = (edgeRecP)realloc(theGraph->E, newEsize * sizeof(edgeRec)); if (theGraph->E == NULL) return NOTOK; // Initialize the new edge records for (int e = gp_UpperBoundEdgeStorage(theGraph); e < newEsize; ++e) _InitEdgeRec(theGraph, e); // The new edgeCapacity has been successfully allocated theGraph->edgeCapacity = requiredEdgeCapacity; return OK; } /******************************************************************** _InitVertexRec() Sets the fields in a single vertex record to initial values ********************************************************************/ void _InitVertexRec(graphP theGraph, int v) { gp_SetFirstEdge(theGraph, v, NIL); gp_SetLastEdge(theGraph, v, NIL); gp_SetIndex(theGraph, v, NIL); gp_InitFlags(theGraph, v); } /******************************************************************** _InitVertexInfo() Sets the fields in a single vertex record to initial values ********************************************************************/ void _InitVertexInfo(graphP theGraph, int v) { gp_SetVertexParent(theGraph, v, NIL); gp_SetVertexLeastAncestor(theGraph, v, NIL); gp_SetVertexLowpoint(theGraph, v, NIL); gp_SetVertexVisitedInfo(theGraph, v, NIL); gp_SetVertexPertinentEdge(theGraph, v, NIL); gp_SetVertexPertinentRootsList(theGraph, v, NIL); gp_SetVertexFuturePertinentChild(theGraph, v, NIL); gp_SetVertexSortedDFSChildList(theGraph, v, NIL); gp_SetVertexFwdEdgeList(theGraph, v, NIL); } /******************************************************************** _InitEdgeRec() Sets the fields in a single edge record structure to initial values ********************************************************************/ void _InitEdgeRec(graphP theGraph, int e) { gp_SetNeighbor(theGraph, e, NIL); gp_SetPrevEdge(theGraph, e, NIL); gp_SetNextEdge(theGraph, e, NIL); gp_InitEdgeFlags(theGraph, e); } /******************************************************************** _InitIsolatorContext() ********************************************************************/ void _InitIsolatorContext(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); if (IC != NULL) { IC->minorType = MINORTYPE_NONE; IC->v = IC->r = IC->x = IC->y = IC->w = IC->px = IC->py = IC->z = IC->ux = IC->dx = IC->uy = IC->dy = IC->dw = IC->uz = IC->dz = NIL; } } /******************************************************************** _ClearAllVisitedFlagsInGraph() ********************************************************************/ void _ClearAllVisitedFlagsInGraph(graphP theGraph) { _ClearVertexVisitedFlags(theGraph, TRUE); _ClearEdgeVisitedFlags(theGraph); } /******************************************************************** _ClearVertexVisitedFlags() Clears the visited flags of vertices, and if the second parameter is truthy, also clears the visited flags of virtual vertices. ********************************************************************/ void _ClearVertexVisitedFlags(graphP theGraph, int includeVirtualVertices) { for (int v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) gp_ClearVisited(theGraph, v); if (includeVirtualVertices) for (int vv = gp_LowerBoundVirtualVertices(theGraph); vv < gp_UpperBoundVirtualVertices(theGraph); ++vv) gp_ClearVisited(theGraph, vv); } /******************************************************************** _ClearEdgeVisitedFlags() ********************************************************************/ void _ClearEdgeVisitedFlags(graphP theGraph) { for (int e = gp_LowerBoundEdges(theGraph); e < gp_UpperBoundEdges(theGraph); ++e) gp_ClearEdgeVisited(theGraph, e); } /******************************************************************** _ClearAllVisitedFlagsInBicomp() Clears the visited flag of the vertices and edge records in the bicomp rooted by BicompRoot. This method uses the stack but preserves whatever may have been on it. In debug mode, it will return NOTOK if the stack overflows. This method pushes at most one integer per vertex in the bicomp. Returns OK on success, NOTOK on implementation failure. ********************************************************************/ int _ClearAllVisitedFlagsInBicomp(graphP theGraph, int BicompRoot) { int stackBottom = sp_GetCurrentSize(theGraph->theStack); int v, e; sp_Push(theGraph->theStack, BicompRoot); while (sp_GetCurrentSize(theGraph->theStack) > stackBottom) { sp_Pop(theGraph->theStack, v); gp_ClearVisited(theGraph, v); e = gp_GetFirstEdge(theGraph, v); while (gp_IsEdge(theGraph, e)) { gp_ClearEdgeVisited(theGraph, e); if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) sp_Push(theGraph->theStack, gp_GetNeighbor(theGraph, e)); e = gp_GetNextEdge(theGraph, e); } } return OK; } /******************************************************************** _ClearAllVisitedFlagsInOtherBicomps() Typically, we want to clear all visited flags in the graph (see _ClearVisitedFlags). However, in some algorithms this would be too costly, so it is necessary to clear the visited flags only in one bicomp (see _ClearAllVisitedFlagsInBicomp), then do some processing that sets some of the flags then performs some tests. If the tests are positive, then we can clear all the visited flags in the other bicomps (the processing may have set the visited flags in the one bicomp in a particular way that we want to retain, so we skip the given bicomp). ********************************************************************/ int _ClearAllVisitedFlagsInOtherBicomps(graphP theGraph, int BicompRoot) { int R; for (R = gp_LowerBoundVirtualVertices(theGraph); R < gp_UpperBoundVirtualVertices(theGraph); ++R) { if (R != BicompRoot && gp_VirtualVertexInUse(theGraph, R)) { if (_ClearAllVisitedFlagsInBicomp(theGraph, R) != OK) return NOTOK; } } return OK; } /******************************************************************** _ClearEdgeVisitedFlagsInUnembeddedEdges() Unembedded edges aren't part of any bicomp yet, but it may be necessary to clear their visited flags. ********************************************************************/ void _ClearEdgeVisitedFlagsInUnembeddedEdges(graphP theGraph) { int v, e; for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { e = gp_GetVertexFwdEdgeList(theGraph, v); while (gp_IsEdge(theGraph, e)) { gp_ClearEdgeVisited(theGraph, e); gp_ClearEdgeVisited(theGraph, gp_GetTwin(theGraph, e)); e = gp_GetNextEdge(theGraph, e); if (e == gp_GetVertexFwdEdgeList(theGraph, v)) e = NIL; } } } /**************************************************************************** _ClearAllVisitedFlagsOnPath() This method clears the visited flags on the vertices and edges on the path (u, v, ..., w, x) in which all vertices except the endpoints u and x are degree 2. This method avoids performing more than constant work at the path endpoints u and x, so the total work is on the order of the path length. Returns OK on success, NOTOK on internal failure ****************************************************************************/ int _ClearAllVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x) { int e, eTwin; // We want to exit u from e, but we get eTwin first here in order to avoid // work, in case the degree of u is greater than 2. eTwin = _gp_FindEdge(theGraph, v, u); if (gp_IsNotEdge(theGraph, eTwin)) return NOTOK; e = gp_GetTwin(theGraph, eTwin); v = u; do { // Mark the vertex and the exiting edge gp_ClearVisited(theGraph, v); gp_ClearEdgeVisited(theGraph, e); gp_ClearEdgeVisited(theGraph, eTwin); // Get the next vertex v = gp_GetNeighbor(theGraph, e); e = gp_GetNextEdgeCircular(theGraph, eTwin); eTwin = gp_GetTwin(theGraph, e); } while (v != x); // Mark the last vertex with 'visited' gp_ClearVisited(theGraph, x); return OK; } /**************************************************************************** _SetAllVisitedFlagsOnPath() This method sets the visited flags on the vertices and edges on the path (u, v, ..., w, x) in which all vertices except the endpoints u and x are degree 2. This method avoids performing more than constant work at the path endpoints u and x, so the total work is on the order of the path length. Returns OK on success, NOTOK on internal failure ****************************************************************************/ int _SetAllVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x) { int e, eTwin; // We want to exit u from e, but we get eTwin first here in order to avoid // work, in case the degree of u is greater than 2. eTwin = _gp_FindEdge(theGraph, v, u); if (gp_IsNotEdge(theGraph, eTwin)) return NOTOK; e = gp_GetTwin(theGraph, eTwin); v = u; do { // Mark the vertex and the exiting edge gp_SetVisited(theGraph, v); gp_SetEdgeVisited(theGraph, e); gp_SetEdgeVisited(theGraph, eTwin); // Get the next vertex v = gp_GetNeighbor(theGraph, e); e = gp_GetNextEdgeCircular(theGraph, eTwin); eTwin = gp_GetTwin(theGraph, e); } while (v != x); // Mark the last vertex with 'visited' gp_SetVisited(theGraph, x); return OK; } /******************************************************************** _FillVertexVisitedInfoInBicomp() Places the FillValue into the visitedInfo of the non-virtual vertices in the bicomp rooted by BicompRoot. This method uses the stack but preserves whatever may have been on it. In debug mode, it will return NOTOK if the stack overflows. This method pushes at most one integer per vertex in the bicomp. Returns OK on success, NOTOK on implementation failure. ********************************************************************/ int _FillVertexVisitedInfoInBicomp(graphP theGraph, int BicompRoot, int FillValue) { int v, e; int stackBottom = sp_GetCurrentSize(theGraph->theStack); sp_Push(theGraph->theStack, BicompRoot); while (sp_GetCurrentSize(theGraph->theStack) > stackBottom) { sp_Pop(theGraph->theStack, v); if (gp_IsNotVirtualVertex(theGraph, v)) gp_SetVertexVisitedInfo(theGraph, v, FillValue); e = gp_GetFirstEdge(theGraph, v); while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) sp_Push(theGraph->theStack, gp_GetNeighbor(theGraph, e)); e = gp_GetNextEdge(theGraph, e); } } return OK; } /******************************************************************** _ClearObstructionMarksInBicomp() Clears the 'obstruction type' bits for each vertex in the bicomp rooted by BicompRoot. This method uses the stack but preserves whatever may have been on it. In debug mode, it will return NOTOK if the stack overflows. This method pushes at most one integer per vertex in the bicomp. Returns OK on success, NOTOK on implementation failure. ********************************************************************/ int _ClearObstructionMarksInBicomp(graphP theGraph, int BicompRoot) { int V, e; int stackBottom = sp_GetCurrentSize(theGraph->theStack); sp_Push(theGraph->theStack, BicompRoot); while (sp_GetCurrentSize(theGraph->theStack) > stackBottom) { sp_Pop(theGraph->theStack, V); gp_ClearObstructionMark(theGraph, V); e = gp_GetFirstEdge(theGraph, V); while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) sp_Push(theGraph->theStack, gp_GetNeighbor(theGraph, e)); e = gp_GetNextEdge(theGraph, e); } } return OK; } /******************************************************************** _ClearGraph() Clears all memory used by the graph, restoring it to the state it was in immediately after gp_New() created it. ********************************************************************/ void _ClearGraph(graphP theGraph) { if (theGraph->V != NULL) { free(theGraph->V); theGraph->V = NULL; } if (theGraph->E != NULL) { free(theGraph->E); theGraph->E = NULL; } theGraph->N = 0; theGraph->NV = 0; theGraph->M = 0; theGraph->edgeCapacity = 0; theGraph->embedFlags = 0; sp_Free(&theGraph->edgeHoles); theGraph->numEdgeHoles = 0; sp_Free(&theGraph->theStack); LCFree(&theGraphBicompRootLists(theGraph)); if (theGraphDVI(theGraph) != NULL) { free(theGraphDVI(theGraph)); theGraphDVI(theGraph) = NULL; } if (theGraphPVI(theGraph) != NULL) { free(theGraphPVI(theGraph)); theGraphPVI(theGraph) = NULL; } LCFree(&theGraphSortedDFSChildLists(theGraph)); if (theGraphExtFace(theGraph) != NULL) { free(theGraphExtFace(theGraph)); theGraphExtFace(theGraph) = NULL; } if (theGraphIC(theGraph) != NULL) { free(theGraphIC(theGraph)); theGraphIC(theGraph) = NULL; } gp_FreeExtensions(theGraph); // Free the pseudo-extensions if (gp_GetGraphFlags(theGraph) & GRAPHFLAGS_EXTENDEDWITH_OUTERPLANARITY) gp_Detach_Outerplanarity(theGraph); if (gp_GetGraphFlags(theGraph) & GRAPHFLAGS_EXTENDEDWITH_PLANARITY) gp_Detach_Planarity(theGraph); if (gp_GetGraphFlags(theGraph) & GRAPHFLAGS_EXTENDEDWITH_DFSUTILS) gp_Detach_DFSUtils(theGraph); theGraph->graphFlags = 0; } /******************************************************************** gp_Free() Frees G and V, then the graph record. Then sets the caller's graph pointer to NULL (caller must pass the address of a graphP variable). ********************************************************************/ void gp_Free(graphP *pGraph) { if (pGraph == NULL) return; if (*pGraph == NULL) return; _ClearGraph(*pGraph); if ((*pGraph)->functions != NULL) { free((*pGraph)->functions); (*pGraph)->functions = NULL; } if ((*pGraph)->privateData != NULL) { free((*pGraph)->privateData); (*pGraph)->privateData = NULL; } free(*pGraph); *pGraph = NULL; } /******************************************************************** gp_CopyAdjacencyLists() Copies the adjacency lists from the srcGraph to the dstGraph. This method intentionally copies only the adjacency lists of the first N vertices, so the adjacency lists of virtual vertices are excluded (unless the caller temporarily resets the value of N to include NV). Returns OK on success, NOTOK on failures, e.g. if the two graphs have different orders N or if the edgeCapacity of dstGraph cannot be made to be at least that of srcGraph. ********************************************************************/ int gp_CopyAdjacencyLists(graphP dstGraph, graphP srcGraph) { int v, e; if (dstGraph == NULL || srcGraph == NULL) return NOTOK; if (gp_GetN(dstGraph) != gp_GetN(srcGraph) || gp_GetN(dstGraph) == 0) return NOTOK; if (gp_EnsureEdgeCapacity(dstGraph, srcGraph->edgeCapacity) != OK) return NOTOK; // Copy the links that hook each owning vertex to its adjacency list for (v = gp_LowerBoundVertices(srcGraph); v < gp_UpperBoundVertices(srcGraph); ++v) { gp_SetFirstEdge(dstGraph, v, gp_GetFirstEdge(srcGraph, v)); gp_SetLastEdge(dstGraph, v, gp_GetLastEdge(srcGraph, v)); } // Copy the adjacency links and neighbor pointers for each edge record for (e = gp_LowerBoundEdges(srcGraph); e < gp_UpperBoundEdges(srcGraph); ++e) { gp_SetNeighbor(dstGraph, e, gp_GetNeighbor(srcGraph, e)); gp_SetNextEdge(dstGraph, e, gp_GetNextEdge(srcGraph, e)); gp_SetPrevEdge(dstGraph, e, gp_GetPrevEdge(srcGraph, e)); } // Tell the dstGraph how many edges it now has and where the edge holes are dstGraph->M = gp_GetM(srcGraph); sp_Copy(dstGraph->edgeHoles, srcGraph->edgeHoles); dstGraph->numEdgeHoles = sp_GetCurrentSize(dstGraph->edgeHoles); return OK; } /******************************************************************** gp_CopyGraph() Copies the content of the srcGraph into the dstGraph. The dstGraph must have been previously initialized with the same number of vertices as the srcGraph. NOTE: If the dstGraph has a higher edge capacity than the srcGraph, then this call will fail unless the caller first ensures that the edge capacity of the srcGraph is increased to match the dstGraph. Returns OK for success, NOTOK for failure. ********************************************************************/ // Give macro names to three copy operations #define _gp_CopyVertexRec(dstGraph, vdst, srcGraph, vsrc) (dstGraph->V[vdst] = srcGraph->V[vsrc]) #define _gp_CopyDFSUtilsVertexInfo(dstGraph, dstI, srcGraph, srcI) (theGraphDVI(dstGraph)[dstI] = theGraphDVI(srcGraph)[srcI]) #define _gp_CopyPlanarityVertexInfo(dstGraph, dstI, srcGraph, srcI) (theGraphPVI(dstGraph)[dstI] = theGraphPVI(srcGraph)[srcI]) #define _gp_CopyEdgeRec(dstGraph, edst, srcGraph, esrc) (dstGraph->E[edst] = srcGraph->E[esrc]) int gp_CopyGraph(graphP dstGraph, graphP srcGraph) { int v, e; // Parameter checks if (dstGraph == NULL || srcGraph == NULL) { return NOTOK; } // The graphs need to be the same order and initialized if (gp_GetN(dstGraph) != gp_GetN(srcGraph) || gp_GetN(dstGraph) == 0) { return NOTOK; } // Ensure dstGraph has the required edge capacity; this expands // dstGraph if needed, but does not contract. An error is only // returned if the expansion fails. if (gp_EnsureEdgeCapacity(dstGraph, srcGraph->edgeCapacity) != OK) { return NOTOK; } // Copy the vertices (non-virtual only). Augmentations to vertices created // by extensions are copied below by gp_CopyExtensions() for (v = gp_LowerBoundVertices(srcGraph); v < gp_UpperBoundVertices(srcGraph); ++v) { _gp_CopyVertexRec(dstGraph, v, srcGraph, v); if (theGraphDVI(dstGraph) != NULL && theGraphDVI(srcGraph) != NULL) _gp_CopyDFSUtilsVertexInfo(dstGraph, v, srcGraph, v); if (theGraphPVI(dstGraph) != NULL && theGraphPVI(srcGraph) != NULL) _gp_CopyPlanarityVertexInfo(dstGraph, v, srcGraph, v); gp_SetExtFaceVertex(dstGraph, v, 0, gp_GetExtFaceVertex(srcGraph, v, 0)); gp_SetExtFaceVertex(dstGraph, v, 1, gp_GetExtFaceVertex(srcGraph, v, 1)); } // Copy the virtual vertices. Augmentations to virtual vertices created // by extensions are copied below by gp_CopyExtensions() for (v = gp_LowerBoundVirtualVertices(srcGraph); v < gp_UpperBoundVirtualVertices(srcGraph); ++v) { _gp_CopyVertexRec(dstGraph, v, srcGraph, v); gp_SetExtFaceVertex(dstGraph, v, 0, gp_GetExtFaceVertex(srcGraph, v, 0)); gp_SetExtFaceVertex(dstGraph, v, 1, gp_GetExtFaceVertex(srcGraph, v, 1)); } // Copy the basic EdgeRec structures. Augmentations to the edgeRec structure // created by extensions are copied below by gp_CopyExtensions() for (e = gp_LowerBoundEdgeStorage(srcGraph); e < gp_UpperBoundEdgeStorage(srcGraph); e++) _gp_CopyEdgeRec(dstGraph, e, srcGraph, e); // If the dstGraph has more edge storage than the srcGraph, then we clear the extra // base edgeRec structures. In gp_CopyExtensions(), the various extensions' copyData() // functions are expected to clear out any extension-specific extra edgeRec structures if (gp_UpperBoundEdgeStorage(dstGraph) > gp_UpperBoundEdgeStorage(srcGraph)) { for (e = gp_UpperBoundEdgeStorage(srcGraph); e < gp_UpperBoundEdgeStorage(dstGraph); e++) _InitEdgeRec(dstGraph, e); } // Give the dstGraph the same size and intrinsic properties dstGraph->N = gp_GetN(srcGraph); dstGraph->NV = gp_GetNV(srcGraph); dstGraph->M = gp_GetM(srcGraph); dstGraph->embedFlags = gp_GetEmbedFlags(srcGraph); dstGraph->graphFlags = gp_GetGraphFlags(srcGraph); LCCopy(theGraphBicompRootLists(dstGraph), theGraphBicompRootLists(srcGraph)); LCCopy(theGraphSortedDFSChildLists(dstGraph), theGraphSortedDFSChildLists(srcGraph)); sp_Copy(dstGraph->theStack, srcGraph->theStack); sp_Copy(dstGraph->edgeHoles, srcGraph->edgeHoles); dstGraph->numEdgeHoles = sp_GetCurrentSize((dstGraph)->edgeHoles); // Copy the set of extensions, which includes copying the // extension data as well as the function overload tables if (gp_CopyExtensions(dstGraph, srcGraph) != OK) return NOTOK; // We do not copy the function table of srcGraph to the dstGraph // because copy extensions now copies all possible data from // srcGraph to dstGraph, but it does not extend dstGraph with // any extensions it doesn't already have, so the dstGraph // function table is already correct for its type. return OK; } /******************************************************************** gp_DupGraph() ********************************************************************/ graphP gp_DupGraph(graphP theGraph) { graphP result = NULL; if ((result = gp_New()) == NULL) { gp_ErrorMessage("Failed to create a new graph."); return NULL; } if (gp_EnsureVertexCapacity(result, gp_GetN(theGraph)) != OK) { gp_ErrorMessage("Failed to increase the vertex capacity of the new " "graph."); gp_Free(&result); return NULL; } if (gp_CopyGraph(result, theGraph) != OK) { gp_ErrorMessage("Failed to copy the source graph to the new graph."); gp_Free(&result); return NULL; } if (gp_DupExtensions(result, theGraph) != OK) { gp_ErrorMessage("Failed to duplicate the extensions of the source graph into the new graph."); gp_Free(&result); return NULL; } return result; } /******************************************************************** gp_CreateRandomGraph() Creates a randomly generated graph. First a tree is created by connecting each vertex to some successor. Then a random number of additional random edges are added. If an edge already exists, then we retry until a non-existent edge is picked. This function assumes the caller has already called srand(). Returns OK on success, NOTOK on failure ********************************************************************/ int gp_CreateRandomGraph(graphP theGraph) { int N, M, u, v, m; N = gp_GetN(theGraph); /* Generate a random tree; note that this method virtually guarantees that the graph will be renumbered, but it is linear time. Also, we are not generating the DFS tree but rather a tree that simply ensures the resulting random graph is connected. */ for (v = gp_LowerBoundVertices(theGraph) + 1; v < gp_UpperBoundVertices(theGraph); ++v) { u = _GetRandomNumber(gp_LowerBoundVertices(theGraph), v - 1); if (gp_AddEdge(theGraph, u, 0, v, 0) != OK) return NOTOK; } /* Generate a random number of additional edges (actually, leave open a small chance that no additional edges will be added). */ M = _GetRandomNumber(7 * N / 8, theGraph->edgeCapacity); if (M > N * (N - 1) / 2) M = N * (N - 1) / 2; for (m = N - 1; m < M; m++) { u = _GetRandomNumber(gp_LowerBoundVertices(theGraph), gp_UpperBoundVertices(theGraph) - 2); v = _GetRandomNumber(u + 1, gp_UpperBoundVertices(theGraph) - 1); // If the edge (u,v) exists, decrement eIndex to try again if (gp_IsNeighbor(theGraph, u, v)) m--; // If the edge (u,v) doesn't exist, add it else { if (gp_AddEdge(theGraph, u, 0, v, 0) != OK) return NOTOK; } } return OK; } /******************************************************************** _GetRandomNumber() This function generates a random number between NMin and NMax inclusive. It assumes that the caller has called srand(). It calls rand(), but before truncating to the proper range, it adds the high bits of the rand() result into the low bits. The result of this is that the randomness appearing in the truncated bits also has an affect on the non-truncated bits. ********************************************************************/ int _GetRandomNumber(int NMin, int NMax) { int N = rand(); if (NMax < NMin) return NMin; N += ((N & 0xFFFF0000) >> 16); N += ((N & 0x0000FF00) >> 8); N &= 0x7FFFFFF; N %= (NMax - NMin + 1); return N + NMin; } /******************************************************************** _getUnprocessedChild() Support routine for gp_Create RandomGraphEx(), this function obtains a child of the given vertex in the randomly generated tree that has not yet been processed. NIL is returned if the given vertex has no unprocessed children ********************************************************************/ int _getUnprocessedChild(graphP theGraph, int parent) { int e = gp_GetFirstEdge(theGraph, parent); int eTwin = gp_GetTwin(theGraph, e); int child = gp_GetNeighbor(theGraph, e); // The tree edges were added to the beginning of the adjacency list, // and we move processed tree edge records to the end of the list, so // if the immediate next edge record is not a tree edge, then we // return NIL because the vertex has no remaining unprocessed children if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_NOTDEFINED) return NIL; // If the child has already been processed, then all children // have been pushed to the end of the list, and we have just // encountered the first child we processed, so there are no // remaining unprocessed children */ if (gp_GetEdgeVisited(theGraph, e)) return NIL; // We have found an edge leading to an unprocessed child, so // we mark it as processed so that it doesn't get returned // again in future iterations. gp_SetEdgeVisited(theGraph, e); gp_SetEdgeVisited(theGraph, eTwin); // Now we move the edge record in the parent vertex to the end // of the adjacency list of that vertex. gp_MoveEdgeToLast(theGraph, parent, e); // Now we move the edge record in the child vertex to the // end of the adjacency list of the child. gp_MoveEdgeToLast(theGraph, child, eTwin); // Now we set the child's parent and return the child. gp_SetVertexParent(theGraph, child, parent); return child; } /******************************************************************** _hasUnprocessedChild() Support routine for gp_Create RandomGraphEx(), this function obtains a child of the given vertex in the randomly generated tree that has not yet been processed. False (0) is returned unless the given vertex has an unprocessed child. ********************************************************************/ int _hasUnprocessedChild(graphP theGraph, int parent) { int e = gp_GetFirstEdge(theGraph, parent); if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_NOTDEFINED) return 0; if (gp_GetEdgeVisited(theGraph, e)) return 0; return 1; } /******************************************************************** gp_CreateRandomGraphEx() Given a graph structure with a pre-specified number of vertices N, this function creates a graph with the specified number of edges. The primary use case for this method is to generate either a maximal planar graph, or a maximal planar graph plus a number of random additional edges. These cases correspond to the numEdges being equal to 3N-6 or greater than 3N-6, respectively. If numEdges < 3N-6, then the graph generated is a random tree plus edges added systematically to the tree while maintaining planarity. The output graph will have at least numEdges edges, but it may have a few more since more than one edge is added per iteration of the loop that adds the extra edges to the random tree. This function assumes the caller has already called srand(). ********************************************************************/ int gp_CreateRandomGraphEx(graphP theGraph, int numEdges) { int N, M, root, v, c, p, last, u, e; // Parameter checks: Must have a graph of at least three vertices, and the // number of edges must be at least enough to support making a random tree. if (theGraph == NULL || gp_GetN(theGraph) < 3 || numEdges < (gp_GetN(theGraph) - 1)) return NOTOK; N = gp_GetN(theGraph); if (numEdges > theGraph->edgeCapacity) numEdges = theGraph->edgeCapacity; /* Generate a random tree. */ for (v = gp_LowerBoundVertices(theGraph) + 1; v < gp_UpperBoundVertices(theGraph); ++v) { u = _GetRandomNumber(gp_LowerBoundVertices(theGraph), v - 1); if (gp_AddEdge(theGraph, u, 0, v, 0) != OK) return NOTOK; else { e = _gp_FindEdge(theGraph, u, v); gp_SetEdgeType(theGraph, e, EDGE_TYPE_TREE); gp_SetEdgeType(theGraph, gp_GetTwin(theGraph, e), EDGE_TYPE_TREE); gp_ClearEdgeVisited(theGraph, e); gp_ClearEdgeVisited(theGraph, gp_GetTwin(theGraph, e)); } } // Start with generating a maxplanar graph on the random tree // (or adding edges up to numEdges in the fashion of generating a maxplanar graph) M = numEdges <= 3 * N - 6 ? numEdges : 3 * N - 6; // Start with the first vertex root = gp_LowerBoundVertices(theGraph); // Generally, we use v keep track of a traversal down and up all the random tree edges // The last variable marks the location of the last vertex that was an endpoint of the // most recently added edge. v = last = _getUnprocessedChild(theGraph, root); // Just a safety check (all children of root are initially unprocessed) if (gp_IsNotVertex(theGraph, v)) return NOTOK; // Vertex v starts at the first unprocessed child of root and traverses around both sides // of the edges of the random tree until it gets back to the root... except, // The original version of this method generated a maxplanar graph only, but it was // refactored to give greater control of the number of edges. After the refactor, this // loop now stops when the edge count reaches M. Even for a maxplanar graph, that will // happen when v reaches the last unprocessed child of the last unprocessed child of root. // Still, we test for v != root for greater understanding of the idea of this method. while (v != root && gp_GetM(theGraph) < M) { // Get the next unprocessed child of v, if any. This method has the side effect // that it marks the edge (v, c) and hence c as being processed. This method // returns NIL (which not a vertex) if v has no _unprocessed_ children left. c = _getUnprocessedChild(theGraph, v); // If v did have an unprocessed child... if (gp_IsVertex(theGraph, c)) { // FORWARD_LABEL_0 (see below) if (last != v) { if (gp_AddEdge(theGraph, last, 1, c, 1) != OK) return NOTOK; } // Add an edge to create a new triangular face with root, v, and the child c // FORWARD_LABEL_1 (see below) if (gp_AddEdge(theGraph, root, 1, c, 1) != OK) return NOTOK; // Advance the traversal of v to the child c, and also assign c to last because // (root, c) is the last non-tree edge added. v = last = c; } // If v did not have any more unprocessed children, then we have to back up to // the nearest of its tree ancestors that does have an unprocessed child else { // Get the parent of v and get its next unprocessed child, if any p = gp_GetVertexParent(theGraph, v); if (gp_IsVertex(theGraph, p)) c = _getUnprocessedChild(theGraph, p); // Loop until we find an ancestor (p) of v that does have an unprocessed child // This loop also creates more triangular faces as it traverses back up along // the child-to-parent sides of edges to the successive ancestors of v. // FORWARD_LABEL_2 (see below) while (gp_IsVertex(theGraph, p) && gp_IsNotVertex(theGraph, (c))) { // Since we are in this loop, the parent p did not have // an unprocessed child, so we advance both p and v to // enable checking the next higher ancestor v = p; p = gp_GetVertexParent(theGraph, v); // Now that we have advanced upward, there is now a triangular face // we can create between the original v (denoted last) and the new // parent, which is a grandparent or higher of last. // This ensures that we triangulate along the path leading back // up to the next vertex with an unprocessed child. if (gp_IsVertex(theGraph, p)) { // We exclude adding an edge between last and p in the special case // that p has ascended back up to the root because adding the edge // would create a duplicate of the edge added at FORWARD_LABEL_1 if (p != root) { if (gp_AddEdge(theGraph, last, 1, p, 1) != OK) return NOTOK; } } // Now that we have dealt with triangulation of that path up to the new p, // we obtain its next unprocessed child, if any to see if we have gone // to a high enough ancestor that we have an unprocessed child to deal with. // NOTE: At the very least, there will still be an unprocessed child by the // time p gets to the tree root because we haven't yet reached the // edge limit in the outer loop condition. if (gp_IsVertex(theGraph, p)) c = _getUnprocessedChild(theGraph, p); } // Back when v != root was the outer loop condition, it was possible for v to // go to the root, and for p to become NIL (not a vertex). Now, that the outer // loop ends as soon as enough edges are added, p is always a vertex. // Still, we do the test here. if (gp_IsVertex(theGraph, p)) { if (p == root) { // If p is the root, then we create a triangular face containing // v, p==root, and c, where v is the last vertex visited in one // of subtree of p==root, and c is the first vertex visited in the // next subtree of p== root. // NOTE: This is a special kind of edge called a "cross edge" that // joins two vertices that do not have the ancestor-descendant // relationship (i.e., it is not a "back edge" and so the tree // is not a DFS tree). if (gp_AddEdge(theGraph, v, 1, c, 1) != OK) return NOTOK; // If v advanced upward to a higher ancestor than the parent of last, // then we entered the loop at FORWARD_LABEL_2, which triangulated // on the way up, except now we must add an edge that creates a // triangular face with last, v, and c. if (v != last) { if (gp_AddEdge(theGraph, last, 1, c, 1) != OK) return NOTOK; } // NOTE: Because p is the root, we do not advance 'last' to c quite yet // because v will advance to c below and the next iteration of // the outer loop will get _its_ next unprocessed child, say c2. // Only once we know the identity of c2 can we add the extra edge // needed to create a triangular face with last, c, and c2. // This occurs at FORWARD_LABEL_0 above, with v=c and c=c2, // after which last is assigned the value c2. // Perhaps one day enough guilt will accrue to foster doing what // is needed here to allow c to be assigned to last. } // In case p is not the root, then we have already triangulated along the // path up from last to p, so... else { // We add an edge that creates a triangular face with last, p, and c. if (gp_AddEdge(theGraph, last, 1, c, 1) != OK) return NOTOK; // And then an edge that creates a triangular face with root, last, and c. if (gp_AddEdge(theGraph, root, 1, c, 1) != OK) return NOTOK; // At which point, last can advance to c last = c; } // The main traversal tracking variable v can now advance to c v = c; } } } /* Add additional edges if the limit has not yet been reached. */ while (gp_GetM(theGraph) < numEdges) { u = _GetRandomNumber(gp_LowerBoundVertices(theGraph), gp_UpperBoundVertices(theGraph) - 1); v = _GetRandomNumber(gp_LowerBoundVertices(theGraph), gp_UpperBoundVertices(theGraph) - 1); if (u != v && !gp_IsNeighbor(theGraph, u, v)) if (gp_AddEdge(theGraph, u, 0, v, 0) != OK) return NOTOK; } /* Clear the edge types back to 'unknown' */ for (e = gp_LowerBoundEdges(theGraph); e < gp_UpperBoundEdges(theGraph); ++e) { gp_ClearEdgeType(theGraph, e); gp_ClearEdgeVisited(theGraph, e); } /* Put all DFSParent indicators back to NIL */ for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) gp_SetVertexParent(theGraph, v, NIL); return OK; } /******************************************************************** gp_IsNeighbor() Checks whether the adjacency list of an any-type vertex u contains an edge record with a neighbor field indicating v. Returns TRUE or FALSE. NOTE: The edge may be undirected, INONLY or OUTONLY. To test if v is an in-neighbor or out-neighbor of u, use the directed method gp_IsNeighborDirected() instead. ********************************************************************/ int gp_IsNeighbor(graphP theGraph, int u, int v) { int e = NIL; if (theGraph == NULL || u < gp_LowerBoundVertexStorage(theGraph) || u >= gp_UpperBoundVertexStorage(theGraph) || v < gp_LowerBoundVertexStorage(theGraph) || v >= gp_UpperBoundVertexStorage(theGraph)) { #ifdef DEBUG NOTOK; #endif return FALSE; } e = gp_GetFirstEdge(theGraph, u); while (gp_IsEdge(theGraph, e)) { if (gp_GetNeighbor(theGraph, e) == v) return TRUE; e = gp_GetNextEdge(theGraph, e); } return FALSE; } /******************************************************************** gp_IsNeighborDirected() Checks whether the adjacency list of an any-type vertex u contains an edge record with a neighbor field indicating v and a direction flag matching the direction parameter. Returns TRUE or FALSE. NOTE: The valid direction flag values are 0 to match any edge record, or EDGEFLAG_DIRECTION_INONLY to test if v is an in-neighbor of u, or EDGEFLAG_DIRECTION_OUTONLY to test if v is an out-neighbor of u. ********************************************************************/ int gp_IsNeighborDirected(graphP theGraph, int u, int v, unsigned direction) { int e = NIL; if (theGraph == NULL || u < gp_LowerBoundVertexStorage(theGraph) || u >= gp_UpperBoundVertexStorage(theGraph) || v < gp_LowerBoundVertexStorage(theGraph) || v >= gp_UpperBoundVertexStorage(theGraph) || (direction != 0 && direction != EDGEFLAG_DIRECTION_INONLY && direction != EDGEFLAG_DIRECTION_OUTONLY)) { #ifdef DEBUG NOTOK; #endif return FALSE; } e = gp_GetFirstEdge(theGraph, u); while (gp_IsEdge(theGraph, e)) { if (gp_GetNeighbor(theGraph, e) == v) { if (direction == 0 || direction == gp_GetDirection(theGraph, e)) return TRUE; } e = gp_GetNextEdge(theGraph, e); } return FALSE; } /******************************************************************** gp_FindEdge() Searches the adjacency list of an any-type of vertex u to obtain an edge record with v in the neighbor field. Returns the edge record's location, or NIL if there is no such edge. NOTE: The returned edge may be undirected, INONLY or OUTONLY. This method is intended for when a graph is undirected or when an application must treat a directed graph as if it is undirected. To obtain a result for INONLY or OUTONLY edges, use gp_FindDirectedEdge() instead. ********************************************************************/ int gp_FindEdge(graphP theGraph, int u, int v) { if (theGraph == NULL || u < gp_LowerBoundVertexStorage(theGraph) || u >= gp_UpperBoundVertexStorage(theGraph) || v < gp_LowerBoundVertexStorage(theGraph) || v >= gp_UpperBoundVertexStorage(theGraph)) { #ifdef DEBUG NOTOK; #endif return NIL; } return _gp_FindEdge(theGraph, u, v); } /***************************************************************** * _gp_FindEdge() * * Private version of the public method that performs the search * without preceding parameter validation checks. This is called * from other private methods of the graph library, to avoid * duplication of the effort of the checks performed by invoking * public methods. */ int _gp_FindEdge(graphP theGraph, int u, int v) { int e = gp_GetFirstEdge(theGraph, u); while (gp_IsEdge(theGraph, e)) { if (gp_GetNeighbor(theGraph, e) == v) return e; e = gp_GetNextEdge(theGraph, e); } return NIL; } /******************************************************************** gp_FindDirectedEdge() Searches the adjacency list of an any-type of vertex u to obtain an edge record that matches the direction flag and that has v in the neighbor field. Returns the edge record's location, or NIL if there is no such edge. NOTE: The valid direction flag value are 0 for any direction, EDGEFLAG_DIRECTION_INONLY, or EDGEFLAG_DIRECTION_OUTONLY. ********************************************************************/ int gp_FindDirectedEdge(graphP theGraph, int u, int v, unsigned direction) { int e = NIL; if (theGraph == NULL || u < gp_LowerBoundVertexStorage(theGraph) || u >= gp_UpperBoundVertexStorage(theGraph) || v < gp_LowerBoundVertexStorage(theGraph) || v >= gp_UpperBoundVertexStorage(theGraph) || (direction != 0 && direction != EDGEFLAG_DIRECTION_INONLY && direction != EDGEFLAG_DIRECTION_OUTONLY)) { #ifdef DEBUG NOTOK; #endif return NIL; } // If undirected, call the undirected version if (direction == 0) return _gp_FindEdge(theGraph, u, v); // If a direction was given, then use it e = gp_GetFirstEdge(theGraph, u); while (gp_IsEdge(theGraph, e)) { if (gp_GetNeighbor(theGraph, e) == v && gp_GetDirection(theGraph, e) == direction) return e; e = gp_GetNextEdge(theGraph, e); } return NIL; } /******************************************************************** gp_GetVertexDegree() Counts the number of edge records in the adjacency list of a given vertex V. NOTE: For digraphs, this method returns the total degree of the vertex, including undirected, OUTONLY and INONLY edge records. Other functions are defined to get the in-degree or out-degree of a vertex. NOTE: This function determines the degree by counting. An extension could cache the degree value of each vertex and update the cached value as edges are added and deleted. ********************************************************************/ int gp_GetVertexDegree(graphP theGraph, int v) { int e, degree; if (theGraph == NULL || v < gp_LowerBoundVertexStorage(theGraph) || v >= gp_UpperBoundVertexStorage(theGraph)) { #ifdef DEBUG NOTOK; ; #endif return 0; } degree = 0; e = gp_GetFirstEdge(theGraph, v); while (gp_IsEdge(theGraph, e)) { degree++; e = gp_GetNextEdge(theGraph, e); } return degree; } /******************************************************************** gp_GetVertexInDegree() Counts the number of edge records in the adjacency list of a given vertex v that represent edge records from another vertex into v. This includes undirected edges and INONLY edge records, so it only excludes edges records that are marked as OUTONLY. NOTE: This function determines the in-degree by counting. An extension could cache the in-degree value of each vertex and update the cached value as edges are added and deleted. ********************************************************************/ int gp_GetVertexInDegree(graphP theGraph, int v) { int e, degree; if (theGraph == NULL || v < gp_LowerBoundVertexStorage(theGraph) || v >= gp_UpperBoundVertexStorage(theGraph)) { #ifdef DEBUG NOTOK; #endif return 0; } degree = 0; e = gp_GetFirstEdge(theGraph, v); while (gp_IsEdge(theGraph, e)) { if (gp_GetDirection(theGraph, e) != EDGEFLAG_DIRECTION_OUTONLY) degree++; e = gp_GetNextEdge(theGraph, e); } return degree; } /******************************************************************** gp_GetVertexOutDegree() Counts the number of edge records in the adjacency list of a given vertex V that represent edges from V to another vertex. This includes undirected edges and OUTONLY edges, so it only excludes edges records that are marked as INONLY edges. NOTE: This function determines the out-degree by counting. An extension could cache the out-degree value of each vertex and update the cached value as edges are added and deleted. ********************************************************************/ int gp_GetVertexOutDegree(graphP theGraph, int v) { int e, degree; if (theGraph == NULL || v < gp_LowerBoundVertexStorage(theGraph) || v >= gp_UpperBoundVertexStorage(theGraph)) { #ifdef DEBUG NOTOK; #endif return 0; } degree = 0; e = gp_GetFirstEdge(theGraph, v); while (gp_IsEdge(theGraph, e)) { if (gp_GetDirection(theGraph, e) != EDGEFLAG_DIRECTION_INONLY) degree++; e = gp_GetNextEdge(theGraph, e); } return degree; } /******************************************************************** _AttachEdgeRecord() This routine adds newEdge into v's adjacency list at a position adjacent to the edge record for e, either before or after e, depending on link. If e is not an edge (e.g. if e is NIL), then link is assumed to indicate whether the newEdge is to be placed at the beginning or end of v's adjacency list. NOTE: The caller can pass NIL for v if e is not NIL, since the vertex is implied (gp_GetNeighbor(theGraph, eTwin)) The newEdge is assumed to already exist in the data structure (i.e. the storage of edges), as only a whole edge (both edge records) can be inserted into or deleted from the data structure. See also _RestoreEdgeRecord() ********************************************************************/ void _AttachEdgeRecord(graphP theGraph, int v, int e, int link, int newEdge) { if (gp_IsEdge(theGraph, e)) { int e2 = gp_GetAdjacentEdge(theGraph, e, link); // e's link is newEdge, and newEdge's 1^link is e gp_SetAdjacentEdge(theGraph, e, link, newEdge); gp_SetAdjacentEdge(theGraph, newEdge, 1 ^ link, e); // newEdge's link is e2 gp_SetAdjacentEdge(theGraph, newEdge, link, e2); // if e2 is an edge, then e2's 1^link is newEdge, // else v's 1^link is newEdge if (gp_IsEdge(theGraph, e2)) gp_SetAdjacentEdge(theGraph, e2, 1 ^ link, newEdge); else gp_SetEdgeByLink(theGraph, v, 1 ^ link, newEdge); } else { int e2 = gp_GetEdgeByLink(theGraph, v, link); // v's link is newEdge, and newEdge's 1^link is NIL gp_SetEdgeByLink(theGraph, v, link, newEdge); gp_SetAdjacentEdge(theGraph, newEdge, 1 ^ link, NIL); // newEdge's elink is e2 gp_SetAdjacentEdge(theGraph, newEdge, link, e2); // if e2 is an edge, then e2's 1^link is newEdge, // else v's 1^link is newEdge if (gp_IsEdge(theGraph, e2)) gp_SetAdjacentEdge(theGraph, e2, 1 ^ link, newEdge); else gp_SetEdgeByLink(theGraph, v, 1 ^ link, newEdge); } } /**************************************************************************** _DetachEdge() This routine detaches edge record e from its adjacency list, but it does not delete it from the data structure (only a whole edge can be deleted). Some algorithms must temporarily detach an edge, perform some calculation, and eventually put the edge back. This routine supports that operation. The neighboring adjacency list nodes are cross-linked, but the two link members of edge record e are retained, so edge record e can be reattached later by invoking _RestoreEdgeRecord(). A sequence of detached edge records can only be restored in the exact opposite order of their detachment. Thus, algorithms do not directly use this method to implement the temporary detach/restore method. Instead, gp_HideEdge() and gp_RestoreEdge() are used, and algorithms push and pop hidden edges onto and from a stack. A example of this is shown by detaching edges with gp_ContractEdge() or gp_IdentifyVertices(), and then reattaching them with gp_RestoreVertices(), which unwinds the stack with gp_RestoreVertex(). ****************************************************************************/ void _DetachEdgeRecord(graphP theGraph, int e) { int nextEdge = gp_GetNextEdge(theGraph, e), prevEdge = gp_GetPrevEdge(theGraph, e); if (gp_IsEdge(theGraph, nextEdge)) gp_SetPrevEdge(theGraph, nextEdge, prevEdge); else gp_SetLastEdge(theGraph, gp_GetNeighbor(theGraph, gp_GetTwin(theGraph, e)), prevEdge); if (gp_IsEdge(theGraph, prevEdge)) gp_SetNextEdge(theGraph, prevEdge, nextEdge); else gp_SetFirstEdge(theGraph, gp_GetNeighbor(theGraph, gp_GetTwin(theGraph, e)), nextEdge); } /******************************************************************** gp_AddEdge() Adds the undirected edge (u,v) to the graph by placing edge records representing u into v's circular edge record list and v into u's circular edge record list. upos receives the location in G where the u record in v's list will be placed, and vpos is the location in G of the v record we placed in u's list. These are used to initialize the short circuit links. ulink (0|1) indicates whether the edge record to v in u's list should become adjacent to u by its 0 or 1 link, i.e. u[ulink] == vpos. vlink (0|1) indicates whether the edge record to u in v's list should become adjacent to v by its 0 or 1 link, i.e. v[vlink] == upos. NOTE: Only the neighbor and link pointer data members are modified in the edge records. The edge records are otherwise assumed to be in initial state, either from graph initialization/reinitialization, or from edge record reinitialization during gp_DeleteEdge(), if the new edge is filling an edge hole in the edge array.This expectation of being in initial state includes data stored in parallel edge record extension arrays. NOTE: This method does not forbid the addition of duplicate and loop edges. Use with care because other API endpoints do not all support nor check for and eliminate duplicates and loops. The caller can guard against these conditions by pre-testing that u != v and that gp_FindEdge() returns NIL. Returns OK on success, NOTOK on failure, or AT_EDGE_CAPACITY_LIMIT if adding the edge would exceed the graph's edge capacity (the caller can use gp_DynamicAddEdge()). ********************************************************************/ int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink) { int upos, vpos; if (theGraph == NULL || u < gp_LowerBoundVertexStorage(theGraph) || v < gp_LowerBoundVertexStorage(theGraph) || u >= gp_UpperBoundVertexStorage(theGraph) || v >= gp_UpperBoundVertexStorage(theGraph)) return NOTOK; /* We enforce the edge limit */ if (gp_GetM(theGraph) >= theGraph->edgeCapacity) return AT_EDGE_CAPACITY_LIMIT; if (sp_NonEmpty(theGraph->edgeHoles)) { sp_Pop(theGraph->edgeHoles, vpos); theGraph->numEdgeHoles = sp_GetCurrentSize(theGraph->edgeHoles); } else vpos = gp_UpperBoundEdges(theGraph); upos = gp_GetTwin(theGraph, vpos); gp_SetNeighbor(theGraph, upos, v); _AttachEdgeRecord(theGraph, u, NIL, ulink, upos); gp_SetNeighbor(theGraph, vpos, u); _AttachEdgeRecord(theGraph, v, NIL, vlink, vpos); theGraph->M++; return OK; } /******************************************************************** gp_DynamicAddEdge() Refer to documentation for gp_AddEdge() for parameter description. Calls gp_AddEdge(); if AT_EDGE_CAPACITY_LIMIT, doubles the edge capacity using gp_EnsureEdgeCapacity(), then retries gp_AddEdge(). Returns OK on success, NOTOK on failure. ********************************************************************/ int gp_DynamicAddEdge(graphP theGraph, int u, int ulink, int v, int vlink) { int Result = OK; Result = gp_AddEdge(theGraph, u, ulink, v, vlink); if (Result == AT_EDGE_CAPACITY_LIMIT) { // The candidate edge capacity is double the current capacity int candidateEdgeCapacity = gp_GetEdgeCapacity(theGraph) << 1; int N = gp_GetN(theGraph); int newEdgeCapacity = candidateEdgeCapacity; // If the candidate edge capacity exceeds the number of edges // needed in an undirected clique on N vertices, then attempt // to use that as the new edge capacity. if (candidateEdgeCapacity > ((N * (N - 1)) >> 1)) newEdgeCapacity = ((N * (N - 1)) >> 1); // However, if the edge capacity is already greater than or // equal to that maximum capacity needed for an undirected // clique on N vertices, then we allow the capacity to double // beyond the simple undirected graph limit. if (newEdgeCapacity <= gp_GetEdgeCapacity(theGraph)) newEdgeCapacity = candidateEdgeCapacity; Result = gp_EnsureEdgeCapacity(theGraph, newEdgeCapacity); if (Result != OK) return NOTOK; Result = gp_AddEdge(theGraph, u, ulink, v, vlink); } return Result != OK ? NOTOK : Result; } /******************************************************************** gp_InsertEdge() This function adds the edge (u, v) such that the edge record added to the adjacency list of u is adjacent to e_u and the edge record added to the adjacency list of v is adjacent to e_v. The direction of adjacency is given by e_ulink for e_u and e_vlink for e_v. Specifically, the new edge will be comprised of two edge records, n_u and n_v. In u's (v's) adjacency list, n_u (n_v) will be added so that it is indicated by e_u's (e_v's) e_ulink (e_vlink). If e_u (or e_v) is not an edge, then e_ulink (e_vlink) indicates whether to prepend or append to the adjacency list for u (v). NOTE: See notes on gp_AddEdge(). Returns OK on success, NOTOK on failure, or AT_EDGE_CAPACITY_LIMIT if adding the edge would exceed the graph's edge capacity (the caller can invoke gp_EnsureEdgeCapacity() beforehand to avoid an AT_EDGE_CAPACITY_LIMIT result). ********************************************************************/ int gp_InsertEdge(graphP theGraph, int u, int e_u, int e_ulink, int v, int e_v, int e_vlink) { int upos, vpos; if (theGraph == NULL) return NOTOK; if (u < gp_LowerBoundVertexStorage(theGraph) || u >= gp_UpperBoundVertexStorage(theGraph) || v < gp_LowerBoundVertexStorage(theGraph) || v >= gp_UpperBoundVertexStorage(theGraph) || (e_u < gp_LowerBoundEdges(theGraph) && gp_IsEdge(theGraph, e_u)) || e_u >= gp_UpperBoundEdges(theGraph) || (gp_IsEdge(theGraph, e_u) && gp_EdgeNotInUse(theGraph, e_u)) || (e_v < gp_LowerBoundEdges(theGraph) && gp_IsEdge(theGraph, e_v)) || e_v >= gp_UpperBoundEdges(theGraph) || (gp_IsEdge(theGraph, e_v) && gp_EdgeNotInUse(theGraph, e_v)) || e_ulink < 0 || e_ulink > 1 || e_vlink < 0 || e_vlink > 1) return NOTOK; if (gp_GetM(theGraph) >= theGraph->edgeCapacity) return AT_EDGE_CAPACITY_LIMIT; if (sp_NonEmpty(theGraph->edgeHoles)) { sp_Pop(theGraph->edgeHoles, vpos); theGraph->numEdgeHoles = sp_GetCurrentSize(theGraph->edgeHoles); } else vpos = gp_UpperBoundEdges(theGraph); // NOTE: We do not _InitEdgeRec() nor gp_InitEdgeFlags() here because // the vpos edge location is expected to be in initialized state, // either from graph initialization/reinitialization, or from // edge record reinitialization during gp_DeleteEdge, if vpos was // an edge hole. This expectation includes edge record extensions // in graph extensions. upos = gp_GetTwin(theGraph, vpos); gp_SetNeighbor(theGraph, upos, v); _AttachEdgeRecord(theGraph, u, e_u, e_ulink, upos); gp_SetNeighbor(theGraph, vpos, u); _AttachEdgeRecord(theGraph, v, e_v, e_vlink, vpos); theGraph->M++; return OK; } /**************************************************************************** gp_DeleteEdge() This function deletes the given edge record e and its twin, reducing the number of edges M in the graph. NOTE: This method reinitializes the edge records for e and its twin in the base graph data structure. Extensions having parallel edge record extension data elements must implement and use their own edge deletion methods, which must then call gp_DeleteEdge(). Calling gp_DeleteEdge() does not currently clear data in extension data structures. Returns OK on success, NOTOK on failure ****************************************************************************/ int gp_DeleteEdge(graphP theGraph, int e) { if (theGraph == NULL || e < gp_LowerBoundEdges(theGraph) || e >= gp_UpperBoundEdges(theGraph) || gp_EdgeNotInUse(theGraph, e)) return NOTOK; // Delete the edge records e and eTwin from their adjacency lists. _DetachEdgeRecord(theGraph, e); _DetachEdgeRecord(theGraph, gp_GetTwin(theGraph, e)); // Clear the two edge records // (the bit twiddle (e & ~1) chooses the lesser of e and its twin) #ifdef USE_1BASEDARRAYS memset(theGraph->E + (e & ~1), NIL_CHAR, sizeof(edgeRec) << 1); #else _InitEdgeRec(theGraph, e); _InitEdgeRec(theGraph, gp_GetTwin(theGraph, e)); #endif // Now we reduce the number of edges in the data structure theGraph->M--; // If records e and eTwin were not the last in the edge record array, // then record a new hole in the edge array. */ if (e < gp_UpperBoundEdges(theGraph)) { if (theGraph->edgeHoles->size + 1 >= theGraph->edgeHoles->capacity) return NOTOK; sp_Push(theGraph->edgeHoles, e); theGraph->numEdgeHoles = sp_GetCurrentSize(theGraph->edgeHoles); } // Return the previously calculated successor of e. return OK; } /******************************************************************** _RestoreEdgeRecord() This routine reinserts an edge record e into the adjacency list from which it was previously removed by _DetachEdgeRecord(). The assumed processing model is that edge records will be restored in reverse of the order in which they were hidden, i.e. it is assumed that the hidden edges will be pushed on a stack from which they will be popped during restoration. ********************************************************************/ void _RestoreEdgeRecord(graphP theGraph, int e) { int nextEdge = gp_GetNextEdge(theGraph, e), prevEdge = gp_GetPrevEdge(theGraph, e); if (gp_IsEdge(theGraph, nextEdge)) gp_SetPrevEdge(theGraph, nextEdge, e); else gp_SetLastEdge(theGraph, gp_GetNeighbor(theGraph, gp_GetTwin(theGraph, e)), e); if (gp_IsEdge(theGraph, prevEdge)) gp_SetNextEdge(theGraph, prevEdge, e); else gp_SetFirstEdge(theGraph, gp_GetNeighbor(theGraph, gp_GetTwin(theGraph, e)), e); } /******************************************************************** gp_HideEdge() This routine removes the two edge records of an edge from the adjacency lists of its endpoint vertices, but it does not delete them from the storage data structure. Many algorithms must temporarily remove an edge, perform some calculation, and eventually put the edge back. This routine supports that operation. For each edge record of e, the neighboring adjacency list nodes are cross-linked, but the links in the edge record are retained because they indicate the neighbor edge records to which the edge record can be reattached by gp_RestoreEdge(). ********************************************************************/ void gp_HideEdge(graphP theGraph, int e) { if (theGraph == NULL || e < gp_LowerBoundEdges(theGraph) || e >= gp_UpperBoundEdges(theGraph) || gp_EdgeNotInUse(theGraph, e)) { #ifdef DEBUG NOTOK; #endif return; } theGraph->functions->fpHideEdge(theGraph, e); } void _HideEdge(graphP theGraph, int e) { _DetachEdgeRecord(theGraph, e); _DetachEdgeRecord(theGraph, gp_GetTwin(theGraph, e)); } /******************************************************************** gp_RestoreEdge() This routine reinserts two edge records of an edge into the adjacency lists of the edge's endpoints, the edge records having been previously removed by gp_HideEdge(). The assumed processing model is that edges will be restored in reverse of the order in which they were hidden, i.e. it is assumed that the hidden edges will be pushed on a stack and the edges will be popped from the stack for restoration. NOTE: Since both edge records of an edge are restored, only one edge record needs to be pushed on the stack for restoration. This routine restores the two edge records in the opposite order from the order in which they were hidden by gp_HideEdge(). ********************************************************************/ void gp_RestoreEdge(graphP theGraph, int e) { if (theGraph == NULL || e < gp_LowerBoundEdges(theGraph) || e >= gp_UpperBoundEdges(theGraph) || gp_EdgeNotInUse(theGraph, e)) { #ifdef DEBUG NOTOK; #endif return; } theGraph->functions->fpRestoreEdge(theGraph, e); } void _RestoreEdge(graphP theGraph, int e) { _RestoreEdgeRecord(theGraph, gp_GetTwin(theGraph, e)); _RestoreEdgeRecord(theGraph, e); } /******************************************************************** _HideInternalEdges() Pushes onto the graph's stack and hides all edge records of the given vertex's adjacency list except the first and last. This method is typically called on a vertex that is on the external face of a bicomp, where the first and last edge records are the ones that attach the vertex to the external face cycle, and any other edge records in the adjacency list are inside of that cycle. This method uses the stack. The caller is expected to clear the stack or save the stack size before invocation, since the stack size is needed to _RestoreInternalEdges(). ********************************************************************/ int _HideInternalEdges(graphP theGraph, int vertex) { int e = gp_GetFirstEdge(theGraph, vertex); // If the vertex adjacency list is empty or if it contains // only one edge, then there are no *internal* edges to hide if (e == gp_GetLastEdge(theGraph, vertex)) return OK; // Start with the first internal edge e = gp_GetNextEdge(theGraph, e); // Cycle through all the edges, pushing each except stop // before pushing the last edge, which is not internal while (e != gp_GetLastEdge(theGraph, vertex)) { sp_Push(theGraph->theStack, e); gp_HideEdge(theGraph, e); e = gp_GetNextEdge(theGraph, e); } return OK; } /******************************************************************** _RestoreInternalEdges() Reverses the effects of _HideInternalEdges() ********************************************************************/ int _RestoreInternalEdges(graphP theGraph, int stackBottom) { return _RestoreHiddenEdges(theGraph, stackBottom); } /******************************************************************** _RestoreHiddenEdges() Each entry on the stack, down to stackBottom, is assumed to be an edge record pushed in concert with invoking gp_HideEdge(). Each edge is restored using gp_RestoreEdge() in exact reverse of the hiding order. The stack is reduced in content size to stackBottom. Returns OK on success, NOTOK on internal failure. ********************************************************************/ int _RestoreHiddenEdges(graphP theGraph, int stackBottom) { int e; while (sp_GetCurrentSize(theGraph->theStack) > stackBottom) { sp_Pop(theGraph->theStack, e); if (gp_IsNotEdge(theGraph, e)) return NOTOK; gp_RestoreEdge(theGraph, e); } return OK; } /******************************************************************** gp_HideVertex() Pushes onto the graph's stack and hides all edge records of the vertex's adjacency list. Additional integers are then pushed so that the result is reversible by gp_RestoreVertex(). See that method for d etails on the expected stack segment. Returns OK for success, NOTOK for internal failure. ********************************************************************/ int gp_HideVertex(graphP theGraph, int vertex) { if (theGraph == NULL || vertex < gp_LowerBoundVertexStorage(theGraph) || vertex >= gp_UpperBoundVertexStorage(theGraph)) { return NOTOK; } return theGraph->functions->fpHideVertex(theGraph, vertex); } int _HideVertex(graphP theGraph, int vertex) { int hiddenEdgeStackBottom = sp_GetCurrentSize(theGraph->theStack); int e = gp_GetFirstEdge(theGraph, vertex); // Cycle through all the edges, pushing and hiding each while (gp_IsEdge(theGraph, e)) { sp_Push(theGraph->theStack, e); gp_HideEdge(theGraph, e); e = gp_GetNextEdge(theGraph, e); } // Push the additional integers needed by gp_RestoreVertex() sp_Push(theGraph->theStack, hiddenEdgeStackBottom); sp_Push(theGraph->theStack, NIL); sp_Push(theGraph->theStack, NIL); sp_Push(theGraph->theStack, NIL); sp_Push(theGraph->theStack, NIL); sp_Push(theGraph->theStack, NIL); sp_Push(theGraph->theStack, vertex); return OK; } /******************************************************************** gp_ContractEdge() Contracts the edge e=(u,v). This hides the edge (both e and its twin edge record), and it also identifies vertex v with u. See gp_IdentifyVertices() for further details. Returns OK for success, NOTOK for internal failure. ********************************************************************/ int gp_ContractEdge(graphP theGraph, int e) { if (theGraph == NULL || e < gp_LowerBoundEdges(theGraph) || e >= gp_UpperBoundEdges(theGraph) || gp_EdgeNotInUse(theGraph, e)) { return NOTOK; } return theGraph->functions->fpContractEdge(theGraph, e); } int _ContractEdge(graphP theGraph, int e) { int eBefore, u, v; if (gp_IsNotEdge(theGraph, e)) return NOTOK; u = gp_GetNeighbor(theGraph, gp_GetTwin(theGraph, e)); v = gp_GetNeighbor(theGraph, e); eBefore = gp_GetNextEdge(theGraph, e); sp_Push(theGraph->theStack, e); gp_HideEdge(theGraph, e); return gp_IdentifyVertices(theGraph, u, v, eBefore); } /******************************************************************** gp_IdentifyVertices() Identifies vertex v with vertex u by transferring all adjacencies of v to u. Any duplicate edges are removed as described below. The non-duplicate edges of v are added to the adjacency list of u without disturbing their relative order, and they are added before the edge record eBefore in u's list. If eBefore is NIL, then the edges are simply appended to u's list. If u and v are adjacent, then gp_HideEdge() is invoked to remove the edge e=(u,v). Then, the edges of v that indicate neighbors of u are also hidden. This is done by setting the visited flags of u's neighbors, then traversing the adjacency list of v. For each visited neighbor of v, the edge is hidden because it would duplicate an adjacency already expressed in u's list. Finally, the remaining edges of v are moved to u's list, and each twin edge record is adjusted to indicate u as a neighbor rather than v. This routine assumes that the visited flags are clear beforehand, and visited flag settings made herein are cleared before returning. The following are pushed, in order, onto the graph's built-in stack: 1) an integer for each hidden edge 2) the stack size before any hidden edges were pushed 3) six integers that indicate u, v and the edges moved from v to u An algorithm that identifies a series of vertices, either through directly calling this method or via gp_ContractEdge(), can unwind the identifications using gp_RestoreVertices(), which invokes gp_RestoreVertex() repeatedly. Returns OK on success, NOTOK on internal failure ********************************************************************/ int gp_IdentifyVertices(graphP theGraph, int u, int v, int eBefore) { if (theGraph == NULL || u < gp_LowerBoundVertexStorage(theGraph) || u >= gp_UpperBoundVertexStorage(theGraph) || v < gp_LowerBoundVertexStorage(theGraph) || v >= gp_UpperBoundVertexStorage(theGraph) || (eBefore != NIL && eBefore < gp_LowerBoundEdges(theGraph)) || eBefore >= gp_UpperBoundEdges(theGraph) || (eBefore != NIL && gp_EdgeNotInUse(theGraph, eBefore))) { return NOTOK; } return theGraph->functions->fpIdentifyVertices(theGraph, u, v, eBefore); } int _IdentifyVertices(graphP theGraph, int u, int v, int eBefore) { int e = _gp_FindEdge(theGraph, u, v); int hiddenEdgeStackBottom, eBeforePred; // If the vertices are adjacent, then the identification is // essentially an edge contraction with a bit of fixup. if (gp_IsEdge(theGraph, e)) { int result = gp_ContractEdge(theGraph, e); // The edge contraction operation pushes one hidden edge then // recursively calls this method. This method then pushes K // hidden edges then an integer indicating where the top of // stack was before the edges were hidden. That integer // indicator must be decremented, thereby incrementing the // number of hidden edges to K+1. // After pushing the K hidden edges and the stackBottom of // the hidden edges, the recursive call to this method pushes // six more integers to indicate edges that were moved from // v to u, so the "hidden edges stackBottom" is in the next // position down. int hiddenEdgesStackBottomIndex = sp_GetCurrentSize(theGraph->theStack) - 7; int hiddenEdgesStackBottomValue = sp_Get(theGraph->theStack, hiddenEdgesStackBottomIndex); sp_Set(theGraph->theStack, hiddenEdgesStackBottomIndex, hiddenEdgesStackBottomValue - 1); return result; } // Now, u and v are not adjacent. Before we do any edge hiding or // moving, we record the current stack size, as this is the // stackBottom for the edges that will be hidden next. hiddenEdgeStackBottom = sp_GetCurrentSize(theGraph->theStack); // Mark as visited all neighbors of u e = gp_GetFirstEdge(theGraph, u); while (gp_IsEdge(theGraph, e)) { if (gp_GetVisited(theGraph, gp_GetNeighbor(theGraph, e))) return NOTOK; gp_SetVisited(theGraph, gp_GetNeighbor(theGraph, e)); e = gp_GetNextEdge(theGraph, e); } // For each edge record of v, if the neighbor is visited, then // push and hide the edge. e = gp_GetFirstEdge(theGraph, v); while (gp_IsEdge(theGraph, e)) { if (gp_GetVisited(theGraph, gp_GetNeighbor(theGraph, e))) { sp_Push(theGraph->theStack, e); gp_HideEdge(theGraph, e); } e = gp_GetNextEdge(theGraph, e); } // Mark as unvisited all neighbors of u e = gp_GetFirstEdge(theGraph, u); while (gp_IsEdge(theGraph, e)) { gp_ClearVisited(theGraph, gp_GetNeighbor(theGraph, e)); e = gp_GetNextEdge(theGraph, e); } // Push the hiddenEdgeStackBottom as a record of how many hidden // edges were pushed (also, see above for Contract Edge adjustment) sp_Push(theGraph->theStack, hiddenEdgeStackBottom); // Moving v's adjacency list to u is aided by knowing the predecessor // of u's eBefore (the edge record in u's list before which the // edge records of v will be added). eBeforePred = gp_IsEdge(theGraph, eBefore) ? gp_GetPrevEdge(theGraph, eBefore) : gp_GetLastEdge(theGraph, u); // Turns out we only need to record six integers related to the edges // being moved in order to easily restore them later. sp_Push(theGraph->theStack, eBefore); sp_Push(theGraph->theStack, gp_GetLastEdge(theGraph, v)); sp_Push(theGraph->theStack, gp_GetFirstEdge(theGraph, v)); sp_Push(theGraph->theStack, eBeforePred); sp_Push(theGraph->theStack, u); sp_Push(theGraph->theStack, v); // For the remaining edge records of v, reassign the 'v' member // of each twin edge record to indicate u rather than v. e = gp_GetFirstEdge(theGraph, v); while (gp_IsEdge(theGraph, e)) { gp_SetNeighbor(theGraph, gp_GetTwin(theGraph, e), u); e = gp_GetNextEdge(theGraph, e); } // If v has any edges left after hiding edges, indicating common neighbors with u, ... if (gp_IsEdge(theGraph, gp_GetFirstEdge(theGraph, v))) { // Then perform the list union of v into u between eBeforePred and eBefore if (gp_IsEdge(theGraph, eBeforePred)) { if (gp_IsEdge(theGraph, gp_GetFirstEdge(theGraph, v))) { gp_SetNextEdge(theGraph, eBeforePred, gp_GetFirstEdge(theGraph, v)); gp_SetPrevEdge(theGraph, gp_GetFirstEdge(theGraph, v), eBeforePred); } } else { gp_SetFirstEdge(theGraph, u, gp_GetFirstEdge(theGraph, v)); } if (gp_IsEdge(theGraph, eBefore)) { if (gp_IsEdge(theGraph, gp_GetLastEdge(theGraph, v))) { gp_SetNextEdge(theGraph, gp_GetLastEdge(theGraph, v), eBefore); gp_SetPrevEdge(theGraph, eBefore, gp_GetLastEdge(theGraph, v)); } } else { gp_SetLastEdge(theGraph, u, gp_GetLastEdge(theGraph, v)); } gp_SetFirstEdge(theGraph, v, NIL); gp_SetLastEdge(theGraph, v, NIL); } return OK; } /******************************************************************** gp_RestoreVertex() This method assumes the built-in graph stack contents are the result of vertex hide, vertex identify and edge contract operations. This content consists of segments of integers, each segment corresponding to the removal of a vertex during an edge contraction or vertex identification in which a vertex v was merged into a vertex u. The segment contains two blocks of integers. The first block contains information about u, v, the edge records in v's adjacency list that were added to u, and where in u's adjacency list they were added. The second block of integers contains a list of edges incident to v that were hidden from the graph because they were incident to neighbors of v that were also neighbors of u (so they would have produced duplicate edges had they been left in v's adjacency list when it was merged with u's adjacency list). This method pops the first block of the segment off the stack and uses the information to help remove v's adjacency list from u and restore it into v. Then, the second block is removed from the stack, and each indicated edge is restored from the hidden state. It is anticipated that this method will be overloaded by extension algorithms to perform some processing as each vertex is restored. Before restoration, the topmost segment has the following structure: ... FHE ... LHE HESB e_u_succ e_v_last e_v_first e_u_pred u v ^------------| FHE = First hidden edge LHE = Last hidden edge HESB = Hidden edge stack bottom e_u_succ, e_u_pred = The edges of u between which the edges of v were inserted. NIL can appear if the edges of v were added to the beginning or end of u's list e_v_first, e_v_last = The first and last edges of v's list, once the hidden edges were removed Returns OK for success, NOTOK for internal failure. ********************************************************************/ int gp_RestoreVertex(graphP theGraph) { if (theGraph == NULL) return NOTOK; return theGraph->functions->fpRestoreVertex(theGraph); } int _RestoreVertex(graphP theGraph) { int u, v, e_u_succ, e_u_pred, e_v_first, e_v_last, HESB, e; if (sp_GetCurrentSize(theGraph->theStack) < 7) return NOTOK; sp_Pop(theGraph->theStack, v); sp_Pop(theGraph->theStack, u); sp_Pop(theGraph->theStack, e_u_pred); sp_Pop(theGraph->theStack, e_v_first); sp_Pop(theGraph->theStack, e_v_last); sp_Pop(theGraph->theStack, e_u_succ); // If u is not NIL, then vertex v was identified with u. Otherwise, v was // simply hidden, so we skip to restoring the hidden edges. if (gp_IsVertex(theGraph, u)) { // Remove v's adjacency list from u, including accounting for degree 0 case if (gp_IsEdge(theGraph, e_u_pred)) { gp_SetNextEdge(theGraph, e_u_pred, e_u_succ); // If the successor edge exists, link it to the predecessor, // otherwise the predecessor is the new last edge if (gp_IsEdge(theGraph, e_u_succ)) gp_SetPrevEdge(theGraph, e_u_succ, e_u_pred); else gp_SetLastEdge(theGraph, u, e_u_pred); } else if (gp_IsEdge(theGraph, e_u_succ)) { // The successor edge exists, but not the predecessor, // so the successor is the new first edge gp_SetPrevEdge(theGraph, e_u_succ, NIL); gp_SetFirstEdge(theGraph, u, e_u_succ); } else { // Just in case u was degree zero gp_SetFirstEdge(theGraph, u, NIL); gp_SetLastEdge(theGraph, u, NIL); } // Place v's adjacency list into v, including accounting for degree 0 case gp_SetFirstEdge(theGraph, v, e_v_first); gp_SetLastEdge(theGraph, v, e_v_last); if (gp_IsEdge(theGraph, e_v_first)) gp_SetPrevEdge(theGraph, e_v_first, NIL); if (gp_IsEdge(theGraph, e_v_last)) gp_SetPrevEdge(theGraph, e_v_last, NIL); // For each edge record restored to v's adjacency list, reassign the 'v' member // of each twin edge record to indicate v rather than u. e = e_v_first; while (gp_IsEdge(theGraph, e)) { gp_SetNeighbor(theGraph, gp_GetTwin(theGraph, e), v); e = (e == e_v_last ? NIL : gp_GetNextEdge(theGraph, e)); } } // Restore the hidden edges of v, if any sp_Pop(theGraph->theStack, HESB); return _RestoreHiddenEdges(theGraph, HESB); } /******************************************************************** gp_RestoreVertices() This method assumes the built-in graph stack has content consistent with numerous vertex identification or edge contraction operations. This method unwinds the stack, moving edges back to their original vertex owners and restoring hidden edges. This method is a simple iterator that invokes gp_RestoreVertex() until the stack is empty, so extension algorithms are more likely to overload gp_RestoreVertex(). Returns OK for success, NOTOK for internal failure. ********************************************************************/ int gp_RestoreVertices(graphP theGraph) { if (theGraph == NULL) return NOTOK; while (sp_NonEmpty(theGraph->theStack)) { if (gp_RestoreVertex(theGraph) != OK) return NOTOK; } return OK; } /**************************************************************************** _ComputeEdgeRecordType() This is just a little helper function that automates a sequence of decisions that has to be made a number of times. An edge record is being added to the adjacency list of a; it indicates that b is a neighbor. The edgeType can be either 'tree' (EDGE_TYPE_PARENT or EDGE_TYPE_CHILD) or 'cycle' (EDGE_TYPE_BACK or EDGE_TYPE_FORWARD). If a or b is a root copy, we translate to the non-virtual counterpart, then wedetermine which has the lesser DFI. If a has the lower DFI then the edge record is a tree edge to a child (EDGE_TYPE_CHILD) if edgeType indicates a tree edge. If edgeType indicates a cycle edge, then it is a forward cycle edge (EDGE_TYPE_FORWARD) to a descendant. Symmetric conditions define the types for a > b. ****************************************************************************/ int _ComputeEdgeRecordType(graphP theGraph, int a, int b, int edgeType) { a = gp_IsVirtualVertex(theGraph, a) ? gp_GetVertexFromBicompRoot(theGraph, a) : a; b = gp_IsVirtualVertex(theGraph, b) ? gp_GetVertexFromBicompRoot(theGraph, b) : b; if (a < b) return edgeType == EDGE_TYPE_PARENT || edgeType == EDGE_TYPE_CHILD ? EDGE_TYPE_CHILD : EDGE_TYPE_FORWARD; return edgeType == EDGE_TYPE_PARENT || edgeType == EDGE_TYPE_CHILD ? EDGE_TYPE_PARENT : EDGE_TYPE_BACK; } /**************************************************************************** _RestoreEdgeType() When we are restoring an edge, we must restore its type (tree edge or cycle edge). We can deduce what the type was based on other information in the graph. Each edge record of the edge gets the appropriate type setting (parent/child or back/forward). This method runs in constant time plus the degree of vertex u, or constant time if u is known to have a degree bound by a constant. ****************************************************************************/ int _RestoreEdgeType(graphP theGraph, int u, int v) { int e, eTwin, u_orig, v_orig; // If u or v is a virtual vertex (a root copy), then get the non-virtual counterpart. u_orig = gp_IsVirtualVertex(theGraph, u) ? (gp_GetVertexFromBicompRoot(theGraph, u)) : u; v_orig = gp_IsVirtualVertex(theGraph, v) ? (gp_GetVertexFromBicompRoot(theGraph, v)) : v; // Get the edge for which we will set the type e = _gp_FindEdge(theGraph, u, v); eTwin = gp_GetTwin(theGraph, e); // If u_orig is the parent of v_orig, or vice versa, then the edge is a tree edge if (gp_GetVertexParent(theGraph, v_orig) == u_orig || gp_GetVertexParent(theGraph, u_orig) == v_orig) { if (u_orig > v_orig) { gp_ResetEdgeType(theGraph, e, EDGE_TYPE_PARENT); gp_ResetEdgeType(theGraph, eTwin, EDGE_TYPE_CHILD); } else { gp_ResetEdgeType(theGraph, eTwin, EDGE_TYPE_PARENT); gp_ResetEdgeType(theGraph, e, EDGE_TYPE_CHILD); } } // Otherwise it is a back edge else { if (u_orig > v_orig) { gp_ResetEdgeType(theGraph, e, EDGE_TYPE_BACK); gp_ResetEdgeType(theGraph, eTwin, EDGE_TYPE_FORWARD); } else { gp_ResetEdgeType(theGraph, eTwin, EDGE_TYPE_BACK); gp_ResetEdgeType(theGraph, e, EDGE_TYPE_FORWARD); } } return OK; } /******************************************************************** _DeleteUnmarkedEdgesInBicomp() This function deletes from a given biconnected component all edges whose visited member is zero. The stack is used but preserved. In debug mode, NOTOK can result if there is a stack overflow. This method pushes at most one integer per vertex in the bicomp. Returns OK on success, NOTOK on implementation failure ********************************************************************/ int _DeleteUnmarkedEdgesInBicomp(graphP theGraph, int BicompRoot) { int V, e, eNext; int stackBottom = sp_GetCurrentSize(theGraph->theStack); sp_Push(theGraph->theStack, BicompRoot); while (sp_GetCurrentSize(theGraph->theStack) > stackBottom) { sp_Pop(theGraph->theStack, V); e = gp_GetFirstEdge(theGraph, V); while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) sp_Push(theGraph->theStack, gp_GetNeighbor(theGraph, e)); eNext = gp_GetNextEdge(theGraph, e); if (!gp_GetEdgeVisited(theGraph, e)) gp_DeleteEdge(theGraph, e); e = eNext; } } return OK; } /******************************************************************** _ClearInvertedFlagsInBicomp() This function clears the inverted flag markers on any edges in a given biconnected component. The stack is used but preserved. In debug mode, NOTOK can result if there is a stack overflow. This method pushes at most one integer per vertex in the bicomp. Returns OK on success, NOTOK on implementation failure ********************************************************************/ int _ClearInvertedFlagsInBicomp(graphP theGraph, int BicompRoot) { int V, e; int stackBottom = sp_GetCurrentSize(theGraph->theStack); sp_Push(theGraph->theStack, BicompRoot); while (sp_GetCurrentSize(theGraph->theStack) > stackBottom) { sp_Pop(theGraph->theStack, V); e = gp_GetFirstEdge(theGraph, V); while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) { sp_Push(theGraph->theStack, gp_GetNeighbor(theGraph, e)); gp_ClearEdgeFlagInverted(theGraph, e); } e = gp_GetNextEdge(theGraph, e); } } return OK; } /******************************************************************** _GetBicompSize() Determine the number of vertices in the bicomp. The stack is used but preserved. In debug mode, NOTOK can result if there is a stack overflow. This method pushes at most one integer per vertex in the bicomp. Returns a positive number on success, NOTOK on implementation failure ********************************************************************/ int _GetBicompSize(graphP theGraph, int BicompRoot) { int V, e; int theSize = 0; int stackBottom = sp_GetCurrentSize(theGraph->theStack); sp_Push(theGraph->theStack, BicompRoot); while (sp_GetCurrentSize(theGraph->theStack) > stackBottom) { sp_Pop(theGraph->theStack, V); theSize++; e = gp_GetFirstEdge(theGraph, V); while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) sp_Push(theGraph->theStack, gp_GetNeighbor(theGraph, e)); e = gp_GetNextEdge(theGraph, e); } } return theSize; } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/graph.h000066400000000000000000000563641522057144000245640ustar00rootroot00000000000000#ifndef GRAPH_H #define GRAPH_H /* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #ifdef __cplusplus extern "C" { #endif // Basic declarations, such as for OK, NOTOK, and NIL #include "lowLevelUtils/appconst.h" /////////////////////////////////////////////////////////////////////////////// // The top-level operations at the graph, vertex, and edge levels /////////////////////////////////////////////////////////////////////////////// // Forward declaration of graph structure and graph pointer type definitions // (see the end of this header file). typedef struct graphStruct graphStruct; typedef graphStruct *graphP; // Methods related to graph allocation and destruction graphP gp_New(void); int gp_EnsureVertexCapacity(graphP theGraph, int N); int gp_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity); void gp_ResetGraphStorage(graphP theGraph); void gp_Free(graphP *pGraph); // N=# of vertices; NV=# of virtual vertices; M=# of edges #define gp_GetN(theGraph) ((theGraph)->N) #define gp_GetNV(theGraph) ((theGraph)->NV) #define gp_GetM(theGraph) ((theGraph)->M) #define gp_GetEdgeCapacity(theGraph) ((theGraph)->edgeCapacity) // Basic graph utility methods int gp_CopyGraph(graphP dstGraph, graphP srcGraph); graphP gp_DupGraph(graphP theGraph); int gp_CopyAdjacencyLists(graphP dstGraph, graphP srcGraph); int gp_CreateRandomGraph(graphP theGraph); int gp_CreateRandomGraphEx(graphP theGraph, int numEdges); // Basic graph I/O methods: see graphIO.h // Intermediate graph I/O methods: see g6-read-iterator.h and g6-write-iterator.h // Basic vertex interrogators int gp_IsNeighbor(graphP theGraph, int u, int v); int gp_FindEdge(graphP theGraph, int u, int v); int gp_GetVertexDegree(graphP theGraph, int v); // Basic interrogators for directed graphs // The direction can be EDGEFLAG_DIRECTION_INONLY or EDGEFLAG_DIRECTION_OUTONLY int gp_IsNeighborDirected(graphP theGraph, int u, int v, unsigned direction); int gp_FindDirectedEdge(graphP theGraph, int u, int v, unsigned direction); int gp_GetVertexInDegree(graphP theGraph, int v); int gp_GetVertexOutDegree(graphP theGraph, int v); // Basic graph structure manipulators int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink); int gp_DynamicAddEdge(graphP theGraph, int u, int ulink, int v, int vlink); int gp_InsertEdge(graphP theGraph, int u, int e_u, int e_ulink, int v, int e_v, int e_vlink); int gp_DeleteEdge(graphP theGraph, int e); // Intermediate graph structure manipulators void gp_HideEdge(graphP theGraph, int e); void gp_RestoreEdge(graphP theGraph, int e); int gp_HideVertex(graphP theGraph, int vertex); int gp_RestoreVertex(graphP theGraph); // Advanced graph structure manipulators int gp_ContractEdge(graphP theGraph, int e); int gp_IdentifyVertices(graphP theGraph, int u, int v, int eBefore); int gp_RestoreVertices(graphP theGraph); // For methods and declarations related to depth-first search (DFS), see graphDFSUtils.h /* Graph Flags (bit flags set by various public graphLib APIs): Bits 0-3 reserved for base graph class Bits 4-7 reserved for graph I/O Bits 8-15 reserved for DFS Utils Bits 16-23 reserved for Planarity-Related bits 24-31 reserved for future expansion */ #define gp_GetGraphFlags(theGraph) ((theGraph)->graphFlags) // For graph embedding methods and declarations, see graphPlanarity.h /******************************************************************** Vertex Record Definition (For non-virtual and virtual vertices) This record definition provides the data members needed for the core structural information for both vertices and virtual vertices. Non-virtual vertices are also equipped with additional information provided by private vertexInfo records. The vertices of a graph are stored in the first N locations of array V. Virtual vertices are secondary vertices used to help represent the main vertices in substructural components of a graph (such as in biconnected components). link[2]: the first and last edge records in the adjacency list of the vertex. index: In vertices, stores either the depth first index of a vertex or the original array index of the vertex if the vertices of the graph are sorted by DFI. In virtual vertices, the index may be used to indicate the vertex that the virtual vertex represents, unless an algorithm has some other way of making the association (for example, the planarity algorithms rely on biconnected components and therefore place virtual vertices of a vertex at positions corresponding to the DFS children of the vertex). flags: Bits 0-15 reserved for library; bits 16 and higher for apps Bit 0: visited, for vertices and virtual vertices Bit 1: marked, 2nd visited flag, for while visiting all Used in K4 homeomorph search algorithm Bit 2: Obstruction type VERTEX_TYPE_SET (versus not set, i.e. VERTEX_TYPE_UNKNOWN) Bit 3: Obstruction type qualifier RYW (set) versus RXW (clear) Bit 4: Obstruction type qualifier high (set) versus low (clear) Bits 2-4 used in planarity-related algorithms ********************************************************************/ struct vertexRec { int link[2]; int index; unsigned flags; }; typedef struct vertexRec vertexRec; typedef vertexRec *vertexRecP; //////////////////////////////////////////// // Accessors for vertex adjacency list links // such as for adjacency list iteration // (see also gp_GetNextEdge and gp_IsEdge) //////////////////////////////////////////// #define gp_GetFirstEdge(theGraph, v) (theGraph->V[v].link[0]) #define gp_GetLastEdge(theGraph, v) (theGraph->V[v].link[1]) #define gp_GetEdgeByLink(theGraph, v, theLink) (theGraph->V[v].link[theLink]) // Setters for adjacency list links #define gp_SetFirstEdge(theGraph, v, newFirstEdge) (theGraph->V[v].link[0] = newFirstEdge) #define gp_SetLastEdge(theGraph, v, newLastEdge) (theGraph->V[v].link[1] = newLastEdge) #define gp_SetEdgeByLink(theGraph, v, theLink, newEdge) (theGraph->V[v].link[theLink] = newEdge) /////////////////////////////////// // Vertex iteration-related methods /////////////////////////////////// // The original N non-virtual vertices of a graph start at the lowest allowed storage location. // The upper bound is one-past-the-end of the storage for the N non-virtual vertices. #ifdef USE_1BASEDARRAYS #define gp_LowerBoundVertices(theGraph) (1) #else #define gp_LowerBoundVertices(theGraph) (0) #endif #define gp_UpperBoundVertices(theGraph) (gp_LowerBoundVertexStorage(theGraph) + gp_GetN(theGraph)) // The virtual vertices start at the one-past-the-end upper bound of the non-virtual vertices. // The upper bound is one-past-the-end of the virtual vertex storage locations. #define gp_LowerBoundVirtualVertices(theGraph) gp_UpperBoundVertices(theGraph) #define gp_UpperBoundVirtualVertices(theGraph) (gp_LowerBoundVertexStorage(theGraph) + gp_GetN(theGraph) + gp_GetNV(theGraph)) // These lower and upper bounds for all vertex storage are used for tasks like initializing // that must iterate through all of non-virtual and virtual vertex records. #define gp_LowerBoundVertexStorage(theGraph) gp_LowerBoundVertices(theGraph) #define gp_UpperBoundVertexStorage(theGraph) gp_UpperBoundVirtualVertices(theGraph) #ifdef USE_1BASEDARRAYS // The use of *Vertex* alone consistently refers to the first N vertices. // The use of *VirtualVertex* refers to vertex array locations after the first N. #ifndef DEBUG #define gp_IsVertex(theGraph, v) (v) #define gp_IsVirtualVertex(theGraph, v) ((v) > gp_GetN(theGraph)) #else // See below for definitions common to 1-based and 0-based #endif #else // Using 0-based Arrays #ifndef DEBUG #define gp_IsVertex(theGraph, v) ((v) != NIL) #define gp_IsVirtualVertex(theGraph, v) ((v) >= gp_GetN(theGraph)) #else // See below for definitions common to 1-based and 0-based #endif #endif // End of 0-based Arrays // The same for 1-based and 0-based when debugging #ifdef DEBUG #define gp_IsVertex(theGraph, v) \ ((v) == NIL ? 0 : ((v) < gp_LowerBoundVertices(theGraph) ? (NOTOK, 0) : ((v) >= gp_UpperBoundVertices(theGraph) ? (NOTOK, 0) : 1))) // NOTE: gp_IsVirtualVertex() is sometimes called to distinguish between // an existing non-virtual and a virtual #define gp_IsVirtualVertex(theGraph, v) \ ((v) == NIL \ ? 0 \ : ((v) < gp_LowerBoundVirtualVertices(theGraph) \ ? ((v) < gp_LowerBoundVertices(theGraph) ? (NOTOK, 0) : 0) \ : ((v) >= gp_UpperBoundVirtualVertices(theGraph) ? (NOTOK, 0) : 1))) #endif #define gp_IsNotVertex(theGraph, v) (!(gp_IsVertex(theGraph, v))) #define gp_IsNotVirtualVertex(theGraph, v) (!(gp_IsVirtualVertex(theGraph, v))) #define gp_VirtualVertexInUse(theGraph, virtualVertex) (gp_IsEdge(theGraph, gp_GetFirstEdge(theGraph, virtualVertex))) #define gp_VirtualVertexNotInUse(theGraph, virtualVertex) (gp_IsNotEdge(theGraph, gp_GetFirstEdge(theGraph, virtualVertex))) /////////////////////////////////////////// // End of Vertex iteration-related methods ////////////////////////////////////////// // Accessors for non-virtual and virtual vertex index value #define gp_GetIndex(theGraph, v) (theGraph->V[v].index) #define gp_SetIndex(theGraph, v, theIndex) (theGraph->V[v].index = theIndex) // Initializer for non-virtual and virtual vertex flags #define gp_InitFlags(theGraph, v) (theGraph->V[v].flags = 0) // Definition and accessors for the non-virtual and virtual vertex visited flag #define VERTEX_VISITED_MASK 1 #define gp_GetVisited(theGraph, v) (theGraph->V[v].flags & VERTEX_VISITED_MASK) #define gp_ClearVisited(theGraph, v) (theGraph->V[v].flags &= ~VERTEX_VISITED_MASK) #define gp_SetVisited(theGraph, v) (theGraph->V[v].flags |= VERTEX_VISITED_MASK) // Definition and accessors for the non-virtual and virtual vertex marked flag // Essentially, this is a second visitation flag that can help applications that // must visit all vertices to analyze and mark the ones important for some purpose. #define VERTEX_MARKED_MASK 2 #define gp_GetMarked(theGraph, v) (theGraph->V[v].flags & VERTEX_MARKED_MASK) #define gp_ClearMarked(theGraph, v) (theGraph->V[v].flags &= ~VERTEX_MARKED_MASK) #define gp_SetMarked(theGraph, v) (theGraph->V[v].flags |= VERTEX_MARKED_MASK) /******************************************************************** Edge Record Definition An edge is defined by a pair of edge records allocated in array E of a graph. A pair of edge records represents the edge in the adjacency lists of each vertex to which the edge is incident. link[2]: the next and previous edge records in the adjacency list that contains this edge record. v: The vertex neighbor of the vertex whose adjacency list contains this edge record (an index into array V). flags: Bits 0-15 reserved for library; bits 16 and higher for apps Bit 0: Visited Bit 1: Marked (2nd visited flag, for while visiting all) Bit 2: DFS type has been set, versus not set Bit 3: DFS tree edge, versus cycle edge (co-tree edge, etc.) Bit 4: DFS edge pointing to descendant, versus to ancestor Bit 5: Inverted (same as marking an edge with a "sign" of -1) Bit 6: Edge record is directed into the containing vertex only Bit 7: Edge record is directed from the containing vertex only ********************************************************************/ struct edgeRec { int link[2]; int neighbor; unsigned flags; }; typedef struct edgeRec edgeRec; typedef edgeRec *edgeRecP; // An edge is represented by two consecutive edge records in the edge array E. // If an even number, xor 1 will add one; if an odd number, xor 1 will subtract 1 #define gp_GetTwin(theGraph, e) ((e) ^ 1) //////////////////////////////////////////// // Access to adjacency list pointers // such as for adjacency list iteration //////////////////////////////////////////// #define gp_GetNextEdge(theGraph, e) (theGraph->E[e].link[0]) #define gp_GetPrevEdge(theGraph, e) (theGraph->E[e].link[1]) #define gp_GetAdjacentEdge(theGraph, e, theLink) (theGraph->E[e].link[theLink]) #define gp_SetNextEdge(theGraph, e, newNextEdge) (theGraph->E[e].link[0] = newNextEdge) #define gp_SetPrevEdge(theGraph, e, newPrevEdge) (theGraph->E[e].link[1] = newPrevEdge) #define gp_SetAdjacentEdge(theGraph, e, theLink, newEdge) (theGraph->E[e].link[theLink] = newEdge) //////////////////////////////////////////// // gp_IsEdge() helps detect the end of an // adjacency list iteration loop //////////////////////////////////////////// #ifdef USE_1BASEDARRAYS #define gp_IsEdge(theGraph, e) (e) #define gp_IsNotEdge(theGraph, e) (!(e)) #else #define gp_IsEdge(theGraph, e) ((e) != NIL) #define gp_IsNotEdge(theGraph, e) ((e) == NIL) #endif // Get/set 'neighbor' member indicated by edge record e #define gp_GetNeighbor(theGraph, e) (theGraph->E[e].neighbor) #define gp_SetNeighbor(theGraph, e, v) (theGraph->E[e].neighbor = v) // Initializer for edge flags #define gp_InitEdgeFlags(theGraph, e) (theGraph->E[e].flags = 0) // Definitions of and access to edge flags #define EDGE_VISITED_MASK 1 #define gp_GetEdgeVisited(theGraph, e) (theGraph->E[e].flags & EDGE_VISITED_MASK) #define gp_ClearEdgeVisited(theGraph, e) (theGraph->E[e].flags &= ~EDGE_VISITED_MASK) #define gp_SetEdgeVisited(theGraph, e) (theGraph->E[e].flags |= EDGE_VISITED_MASK) // Definition and accessors for the edge marked flag // Essentially, this is a second visitation flag that can help applications that // must visit all edges to analyze and mark the ones important for some purpose. #define EDGE_MARKED_MASK 2 #define gp_GetEdgeMarked(theGraph, e) (theGraph->E[e].flags & EDGE_MARKED_MASK) #define gp_ClearEdgeMarked(theGraph, e) (theGraph->E[e].flags &= ~EDGE_MARKED_MASK) #define gp_SetEdgeMarked(theGraph, e) (theGraph->E[e].flags |= EDGE_MARKED_MASK) // The edge type is defined by bits 2-4, 4+8+16=28 #define EDGE_TYPE_MASK 28 // Call gp_GetEdgeType(), then compare to one of these four possibilities // EDGE_TYPE_CHILD - edge record points to a neighboring DFS child // EDGE_TYPE_FORWARD - edge record points to a DFS descendant, not a DFS child // EDGE_TYPE_PARENT - edge record points to the DFS parent // EDGE_TYPE_BACK - edge record points to a DFS ancestor, not the DFS parent // NOTE: A parent/child tree edge has bit 3 (8) set, forward/back edges do not #define EDGE_TYPE_CHILD 28 #define EDGE_TYPE_FORWARD 20 #define EDGE_TYPE_PARENT 12 #define EDGE_TYPE_BACK 4 // EDGE_TYPE_NOTDEFINED - the edge record type has not been defined // EDGE_TYPE_TREE - edge record is part of a randomly generated tree // NOTE: EDGE_TYPE_TREE uses the same bit 3 as DFS parent and child edges above #define EDGE_TYPE_NOTDEFINED 0 #define EDGE_TYPE_TREE 8 #define gp_GetEdgeType(theGraph, e) (theGraph->E[e].flags & EDGE_TYPE_MASK) #define gp_ClearEdgeType(theGraph, e) (theGraph->E[e].flags &= ~EDGE_TYPE_MASK) #define gp_SetEdgeType(theGraph, e, type) (theGraph->E[e].flags |= type) #define gp_ResetEdgeType(theGraph, e, type) \ (theGraph->E[e].flags = (theGraph->E[e].flags & ~EDGE_TYPE_MASK) | type) #define EDGEFLAG_INVERTED_MASK 32 #define gp_GetEdgeFlagInverted(theGraph, e) (theGraph->E[e].flags & EDGEFLAG_INVERTED_MASK) #define gp_SetEdgeFlagInverted(theGraph, e) (theGraph->E[e].flags |= EDGEFLAG_INVERTED_MASK) #define gp_ClearEdgeFlagInverted(theGraph, e) (theGraph->E[e].flags &= (~EDGEFLAG_INVERTED_MASK)) #define gp_XorEdgeFlagInverted(theGraph, e) (theGraph->E[e].flags ^= EDGEFLAG_INVERTED_MASK) #define EDGEFLAG_DIRECTION_INONLY 64 #define EDGEFLAG_DIRECTION_OUTONLY 128 #define EDGEFLAG_DIRECTION_MASK 192 // Returns the direction, if any, of the edge record #define gp_GetDirection(theGraph, e) (theGraph->E[e].flags & EDGEFLAG_DIRECTION_MASK) // A direction of 0 clears directedness. Otherwise, edge record e is set // to direction and e's twin edge record is set to the opposing setting. #define gp_SetDirection(theGraph, e, direction) \ { \ if (direction == EDGEFLAG_DIRECTION_INONLY) \ { \ theGraph->E[e].flags |= EDGEFLAG_DIRECTION_INONLY; \ theGraph->E[gp_GetTwin(theGraph, e)].flags |= EDGEFLAG_DIRECTION_OUTONLY; \ } \ else if (direction == EDGEFLAG_DIRECTION_OUTONLY) \ { \ theGraph->E[e].flags |= EDGEFLAG_DIRECTION_OUTONLY; \ theGraph->E[gp_GetTwin(theGraph, e)].flags |= EDGEFLAG_DIRECTION_INONLY; \ } \ else \ { \ theGraph->E[e].flags &= ~EDGEFLAG_DIRECTION_MASK; \ theGraph->E[gp_GetTwin(theGraph, e)].flags &= ~EDGEFLAG_DIRECTION_MASK; \ } \ } // Iterate through all edges with gp_LowerBoundEdges, gp_UpperBoundEdges, and gp_EdgeInUse #ifdef USE_1BASEDARRAYS #define gp_LowerBoundEdges(theGraph) (2) #define gp_UpperBoundEdges(theGraph) (gp_LowerBoundEdges(theGraph) + ((gp_GetM(theGraph) + (theGraph)->numEdgeHoles) << 1)) #define gp_EdgeInUse(theGraph, e) (gp_GetNeighbor(theGraph, e)) #define gp_EdgeNotInUse(theGraph, e) (!gp_GetNeighbor(theGraph, e)) #else #define gp_LowerBoundEdges(theGraph) (0) #define gp_UpperBoundEdges(theGraph) (gp_LowerBoundEdges(theGraph) + ((gp_GetM(theGraph) + (theGraph)->numEdgeHoles) << 1)) #define gp_EdgeInUse(theGraph, e) (gp_GetNeighbor(theGraph, e) != NIL) #define gp_EdgeNotInUse(theGraph, e) (gp_GetNeighbor(theGraph, e) == NIL) #endif // These lower and upper bounds for edge storage are used for tasks like initializing that // must iterate through all of the edge storage, including space not yet containing edges. #define gp_LowerBoundEdgeStorage(theGraph) (gp_LowerBoundEdges(theGraph)) #define gp_UpperBoundEdgeStorage(theGraph) (gp_LowerBoundEdgeStorage(theGraph) + ((theGraph)->edgeCapacity << 1)) // The initial setting for the edge storage capacity expressed as a constant factor of N, // which is the number of vertices in the graph. By default, array E is allocated enough // space to contain 3N edges, which is 6N edge records, but this initial setting can be // overridden using gp_EnsureEdgeCapacity(). It is especially efficient to change to ensure // a higher edge capacity if done before calling gp_EnsureVertexCapacity() or gp_Read(). #define DEFAULT_EDGE_CAPACITY_FACTOR 3 // This value is returned by gp_AddEdge() and gp_InsertEdge() if adding or inserting // the edge would exceed the edge capacity limit. The limit can be increased by // calling gp_EnsureEdgeCapacity(), or by calling gp_DynamicAddEdge(). #define AT_EDGE_CAPACITY_LIMIT -1 // A bounds-checking version of gp_IsEdge() for DEBUG mode compilation #ifdef DEBUG #undef gp_IsEdge #define gp_IsEdge(theGraph, e) \ ((e) == NIL \ ? 0 \ : ((e) < gp_LowerBoundEdgeStorage(theGraph) || (e) >= gp_UpperBoundEdgeStorage(theGraph) \ ? (NOTOK, 0) \ : 1)) #endif // Declaration of package-private data type for managing a // stack of integers typedef struct stackStruct stackStruct; typedef stackStruct *stackP; // Declaration of package private data types for extending the base Graph class // with subclasses having data members and function overloads typedef struct graphExtensionStruct graphExtensionStruct; typedef graphExtensionStruct *graphExtensionP; typedef struct graphFunctionTableStruct graphFunctionTableStruct; typedef graphFunctionTableStruct *graphFunctionTableP; /******************************************************************** Graph structure definition V : Array of vertex records (allocated size N + NV) N : Number of non-virtual vertices (the "order" of the graph) NV: Number of virtual vertices (currently always equal to N) E : Array of edge records (edge records come in pairs and represent an edge in each of the two vertex endpoints of the edge) M: Number of edges (the "size" of the graph) edgeCapacity: the maximum number of edges allowed in E edgeHoles: free locations in E where edges have been deleted numEdgeHoles: package private member indicating the number of edge holes. graphFlags: Additional state information about the graph embedFlags: records the type of embedding requested (uses EMBEDFLAGS) theStack: Used by methods of the base Graph class and its subclasses extensions: an object-oriented hierarchy of graph classes is implemented manually as a list of extensions for data of any subclasses with which a graph has been extended. extensionLookupTable: if not NULL, keeps an array of pointers to the extensions indexed by ID for constant-time lookup. functions: object-oriented class hierarchies includes virtual function overloading, which is provided by this function pointer table. privateData: pointer to a package private data structure that can be backwards compatibly changed in releases of graphLib. */ struct graphStruct { vertexRecP V; int N, NV; edgeRecP E; int M, edgeCapacity; stackP edgeHoles; int numEdgeHoles; unsigned graphFlags, embedFlags; // Used by base Graph class and its subclasses stackP theStack; // Provides ability to subclass the base Graph, // including virtual function overloads by subclasses graphExtensionP extensions; graphExtensionP *extensionLookupTable; graphFunctionTableP functions; void *privateData; }; typedef struct graphStruct graphStruct; typedef graphStruct *graphP; #ifdef __cplusplus } #endif #endif graph-algorithms-planarity-08d7b51/planarity/c/graphLib/graph.private.h000066400000000000000000000270731522057144000262300ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #ifndef GRAPHUTILS_PRIVATE_H #define GRAPHUTILS_PRIVATE_H #include "extensionSystem/graphExtensions.h" #include "extensionSystem/graphExtensions.private.h" #include "lowLevelUtils/listcoll.h" #include "lowLevelUtils/stack.h" #ifdef __cplusplus extern "C" { #endif // DFS-RELATED and PLANARITY-RELATED ONLY // Declaration of package-private data type for managing a // collection of lists of integers typedef struct listCollectionStruct listCollectionStruct; typedef listCollectionStruct *listCollectionP; // Declaration of package-private data type for managing additional // DFS--related information associated with each non-virtual vertex typedef struct DFSUtils_VertexInfo DFSUtils_VertexInfo; typedef DFSUtils_VertexInfo *DFSUtils_VertexInfoP; // PLANARITY-RELATED ONLY // Declaration of package-private data type for managing additional // planarity-related information associated with each non-virtual vertex typedef struct Planarity_VertexInfo Planarity_VertexInfo; typedef Planarity_VertexInfo *Planarity_VertexInfoP; // Declaration of package private data type for optimizing management of // the external face of a planar embedding as it is being built typedef struct extFaceLinkRec extFaceLinkRec; typedef extFaceLinkRec *extFaceLinkRecP; // Declaration of package private data type for isolating // minimal subgraphs obstructing planarity-related embedding typedef struct isolatorContextStruct isolatorContextStruct; typedef isolatorContextStruct *isolatorContextP; /******************************************************************** A structure for package private data associated with a graph. BicompRootLists: storage for bicomp root lists (DFSUtils) or, for Planarity, pertinent child bicomp lists that develop during embedding DVI: package private pointer; if the graph is extended to DFSUtils, then N instances of DFSUtils vertex info records are allocated PVI: package private pointer; if the graph is extended to Planarity, then N instances of Planarity vertex info records are allocated IC: contains additional useful variables for Kuratowski subgraph isolation. sortedDFSChildLists: for Planarity graphs, storage for the sorted DFS child lists of each vertex extFace: For Planarity graphs, an array of (N + NV) external face short circuit records ********************************************************************/ struct graphPrivateDataStruct { // Private Data members specific to a DFSUtilsGraph subclass listCollectionP BicompRootLists; DFSUtils_VertexInfoP DVI; // Private data members specific to a PlanarityGraph subclass Planarity_VertexInfoP PVI; listCollectionP sortedDFSChildLists; extFaceLinkRecP extFace; isolatorContextP IC; }; typedef struct graphPrivateDataStruct graphPrivateDataStruct; typedef graphPrivateDataStruct *graphPrivateDataP; // These macros describe how to currently get access to additional data structures // used in DFSUtils Graphs and Planarity Graphs. Once full extensions are // developed for those, then these definitions can change to access the data // from the extensions, and the data can be removed from graphPrivateDataStruct. #define theGraphBicompRootLists(theGraph) (((graphPrivateDataP)((theGraph)->privateData))->BicompRootLists) #define theGraphDVI(theGraph) (((graphPrivateDataP)((theGraph)->privateData))->DVI) #define theGraphPVI(theGraph) (((graphPrivateDataP)((theGraph)->privateData))->PVI) #define theGraphSortedDFSChildLists(theGraph) (((graphPrivateDataP)((theGraph)->privateData))->sortedDFSChildLists) #define theGraphExtFace(theGraph) (((graphPrivateDataP)((theGraph)->privateData))->extFace) #define theGraphIC(theGraph) (((graphPrivateDataP)((theGraph)->privateData))->IC) /******************************************************************** Additional edge link accessors and manipulators ********************************************************************/ // Methods that enable getting the next or previous edge as if // the adjacency list of the containing vertex were circular, // i.e. that the first and last edge records were linked #define gp_GetNextEdgeCircular(theGraph, e) \ (gp_IsEdge(theGraph, gp_GetNextEdge(theGraph, e)) \ ? gp_GetNextEdge(theGraph, e) \ : gp_GetFirstEdge(theGraph, theGraph->E[gp_GetTwin(theGraph, e)].neighbor)) #define gp_GetPrevEdgeCircular(theGraph, e) \ (gp_IsEdge(theGraph, gp_GetPrevEdge(theGraph, e)) \ ? gp_GetPrevEdge(theGraph, e) \ : gp_GetLastEdge(theGraph, theGraph->E[gp_GetTwin(theGraph, e)].neighbor)) // Methods that make the cross-link binding between a vertex and an // edge record. The old first or last edge record should be bound to // this new first or last edge record, e, by separate calls, // e.g. see gp_AttachFirstEdge() and gp_AttachLastEdge() #define gp_BindFirstEdge(theGraph, v, e) \ { \ gp_SetPrevEdge(theGraph, e, NIL); \ gp_SetFirstEdge(theGraph, v, e); \ } #define gp_BindLastEdge(theGraph, v, e) \ { \ gp_SetNextEdge(theGraph, e, NIL); \ gp_SetLastEdge(theGraph, v, e); \ } // Attaches edge e between the current binding between v and its first edge #define gp_AttachFirstEdge(theGraph, v, e) \ { \ if (gp_IsEdge(theGraph, gp_GetFirstEdge(theGraph, v))) \ { \ gp_SetNextEdge(theGraph, e, gp_GetFirstEdge(theGraph, v)); \ gp_SetPrevEdge(theGraph, gp_GetFirstEdge(theGraph, v), e); \ } \ else \ gp_BindLastEdge(theGraph, v, e); \ gp_BindFirstEdge(theGraph, v, e); \ } // Attaches edge e between the current binding between v and its last edge #define gp_AttachLastEdge(theGraph, v, e) \ { \ if (gp_IsEdge(theGraph, gp_GetLastEdge(theGraph, v))) \ { \ gp_SetPrevEdge(theGraph, e, gp_GetLastEdge(theGraph, v)); \ gp_SetNextEdge(theGraph, gp_GetLastEdge(theGraph, v), e); \ } \ else \ gp_BindFirstEdge(theGraph, v, e); \ gp_BindLastEdge(theGraph, v, e); \ } // Moves an edge e that is in the adjacency list of v to the start of the adjacency list #define gp_MoveEdgeToFirst(theGraph, v, e) \ if (e != gp_GetFirstEdge(theGraph, v)) \ { \ /* If e is last in the adjacency list of v, then we \ detach it by adjacency list end management */ \ if (e == gp_GetLastEdge(theGraph, v)) \ { \ gp_SetNextEdge(theGraph, gp_GetPrevEdge(theGraph, e), NIL); \ gp_SetLastEdge(theGraph, v, gp_GetPrevEdge(theGraph, e)); \ } \ /* Otherwise, we detach e from the middle of the list */ \ else \ { \ gp_SetNextEdge(theGraph, gp_GetPrevEdge(theGraph, e), gp_GetNextEdge(theGraph, e)); \ gp_SetPrevEdge(theGraph, gp_GetNextEdge(theGraph, e), gp_GetPrevEdge(theGraph, e)); \ } \ \ /* Now add e as the new first edge of v. \ Note that the adjacency list is non-empty at this time */ \ gp_SetNextEdge(theGraph, e, gp_GetFirstEdge(theGraph, v)); \ gp_SetPrevEdge(theGraph, gp_GetFirstEdge(theGraph, v), e); \ gp_BindFirstEdge(theGraph, v, e); \ } // Moves an edge e that is in the adjacency list of v to the end of the adjacency list #define gp_MoveEdgeToLast(theGraph, v, e) \ if (e != gp_GetLastEdge(theGraph, v)) \ { \ /* If e is first in the adjacency list of vertex v, then we \ detach it by adjacency list beginning management */ \ if (e == gp_GetFirstEdge(theGraph, v)) \ { \ gp_SetPrevEdge(theGraph, gp_GetNextEdge(theGraph, e), NIL); \ gp_SetFirstEdge(theGraph, v, gp_GetNextEdge(theGraph, e)); \ } \ /* Otherwise, we detach e from the middle of the list */ \ else \ { \ gp_SetNextEdge(theGraph, gp_GetPrevEdge(theGraph, e), gp_GetNextEdge(theGraph, e)); \ gp_SetPrevEdge(theGraph, gp_GetNextEdge(theGraph, e), gp_GetPrevEdge(theGraph, e)); \ } \ \ /* Now we add e as the new last edge of v. \ Note that the adjacency list is non-empty at this time */ \ gp_SetPrevEdge(theGraph, e, gp_GetLastEdge(theGraph, v)); \ gp_SetNextEdge(theGraph, gp_GetLastEdge(theGraph, v), e); \ gp_BindLastEdge(theGraph, v, e); \ } #ifdef __cplusplus } #endif #endif /* GRAPHUTILS_PRIVATE_H */ graph-algorithms-planarity-08d7b51/planarity/c/graphLib/graphDFSUtils.c000066400000000000000000000536441522057144000261330ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #define GRAPHDFSUTILS_C #include "graphDFSUtils.h" #include "graphDFSUtils.private.h" // For LOGGING-related declarations #include "lowLevelUtils/apiutils.private.h" // Allows the default _SortVertices() to swap planarity vertex info, if present #include "planarityRelated/graphPlanarity.private.h" // Private methods, except exported within library int _SortVertices(graphP theGraph); // Imported methods extern void _ClearVertexVisitedFlags(graphP theGraph, int); /******************************************************************** gp_ExtendWith_DFSUtils() Makes any necessary preparations for supporting DFS utility methods that create a DFS tree, sort vertices, and compute least ancestor. and lowpoint values. Those four utility methods automatically call this method to extend the graph, though this method can also be called beforehand. This method should be called after gp_EnsureVertexCapacity() or gp_Read() because the number of vertices must be known. On success, sets GRAPHFLAGS_EXTENDEDWITH_DFSUTILS. Returns OK on success, NOTOK on failure. ********************************************************************/ int gp_ExtendWith_DFSUtils(graphP theGraph) { if (theGraph == NULL || gp_GetN(theGraph) <= 0) return NOTOK; // if the Graph has already been extended with DFS Utils, // then just return successfully if (gp_GetGraphFlags(theGraph) & GRAPHFLAGS_EXTENDEDWITH_DFSUTILS) return OK; // Allocate supporting data structures as needed // Perform "on success" operations theGraph->graphFlags |= GRAPHFLAGS_EXTENDEDWITH_DFSUTILS; return OK; } /******************************************************************** gp_Detach_DFSUtils() This function is intended to disinherit the DFS Utils feature by removing the extension from the graph, which also frees any DFS-specific data structures. Clears GRAPHFLAGS_EXTENDEDWITH_DFSUTILS after detaching support for the DFS utility methods. Returns OK for success, NOTOK for failure ********************************************************************/ int gp_Detach_DFSUtils(graphP theGraph) { // Free any data structures allocated by the ExtendWith function // Indicate successful detachment of DFSUtils theGraph->graphFlags &= ~GRAPHFLAGS_EXTENDEDWITH_DFSUTILS; return OK; } /******************************************************************** gp_DepthFirstSearch() This depth-first search (DFS) assigns a Depth First Index (DFI) to each vertex and records the DFS parent of each vertex in each DFS tree that forms during the depth-first search. Also, the type of each edge record of each edge is set to indicate whether the edge record's neighbor value points to a DFS child or parent (a DFS tree edge) or a farther DFS ancestor or descendant (the backward and forward edge records of a "back" edge/"cycle" edge/"co-tree" edge). NOTE: This is a utility function provided for general use. The core planarity algorithm uses its own DFS so it can build related data structures at the same time. ********************************************************************/ int gp_DepthFirstSearch(graphP theGraph) { stackP theStack; int DFI, v, uparent, u, e; if (theGraph == NULL) return NOTOK; if (gp_GetGraphFlags(theGraph) & GRAPHFLAGS_DFSNUMBERED) return OK; if (gp_ExtendWith_DFSUtils(theGraph) != OK) return NOTOK; _gp_LogLine("\ngraphDFSUtils.c/gp_DepthFirstSearch() start"); theStack = theGraph->theStack; /* There are 2M edge records and for each we can push 2 integers, plus one extra (NIL, NIL) at the beginning to represent arriving at a DFS tree root. So, a stack of 2 * 2 * (1+M) integers suffices. This stack is already in theGraph structure, so we make sure it has the capacity and, if so, that it's empty. */ if (sp_GetCapacity(theStack) < 2 * 2 * gp_GetM(theGraph) + 2) return NOTOK; sp_ClearStack(theStack); /* Clear the visited flags because they are used to detect what has been visited as the DFS traverses the graph. */ _ClearVertexVisitedFlags(theGraph, FALSE); /* This outer loop causes the connected subgraphs of a disconnected graph to be numbered */ for (DFI = v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { if (gp_IsNotDFSTreeRoot(theGraph, v)) continue; sp_Push2(theStack, NIL, NIL); while (sp_NonEmpty(theStack)) { sp_Pop2(theStack, uparent, e); u = gp_IsNotVertex(theGraph, uparent) ? v : gp_GetNeighbor(theGraph, e); if (!gp_GetVisited(theGraph, u)) { _gp_LogLine(_gp_MakeLogStr3("V=%d, DFI=%d, Parent=%d", u, DFI, uparent)); gp_SetVisited(theGraph, u); gp_SetIndex(theGraph, u, DFI++); gp_SetVertexParent(theGraph, u, uparent); if (gp_IsEdge(theGraph, e)) { gp_SetEdgeType(theGraph, e, EDGE_TYPE_CHILD); gp_SetEdgeType(theGraph, gp_GetTwin(theGraph, e), EDGE_TYPE_PARENT); } /* Push edges to all unvisited neighbors. These will be either tree edges to children or forward edge records of back edges */ e = gp_GetFirstEdge(theGraph, u); while (gp_IsEdge(theGraph, e)) { if (!gp_GetVisited(theGraph, gp_GetNeighbor(theGraph, e))) sp_Push2(theStack, u, e); e = gp_GetNextEdge(theGraph, e); } } else { // If the edge leads to a visited vertex, then it is // the forward component of a back edge. gp_SetEdgeType(theGraph, e, EDGE_TYPE_FORWARD); gp_SetEdgeType(theGraph, gp_GetTwin(theGraph, e), EDGE_TYPE_BACK); } } } _gp_LogLine("graphDFSUtils.c/gp_DepthFirstSearch() end\n"); theGraph->graphFlags |= GRAPHFLAGS_DFSNUMBERED; return OK; } /******************************************************************** gp_SortVertices() Once depth first numbering has been applied to the graph, the index member of each vertex contains the DFI. This routine can reorder the vertices in linear time so that they appear in ascending order by DFI. Note that the index field is then used to store the original number of the vertex. Therefore, a second call to this method will put the vertices back to the original order and put the DFIs back into the index fields of the vertices. NOTE: This function is used by the core planarity algorithm, once its custom DFS has assigned DFIs to the vertices. Once gp_Embed() has finished creating an embedding or obstructing subgraph, this function can be called to restore the original vertex numbering, if needed. ********************************************************************/ int gp_SortVertices(graphP theGraph) { if (theGraph == NULL) return NOTOK; if (gp_ExtendWith_DFSUtils(theGraph) != OK) return NOTOK; return theGraph->functions->fpSortVertices(theGraph); } // Give macro names to swap operations used when sorting vertices // These are macros and hence not overloadable. If an extension // needs to reorder parallel vertex data, then this must be done // by a post-processing step in an overload of gp_SortVertices(). // The index values of the first N vertices are changed to hold // the prior locations of vertices when they are rearranged to // or from DFI order. #define _gp_SwapVertexRec(dstGraph, vdst, srcGraph, vsrc) \ { \ vertexRec tempV = dstGraph->V[vdst]; \ dstGraph->V[vdst] = srcGraph->V[vsrc]; \ srcGraph->V[vsrc] = tempV; \ } #define _gp_SwapDFSUtilsVertexInfo(dstGraph, dstPos, srcGraph, srcPos) \ { \ DFSUtils_VertexInfo tempDVI = theGraphDVI(dstGraph)[dstPos]; \ theGraphDVI(dstGraph)[dstPos] = theGraphDVI(srcGraph)[srcPos]; \ theGraphDVI(srcGraph)[srcPos] = tempDVI; \ } #define _gp_SwapPlanarityVertexInfo(dstGraph, dstPos, srcGraph, srcPos) \ if (theGraphPVI(dstGraph) != NULL && theGraphPVI(srcGraph) != NULL) \ { \ Planarity_VertexInfo tempPVI = theGraphPVI(dstGraph)[dstPos]; \ theGraphPVI(dstGraph)[dstPos] = theGraphPVI(srcGraph)[srcPos]; \ theGraphPVI(srcGraph)[srcPos] = tempPVI; \ } // This is the default method for sorting vertices into and back // out of DFI order. int _SortVertices(graphP theGraph) { int v, srcPos, dstPos; if (theGraph == NULL) return NOTOK; if (!(gp_GetGraphFlags(theGraph) & GRAPHFLAGS_DFSNUMBERED)) if (gp_DepthFirstSearch(theGraph) != OK) return NOTOK; _gp_LogLine("\ngraphDFSUtils.c/_SortVertices() start"); /* Change labels of edges from v to DFI(v)-- or vice versa Also, if any links go back to locations 0 to n-1, then they need to be changed because we are reordering the vertices */ if (theGraph->numEdgeHoles == 0) { // Slightly optimized loop body, for when edge deletion has not been used // (Optimization level O1 or higher hoists the upperBoundEdges calculation, // so this is mainly just a little less work in the loop body). int upperBoundEdges = gp_LowerBoundEdges(theGraph) + (gp_GetM(theGraph) << 1); for (int e = gp_LowerBoundEdges(theGraph); e < upperBoundEdges; ++e) gp_SetNeighbor(theGraph, e, gp_GetIndex(theGraph, gp_GetNeighbor(theGraph, e))); } else { for (int e = gp_LowerBoundEdges(theGraph); e < gp_UpperBoundEdges(theGraph); e += 2) { if (gp_EdgeInUse(theGraph, e)) { gp_SetNeighbor(theGraph, e, gp_GetIndex(theGraph, gp_GetNeighbor(theGraph, e))); gp_SetNeighbor(theGraph, e + 1, gp_GetIndex(theGraph, gp_GetNeighbor(theGraph, e + 1))); } } } /* Convert DFSParent from v to DFI(v) or vice versa */ for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) if (gp_IsNotDFSTreeRoot(theGraph, v)) gp_SetVertexParent(theGraph, v, gp_GetIndex(theGraph, gp_GetVertexParent(theGraph, v))); /* Sort by 'v using constant time random access. Move each vertex to its destination 'v', and store its source location in 'v'. */ /* First we clear the visitation flags. We need these to help mark visited vertices because we change the 'v' field to be the source location, so we cannot use index==v as a test for whether the correct vertex is in location 'index'. */ _ClearVertexVisitedFlags(theGraph, FALSE); /* We visit each vertex location, skipping those marked as visited since we've already moved the correct vertex into that location. The inner loop swaps the vertex at location v into the correct position, given by the index of the vertex at location v. Then it marks that location as visited, then sets its index to be the location from whence we obtained the vertex record. */ for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { srcPos = v; while (!gp_GetVisited(theGraph, v)) { dstPos = gp_GetIndex(theGraph, v); _gp_SwapVertexRec(theGraph, dstPos, theGraph, v); _gp_SwapDFSUtilsVertexInfo(theGraph, dstPos, theGraph, v); _gp_SwapPlanarityVertexInfo(theGraph, dstPos, theGraph, v); gp_SetVisited(theGraph, dstPos); gp_SetIndex(theGraph, dstPos, srcPos); srcPos = dstPos; } } /* Invert the bit that records the sort order of the graph */ theGraph->graphFlags ^= GRAPHFLAGS_SORTEDBYDFI; _gp_LogLine("graphDFSUtils.c/_SortVertices() end\n"); return OK; } /******************************************************************** gp_ComputeLowpoints() leastAncestor(v): min(v, ancestor neighbors of v, excluding parent) Lowpoint(v): min(leastAncestor(v), Lowpoint of DFS children of v) The Lowpoint of each vertex is computed via a post-order traversal of the DFS tree. Lowpoint calculations require leastAncestor calculations, so both are computed by this method. We push the root of the DFS tree, then we loop while the stack is not empty. We pop a vertex; if it is not marked, then we are on our way down the DFS tree, so we mark it and push it back on, followed by pushing its DFS children. The next time we pop the node, all of its children will have been popped, marked+children pushed, and popped again. On the second pop of the vertex, we can therefore compute the lowpoint values based on the childrens' lowpoints and the least ancestor from among the edges in the vertex's adjacency list. If they have not already been performed, gp_DepthFirstSearch() and gp_SortVertices() are invoked on the graph, and it is left in the sorted state on completion of this method. NOTE: This is a utility function provided for general use of the graph library. The core planarity algorithm computes leastAncestor during its initial DFS, and it computes the lowpoint of each a vertex as it embeds the tree edges to its children. ********************************************************************/ int gp_ComputeLowpoints(graphP theGraph) { stackP theStack = NULL; int v, u, uneighbor, e, L, leastAncestor; if (theGraph == NULL) return NOTOK; if (gp_ExtendWith_DFSUtils(theGraph) != OK) return NOTOK; theStack = theGraph->theStack; if (!(gp_GetGraphFlags(theGraph) & GRAPHFLAGS_DFSNUMBERED)) if (gp_DepthFirstSearch(theGraph) != OK) return NOTOK; if (!(gp_GetGraphFlags(theGraph) & GRAPHFLAGS_SORTEDBYDFI)) if (gp_SortVertices(theGraph) != OK) return NOTOK; _gp_LogLine("\ngraphDFSUtils.c/gp_ComputeLowpoints() start"); // A stack of size N suffices because at maximum every vertex is pushed only once // However, since a larger stack is needed for the main DFS, this is really // just 'documentation' of the requirement if (sp_GetCapacity(theStack) < gp_GetN(theGraph)) return NOTOK; sp_ClearStack(theStack); _ClearVertexVisitedFlags(theGraph, FALSE); // This outer loop causes the connected subgraphs of a disconnected graph to be processed for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph);) { if (gp_GetVisited(theGraph, v)) { ++v; continue; } sp_Push(theStack, v); while (sp_NonEmpty(theStack)) { sp_Pop(theStack, u); // If not visited, then we're on the pre-order visitation, so push u and its DFS children if (!gp_GetVisited(theGraph, u)) { // Mark u as visited, then push it back on the stack gp_SetVisited(theGraph, u); ++v; sp_Push(theStack, u); // Push the DFS children of u e = gp_GetFirstEdge(theGraph, u); while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) { sp_Push(theStack, gp_GetNeighbor(theGraph, e)); } e = gp_GetNextEdge(theGraph, e); } } // If u has been visited before, then this is the post-order visitation else { // Start with high values because we are doing a min function leastAncestor = L = u; // Compute leastAncestor and L, the least lowpoint from the DFS children e = gp_GetFirstEdge(theGraph, u); while (gp_IsEdge(theGraph, e)) { uneighbor = gp_GetNeighbor(theGraph, e); if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) { if (L > gp_GetVertexLowpoint(theGraph, uneighbor)) L = gp_GetVertexLowpoint(theGraph, uneighbor); } else if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_BACK) { if (leastAncestor > uneighbor) leastAncestor = uneighbor; } e = gp_GetNextEdge(theGraph, e); } /* Assign leastAncestor and Lowpoint to the vertex */ gp_SetVertexLeastAncestor(theGraph, u, leastAncestor); gp_SetVertexLowpoint(theGraph, u, leastAncestor < L ? leastAncestor : L); } } } _gp_LogLine("graphDFSUtils.c/gp_ComputeLowpoints() end\n"); return OK; } /******************************************************************** gp_ComputeLeastAncestors() By simple pre-order visitation, compute the least ancestor of each vertex that is directly adjacent to the vertex by a back edge. If they have not already been performed, gp_DepthFirstSearch() and gp_SortVertices() are invoked on the graph, and it is left in the sorted state on completion of this method. NOTE: This method is not called by gp_ComputeLowpoints(), which computes both values at the same time. ********************************************************************/ int gp_ComputeLeastAncestors(graphP theGraph) { stackP theStack = NULL; int v, u, uneighbor, e, leastAncestor; if (theGraph == NULL) return NOTOK; if (gp_ExtendWith_DFSUtils(theGraph) != OK) return NOTOK; theStack = theGraph->theStack; if (!(gp_GetGraphFlags(theGraph) & GRAPHFLAGS_DFSNUMBERED)) if (gp_DepthFirstSearch(theGraph) != OK) return NOTOK; if (!(gp_GetGraphFlags(theGraph) & GRAPHFLAGS_SORTEDBYDFI)) if (gp_SortVertices(theGraph) != OK) return NOTOK; _gp_LogLine("\ngraphDFSUtils.c/gp_ComputeLeastAncestors() start"); // A stack of size N suffices because at maximum every vertex is pushed only once if (sp_GetCapacity(theStack) < gp_GetN(theGraph)) return NOTOK; sp_ClearStack(theStack); // This outer loop causes the connected subgraphs of a disconnected graph to be processed for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph);) { if (gp_GetVisited(theGraph, v)) { ++v; continue; } sp_Push(theStack, v); while (sp_NonEmpty(theStack)) { sp_Pop(theStack, u); if (!gp_GetVisited(theGraph, u)) { gp_SetVisited(theGraph, u); ++v; leastAncestor = u; e = gp_GetFirstEdge(theGraph, u); while (gp_IsEdge(theGraph, e)) { uneighbor = gp_GetNeighbor(theGraph, e); if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) { sp_Push(theStack, uneighbor); } else if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_BACK) { if (leastAncestor > uneighbor) leastAncestor = uneighbor; } e = gp_GetNextEdge(theGraph, e); } gp_SetVertexLeastAncestor(theGraph, u, leastAncestor); } } } _gp_LogLine("graphDFSUtils.c/gp_ComputeLeastAncestors() end\n"); return OK; } /******************************************************************** gp_GetParent() Once the DFS tree has been created in theGraph, this method returns the DFS parent of the given vertex v. This includes returning NIL for a DFS tree root, which has no DFS parent. Also returns NIL on error, such as invalid parameters or DFS tree not created yet. ********************************************************************/ int gp_GetParent(graphP theGraph, int v) { if (theGraph == NULL || v < gp_LowerBoundVertices(theGraph) || v >= gp_UpperBoundVertices(theGraph)) { #ifdef DEBUG NOTOK; ; #endif return NIL; } return gp_GetVertexParent(theGraph, v); } /******************************************************************** gp_GetLeastAncestor() Once the least ancestors have been computed in the graph, which includes when they are implicitly calculated as part of computing lowpoints, this method returns the least ancestor value for the given vertex v. Returns NIL on error, such as invalid parameters or least ancestor values not computed yet. ********************************************************************/ int gp_GetLeastAncestor(graphP theGraph, int v) { if (theGraph == NULL || v < gp_LowerBoundVertices(theGraph) || v >= gp_UpperBoundVertices(theGraph)) { #ifdef DEBUG NOTOK; ; #endif return NIL; } return gp_GetVertexLeastAncestor(theGraph, v); } /******************************************************************** gp_GetLowpoint() Once the lowpoints have been computed in the graph, this method returns the lowpoint value for the given vertex v. Returns NIL on error, such as invalid parameters or lowpoints not computed yet. ********************************************************************/ int gp_GetLowpoint(graphP theGraph, int v) { if (theGraph == NULL || v < gp_LowerBoundVertices(theGraph) || v >= gp_UpperBoundVertices(theGraph)) { #ifdef DEBUG NOTOK; ; #endif return NIL; } return gp_GetVertexLowpoint(theGraph, v); } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/graphDFSUtils.h000066400000000000000000000106541522057144000261320ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #ifndef GRAPHDFSUTILS_H #define GRAPHDFSUTILS_H #include "graph.h" #ifdef __cplusplus extern "C" { #endif // Create a DFSUtils Graph, i.e., subclass a Graph by extending it with the // ability to perform the depth-first search (DFS) utility methods below. #define DFSUTILS_NAME "DFSUtils" int gp_ExtendWith_DFSUtils(graphP theGraph); int gp_Detach_DFSUtils(graphP theGraph); /* Graph Flags: see gp_GetGraphFlags() GRAPHFLAGS_EXTENDEDWITH_DFSUTILS is set by calling gp_ExtendWith_DFSUtils() This is automatically called by the utility methods below that create a DFS tree, sort vertices, and compute least ancestors and lowpoints GRAPHFLAGS_DFSNUMBERED is set if DFS numbering has been performed on the graph, such as by calling the gp_DepthFirstSearch() utility method below GRAPHFLAGS_SORTEDBYDFI records whether the graph is in original vertex order or sorted by depth first index. Successive calls to the gp_SortVertices() utility method below toggle this bit. */ #define GRAPHFLAGS_EXTENDEDWITH_DFSUTILS 256 #define GRAPHFLAGS_DFSNUMBERED 512 #define GRAPHFLAGS_SORTEDBYDFI 1024 // DFS-related utility methods that create a DFS tree, sort vertices and // compute least ancestor and lowpoint values int gp_DepthFirstSearch(graphP theGraph); int gp_SortVertices(graphP theGraph); int gp_ComputeLowpoints(graphP theGraph); int gp_ComputeLeastAncestors(graphP theGraph); // Additional DFS-related uitility methods (functions and macros) that assume // one or more of the above methods have been called to create a DFS tree, // sort vertices and/or compute least ancestor and lowpoint values int gp_GetParent(graphP theGraph, int v); int gp_GetLeastAncestor(graphP theGraph, int v); int gp_GetLowpoint(graphP theGraph, int v); // A DFS tree root is one that has no DFS parent. There is one DFS tree root // per connected component of a graph (connected, not biconnected; component, not bicomp) #define gp_IsDFSTreeRoot(theGraph, v) gp_IsNotVertex(theGraph, gp_GetVertexParent(theGraph, v)) #define gp_IsNotDFSTreeRoot(theGraph, v) gp_IsVertex(theGraph, gp_GetVertexParent(theGraph, v)) // Mapping between bicomp roots and virtual vertex locations used to store them. // A cut vertex v separates one or more of its DFS children, say c1 and c2, from // the DFS parent and ancesstors of v. Because a DFS tree contains only tree edges // and back edges, there are no cross edges connecting vertices in the DFS subtree // rooted by c1, T(c1), with vertices in the DFS subtree rooted by c2, T(c2). // We say that v is a cut vertex because the only paths that go from vertices in // T(c1) to vertices in T(c2) are paths that contain v. // // Therefore, bicomp root copies of v, say R1 and R2, can be created at locations // c1 and c2 in virtual vertex space, in other words at locations N+c1 and N+c2. // The bicomps rooted by R1 and R2 are called child bicomps of v, and they contain, // respectively, c1 and c2 as well as possibly more vertices from, respectively, // T(c1) and T(c2), depending on what back edges may exist in the graph between // pairs of vertices in, respectively, T(c1) and T(c2). #define gp_GetBicompRootFromDFSChild(theGraph, c) ((c) + gp_GetN(theGraph)) #define gp_GetDFSChildFromBicompRoot(theGraph, R) ((R) - gp_GetN(theGraph)) #define gp_GetVertexFromBicompRoot(theGraph, R) gp_GetVertexParent(theGraph, gp_GetDFSChildFromBicompRoot(theGraph, R)) #define gp_IsBicompRoot(theGraph, v) ((v) >= gp_LowerBoundVirtualVertices(theGraph)) // If a vertex v is a cut vertex that separates one of its DFS children, say c, // from the DFS ancestors and other children of v, then when the graph has been // separated into bicomps, there will be a root copy of v in virtual vertex space // at location c+N that will have at least one edge connecting it to c. // These macros detect whether or not that is the case for a given DFS child. #define gp_IsSeparatedDFSChild(theGraph, theChild) (gp_VirtualVertexInUse(theGraph, gp_GetBicompRootFromDFSChild(theGraph, theChild))) #define gp_IsNotSeparatedDFSChild(theGraph, theChild) (gp_VirtualVertexNotInUse(theGraph, gp_GetBicompRootFromDFSChild(theGraph, theChild))) #ifdef __cplusplus } #endif #endif /* GRAPHDFSUTILS_H */ graph-algorithms-planarity-08d7b51/planarity/c/graphLib/graphDFSUtils.private.h000066400000000000000000000035571522057144000276070ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #ifndef GRAPHDFSUTILS_PRIVATE_H #define GRAPHDFSUTILS_PRIVATE_H #include "graph.private.h" #ifdef __cplusplus extern "C" { #endif /******************************************************************** Vertex Info Structure Definition. This structure equips the non-virtual vertices with additional information needed for DFS-related and planarity-related algorithms. parent: The DFI of the DFS tree parent of this vertex leastAncestor: min(DFI of neighbors connected by backedge) lowpoint: min(leastAncestor, min(lowpoint of DFS Children)) */ struct DFSUtils_VertexInfo { int parent, leastAncestor, lowpoint; }; typedef struct DFSUtils_VertexInfo DFSUtils_VertexInfo; typedef DFSUtils_VertexInfo *DFSUtils_VertexInfoP; struct vertexInfoRec { int parent, leastAncestor, lowpoint; int visitedInfo; int pertinentEdge, pertinentRoots, futurePertinentChild, sortedDFSChildList, fwdEdgeList; }; typedef struct vertexInfoRec vertexInfoRec; typedef vertexInfoRec *vertexInfoP; #define gp_GetVertexParent(theGraph, v) (theGraphDVI(theGraph)[v].parent) #define gp_SetVertexParent(theGraph, v, theParent) (theGraphDVI(theGraph)[v].parent = theParent) #define gp_GetVertexLeastAncestor(theGraph, v) (theGraphDVI(theGraph)[v].leastAncestor) #define gp_SetVertexLeastAncestor(theGraph, v, theLeastAncestor) (theGraphDVI(theGraph)[v].leastAncestor = theLeastAncestor) #define gp_GetVertexLowpoint(theGraph, v) (theGraphDVI(theGraph)[v].lowpoint) #define gp_SetVertexLowpoint(theGraph, v, theLowpoint) (theGraphDVI(theGraph)[v].lowpoint = theLowpoint) #ifdef __cplusplus } #endif #endif /* GRAPHPDFSUTILS_PRIVATE_H */ graph-algorithms-planarity-08d7b51/planarity/c/graphLib/graphLib.c000066400000000000000000000024501522057144000251710ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "graphLib.h" #include /******************************************************************** gp_GetProjectVersionFull() Return full major.minor.maint.tweak version string for the graph planarity project ********************************************************************/ const char *gp_GetProjectVersionFull(void) { static char projectVersionStr[MAXLINE + 1]; sprintf(projectVersionStr, "%d.%d.%d.%d", GP_PROJECTVERSION_MAJOR, GP_PROJECTVERSION_MINOR, GP_PROJECTVERSION_MAINT, GP_PROJECTVERSION_TWEAK); return projectVersionStr; } /******************************************************************** gp_GetLibPlanarityVersionFull() Returns full current:revision:age version string for the graph planarity shared library ********************************************************************/ const char *gp_GetLibPlanarityVersionFull(void) { static char libPlanarityVersionStr[MAXLINE + 1]; sprintf(libPlanarityVersionStr, "%d:%d:%d", GP_LIBPLANARITYVERSION_CURRENT, GP_LIBPLANARITYVERSION_REVISION, GP_LIBPLANARITYVERSION_AGE); return libPlanarityVersionStr; } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/graphLib.h000066400000000000000000000045151522057144000252020ustar00rootroot00000000000000#ifndef GRAPHLIB_H #define GRAPHLIB_H /* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #ifdef __cplusplus extern "C" { #endif #include #include #include // Basic public API declarations, such as for OK, NOTOK, and NIL #include "lowLevelUtils/appconst.h" // And for get/set quiet mode, gp_ErrorMessage() and gp_Message() #include "lowLevelUtils/apiutils.h" // Graph structure and public API methods #include "graph.h" // Graph I/O public API methods and definitions #include "io/graphIO.h" #include "io/g6-read-iterator.h" #include "io/g6-write-iterator.h" // Depth-first search public API methods and definitions #include "graphDFSUtils.h" // Planarity-specific public API methods and definitions #include "planarityRelated/graphPlanarity.h" // Public APIs for extensions to the edge addition planarity algorithm #include "planarityRelated/graphOuterplanarity.h" #include "planarityRelated/graphDrawPlanar.h" #include "homeomorphSearch/graphK23Search.h" #include "homeomorphSearch/graphK33Search.h" #include "homeomorphSearch/graphK4Search.h" // This is the main location for the project and shared library version numbering. // Changes here must be mirrored in configure.ac // // The overall project version numbering format is major.minor.maintenance.tweak // Major is for an overhaul (e.g. many features, data structure change, change of backward compatibility) // Minor is for feature addition (e.g. a new algorithm implementation added, new interface) // Maintenance is for functional revision (e.g. bug fix to existing algorithm implementation) // Tweak is for a non-functional revision (e.g. change of build scripts or testing code, user-facing string changes) #define GP_PROJECTVERSION_MAJOR 5 #define GP_PROJECTVERSION_MINOR 0 #define GP_PROJECTVERSION_MAINT 0 #define GP_PROJECTVERSION_TWEAK 0 const char *gp_GetProjectVersionFull(void); // Any change to the project version numbers should also affect the // shared library version numbers below. // // See configure.ac for how to update these version numbers #define GP_LIBPLANARITYVERSION_CURRENT 4 #define GP_LIBPLANARITYVERSION_REVISION 0 #define GP_LIBPLANARITYVERSION_AGE 0 const char *gp_GetLibPlanarityVersionFull(void); #ifdef __cplusplus } #endif #endif graph-algorithms-planarity-08d7b51/planarity/c/graphLib/homeomorphSearch/000077500000000000000000000000001522057144000265775ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/planarity/c/graphLib/homeomorphSearch/graphK23Search.c000066400000000000000000000226501522057144000314570ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "graphK23Search.h" #include "graphK23Search.private.h" /* Imported functions */ extern void _ClearAllVisitedFlagsInGraph(graphP); extern int _GetNeighborOnExtFace(graphP theGraph, int curVertex, int *pPrevLink); extern int _OrientVerticesInBicomp(graphP theGraph, int BicompRoot, int PreserveSigns); extern int _JoinBicomps(graphP theGraph); extern int _MarkHighestXYPath(graphP theGraph); extern int _FindUnembeddedEdgeToAncestor(graphP theGraph, int cutVertex, int *pAncestor, int *pDescendant); extern int _FindUnembeddedEdgeToCurVertex(graphP theGraph, int cutVertex, int *pDescendant); extern int _FindUnembeddedEdgeToSubtree(graphP theGraph, int ancestor, int SubtreeRoot, int *pDescendant); extern int _MarkPathAlongBicompExtFace(graphP theGraph, int startVert, int endVert); extern int _AddAndMarkEdge(graphP theGraph, int ancestor, int descendant); extern int _DeleteUnmarkedVerticesAndEdges(graphP theGraph); extern int _ChooseTypeOfNonOuterplanarityMinor(graphP theGraph, int v, int R); extern int _IsolateOuterplanarityObstructionA(graphP theGraph); extern int _IsolateOuterplanarityObstructionB(graphP theGraph); /* Private function declarations for K_{2,3} searching */ int _SearchForK23InBicomp(graphP theGraph, int v, int R); int _IsolateOuterplanarityObstructionE1orE2(graphP theGraph); int _IsolateOuterplanarityObstructionE3orE4(graphP theGraph); /**************************************************************************** _SearchForK23InBicomp() ****************************************************************************/ int _SearchForK23InBicomp(graphP theGraph, int v, int R) { isolatorContextP IC = theGraphIC(theGraph); int X, Y, XPrevLink, YPrevLink; /* Begin by determining whether minor A, B or E is detected */ if (_ChooseTypeOfNonOuterplanarityMinor(theGraph, v, R) != OK) return NOTOK; /* Minors A and B result in the desired K_{2,3} homeomorph, so we isolate it and return NONEMBEDDABLE. */ if (theGraphIC(theGraph)->minorType & (MINORTYPE_A | MINORTYPE_B)) { _ClearAllVisitedFlagsInGraph(theGraph); if (theGraphIC(theGraph)->minorType & MINORTYPE_A) { if (_FindUnembeddedEdgeToCurVertex(theGraph, IC->w, &IC->dw) != TRUE) return NOTOK; if (_IsolateOuterplanarityObstructionA(theGraph) != OK) return NOTOK; } else if (theGraphIC(theGraph)->minorType & MINORTYPE_B) { int SubtreeRoot = gp_GetVertexLastPertinentRootChild(theGraph, IC->w); if (_FindUnembeddedEdgeToSubtree(theGraph, IC->v, SubtreeRoot, &IC->dw) != TRUE) return NOTOK; if (_IsolateOuterplanarityObstructionB(theGraph) != OK) return NOTOK; } if (_DeleteUnmarkedVerticesAndEdges(theGraph) != OK) return NOTOK; return NONEMBEDDABLE; } /* For minor E (a K_4) , we run the additional tests to see if a K_{2,3} is entangled with the K_4. If not, then we return OK to indicate that the outerplanarity embedder should proceed as if the K_4 had not been found. */ /* If any vertices other than R, X, Y and W exist along the external face, then we can obtain a K_{2,3} by minor E1 or E2 */ X = IC->x; Y = IC->y; XPrevLink = 1; YPrevLink = 0; if (IC->w != _GetNeighborOnExtFace(theGraph, X, &XPrevLink) || IC->w != _GetNeighborOnExtFace(theGraph, Y, &YPrevLink)) { _ClearAllVisitedFlagsInGraph(theGraph); if (_IsolateOuterplanarityObstructionE1orE2(theGraph) != OK) return NOTOK; if (_DeleteUnmarkedVerticesAndEdges(theGraph) != OK) return NOTOK; return NONEMBEDDABLE; } /* If X, Y or W make either a direct back edge connection or a connection through a separated child bicomp to an ancestor of the current vertex v, then we can obtain a K_{2,3} by minor E3 or E4. Note that this question is query on X, Y and W is equivalent to the planarity version of external activity. */ gp_UpdateVertexFuturePertinentChild(theGraph, X, v); gp_UpdateVertexFuturePertinentChild(theGraph, Y, v); gp_UpdateVertexFuturePertinentChild(theGraph, IC->w, v); if (FUTUREPERTINENT(theGraph, X, v) || FUTUREPERTINENT(theGraph, Y, v) || FUTUREPERTINENT(theGraph, IC->w, v)) { _ClearAllVisitedFlagsInGraph(theGraph); if (_IsolateOuterplanarityObstructionE3orE4(theGraph) != OK) return NOTOK; if (_DeleteUnmarkedVerticesAndEdges(theGraph) != OK) return NOTOK; return NONEMBEDDABLE; } /* The extra cases for finding a K_{2,3} failed, so the bicomp rooted by R is a separable subgraph of the input that is isomorphic to K_4. So, we restore the original vertex orientation of the bicomp (because it's polite, not because we really have to). Then, we return OK to tell the outerplanarity embedder that it can ignore this K_4 and keep processing. */ if (_OrientVerticesInBicomp(theGraph, R, 1) != OK) return NOTOK; return OK; } /**************************************************************************** _IsolateOuterplanarityObstructionE1orE2() ****************************************************************************/ int _IsolateOuterplanarityObstructionE1orE2(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); int XPrevLink = 1; if (_MarkHighestXYPath(theGraph) != OK || theGraphIC(theGraph)->py == NIL) return NOTOK; /* Isolate E1 */ if (theGraphIC(theGraph)->px != theGraphIC(theGraph)->x) { if (_MarkPathAlongBicompExtFace(theGraph, IC->r, IC->w) != OK || _MarkPathAlongBicompExtFace(theGraph, IC->py, IC->r) != OK) return NOTOK; } else if (theGraphIC(theGraph)->py != theGraphIC(theGraph)->y) { if (_MarkPathAlongBicompExtFace(theGraph, IC->r, IC->x) != OK || _MarkPathAlongBicompExtFace(theGraph, IC->w, IC->r) != OK) return NOTOK; } /* Isolate E2 */ else if (IC->w != _GetNeighborOnExtFace(theGraph, IC->x, &XPrevLink)) { if (_MarkPathAlongBicompExtFace(theGraph, IC->r, IC->y) != OK) return NOTOK; } else { if (_MarkPathAlongBicompExtFace(theGraph, IC->x, IC->r) != OK) return NOTOK; } /* Final bits are in common */ if (_FindUnembeddedEdgeToCurVertex(theGraph, IC->w, &IC->dw) != TRUE || theGraph->functions->fpMarkDFSPath(theGraph, IC->w, IC->dw) != OK || _JoinBicomps(theGraph) != OK || _AddAndMarkEdge(theGraph, IC->v, IC->dw) != OK) return NOTOK; return OK; } /**************************************************************************** _IsolateOuterplanarityObstructionE3orE4() ****************************************************************************/ int _IsolateOuterplanarityObstructionE3orE4(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); int u, d, XorY; // Minor E3 gp_UpdateVertexFuturePertinentChild(theGraph, theGraphIC(theGraph)->x, theGraphIC(theGraph)->v); gp_UpdateVertexFuturePertinentChild(theGraph, theGraphIC(theGraph)->y, theGraphIC(theGraph)->v); if (FUTUREPERTINENT(theGraph, theGraphIC(theGraph)->x, theGraphIC(theGraph)->v) || FUTUREPERTINENT(theGraph, theGraphIC(theGraph)->y, theGraphIC(theGraph)->v)) { if (_MarkHighestXYPath(theGraph) != OK || theGraphIC(theGraph)->py == NIL) return NOTOK; gp_UpdateVertexFuturePertinentChild(theGraph, theGraphIC(theGraph)->x, theGraphIC(theGraph)->v); if (FUTUREPERTINENT(theGraph, theGraphIC(theGraph)->x, theGraphIC(theGraph)->v)) XorY = theGraphIC(theGraph)->x; else XorY = theGraphIC(theGraph)->y; /* The cases of X future pertinent and Y future pertinent are the same except for the bicomp external face marking (because parameter order is important) */ if (XorY == theGraphIC(theGraph)->x) { if (_MarkPathAlongBicompExtFace(theGraph, IC->x, IC->w) != OK || _MarkPathAlongBicompExtFace(theGraph, IC->y, IC->r) != OK) return NOTOK; } else { if (_MarkPathAlongBicompExtFace(theGraph, IC->r, IC->x) != OK || _MarkPathAlongBicompExtFace(theGraph, IC->w, IC->y) != OK) return NOTOK; } if (_FindUnembeddedEdgeToCurVertex(theGraph, IC->w, &IC->dw) != TRUE) return NOTOK; if (_FindUnembeddedEdgeToAncestor(theGraph, XorY, &u, &d) != TRUE) return NOTOK; if (theGraph->functions->fpMarkDFSPath(theGraph, u, IC->v) != OK || theGraph->functions->fpMarkDFSPath(theGraph, XorY, d) != OK || theGraph->functions->fpMarkDFSPath(theGraph, IC->w, IC->dw) != OK || _JoinBicomps(theGraph) != OK || _AddAndMarkEdge(theGraph, u, d) != OK || _AddAndMarkEdge(theGraph, IC->v, IC->dw) != OK) return NOTOK; return OK; } /* Otherwise, isolate Minor E4 (reduce to minor A) */ if (_FindUnembeddedEdgeToAncestor(theGraph, IC->w, &u, &d) != TRUE) return NOTOK; IC->v = u; IC->dw = d; return _IsolateOuterplanarityObstructionA(theGraph); } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/homeomorphSearch/graphK23Search.h000066400000000000000000000011271522057144000314600ustar00rootroot00000000000000#ifndef GRAPH_K23SEARCH_H #define GRAPH_K23SEARCH_H /* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "../planarityRelated/graphOuterplanarity.h" #ifdef __cplusplus extern "C" { #endif // Create a K23Search Graph, i.e., subclass an Outerplanarity Graph by extending it // with the ability to perform a search for a subgraph homeomorphic to K_{2,3}. #define K23SEARCH_NAME "K23Search" int gp_ExtendWith_K23Search(graphP theGraph); int gp_Detach_K23Search(graphP theGraph); #ifdef __cplusplus } #endif #endif graph-algorithms-planarity-08d7b51/planarity/c/graphLib/homeomorphSearch/graphK23Search.private.h000066400000000000000000000007531522057144000331350ustar00rootroot00000000000000#ifndef GRAPH_K23SEARCH_PRIVATE_H #define GRAPH_K23SEARCH_PRIVATE_H /* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "../planarityRelated/graphOuterplanarity.private.h" #ifdef __cplusplus extern "C" { #endif typedef struct { // Overloaded function pointers graphFunctionTableStruct functions; } K23SearchContext; extern int K23SEARCH_ID; #ifdef __cplusplus } #endif #endif graph-algorithms-planarity-08d7b51/planarity/c/graphLib/homeomorphSearch/graphK23Search_Extensions.c000066400000000000000000000230451522057144000336750ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include #include "graphK23Search.h" #include "graphK23Search.private.h" // Need to save and restore a graph flag related to IO #include "../io/graphIO.h" extern int _SearchForK23InBicomp(graphP theGraph, int v, int R); extern int _TestForK23GraphObstruction(graphP theGraph, int *degrees, int *imageVerts); extern int _getImageVertices(graphP theGraph, int *degrees, int maxDegree, int *imageVerts, int maxNumImageVerts); extern int _TestSubgraph(graphP theSubgraph, graphP theGraph); /* Forward declarations of overloading functions */ int _K23Search_HandleBlockedBicomp(graphP theGraph, int v, int RootVertex, int R); int _K23Search_EmbedPostprocess(graphP theGraph, int v, int edgeEmbeddingResult); int _K23Search_CheckEmbeddingIntegrity(graphP theGraph, graphP origGraph); int _K23Search_CheckObstructionIntegrity(graphP theGraph, graphP origGraph); /* Forward declarations of functions used by the extension system */ void *_K23Search_DupContext(void *pContext, void *theGraph); int _K23Search_CopyData(void *, void *); void _K23Search_FreeContext(void *); /**************************************************************************** * K23SEARCH_ID - the variable used to hold the integer identifier for this * extension, enabling this feature's extension context to be distinguished * from other features' extension contexts that may be attached to a graph. ****************************************************************************/ int K23SEARCH_ID = 0; /**************************************************************************** gp_ExtendWith_K23Search() This function adjusts the graph data structure to attach the K2,3 search feature. ****************************************************************************/ int gp_ExtendWith_K23Search(graphP theGraph) { K23SearchContext *context = NULL; if (theGraph == NULL || gp_GetN(theGraph) <= 0) return NOTOK; // If the K2,3 search feature has already been attached to the graph // then there is no need to attach it again gp_FindExtension(theGraph, K23SEARCH_ID, (void *)&context); if (context != NULL) { return OK; } // Ensure theGraph is an Outerplanarity Graph if (gp_ExtendWith_Outerplanarity(theGraph) != OK) return NOTOK; // Allocate a new extension context context = (K23SearchContext *)malloc(sizeof(K23SearchContext)); if (context == NULL) { return NOTOK; } // Put the overload functions into the context function table. // gp_AddExtension will overload the graph's functions with these, and // return the base function pointers in the context function table memset(&context->functions, 0, sizeof(graphFunctionTableStruct)); context->functions.fpHandleBlockedBicomp = _K23Search_HandleBlockedBicomp; context->functions.fpEmbedPostprocess = _K23Search_EmbedPostprocess; context->functions.fpCheckEmbeddingIntegrity = _K23Search_CheckEmbeddingIntegrity; context->functions.fpCheckObstructionIntegrity = _K23Search_CheckObstructionIntegrity; // Store the K23 search context, including the data structure and the // function pointers, as an extension of the graph if (gp_AddExtension(theGraph, &K23SEARCH_ID, (void *)context, _K23Search_DupContext, _K23Search_CopyData, _K23Search_FreeContext, &context->functions) != OK) { _K23Search_FreeContext(context); context = NULL; return NOTOK; } return OK; } /******************************************************************** gp_Detach_K23Search() ********************************************************************/ int gp_Detach_K23Search(graphP theGraph) { return gp_RemoveExtension(theGraph, K23SEARCH_ID); } /******************************************************************** _K23Search_DupContext() ********************************************************************/ void *_K23Search_DupContext(void *pContext, void *theGraph) { K23SearchContext *context = (K23SearchContext *)pContext; K23SearchContext *newContext = (K23SearchContext *)malloc(sizeof(K23SearchContext)); if (newContext != NULL) { *newContext = *context; } return newContext; } /******************************************************************** _K23Search_CopyData() ********************************************************************/ int _K23Search_CopyData(void *dstContext, void *srcContext) { return OK; } /******************************************************************** _K23Search_FreeContext() ********************************************************************/ void _K23Search_FreeContext(void *pContext) { free(pContext); } /******************************************************************** ********************************************************************/ int _K23Search_HandleBlockedBicomp(graphP theGraph, int v, int RootVertex, int R) { if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK23) { // If R is the root of a descendant bicomp of v, we push it, but then we know the search for K2,3 // will be successful and return NONEMBEDDABLE because this condition corresponds to minor A, which // is a K2,3. Thus, an "OK to proceed with Walkdown searching elsewhere" result cannot happen, // so we don't have to test for it to detect if we have to pop these two back off the stack. if (R != RootVertex) sp_Push2(theGraph->theStack, R, 0); // The possible results here are NONEMBEDDABLE if a K2,3 homeomorph is found, or OK if only // a K4 was found and unblocked such that it is OK for the Walkdown to continue searching // elsewhere. Note that the OK result can only happen if RootVertex==R since minor E can only // happen on a child bicomp of vertex v, not a descendant bicomp. return _SearchForK23InBicomp(theGraph, v, R); } else { K23SearchContext *context = NULL; gp_FindExtension(theGraph, K23SEARCH_ID, (void *)&context); if (context != NULL) { return context->functions.fpHandleBlockedBicomp(theGraph, v, RootVertex, R); } } return NOTOK; } /******************************************************************** ********************************************************************/ int _K23Search_EmbedPostprocess(graphP theGraph, int v, int edgeEmbeddingResult) { int savedEmbedFlags = 0, savedZEROBASEDIO = 0; // For K2,3 search, we just return the edge embedding result because the // search result has been obtained already. if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK23) { if (edgeEmbeddingResult == OK) { // When a graph does not contain a K2,3 homeomorph, the embedding // is meaningless, so we empty it out. We preserve the embedFlags // to ensure post-processing continues as expected. savedEmbedFlags = gp_GetEmbedFlags(theGraph); savedZEROBASEDIO = gp_GetGraphFlags(theGraph) & GRAPHFLAGS_ZEROBASEDIO; gp_ResetGraphStorage(theGraph); theGraph->embedFlags = savedEmbedFlags; theGraph->graphFlags &= savedZEROBASEDIO; } return edgeEmbeddingResult; } // When not searching for K2,3, we let the superclass do the work else { K23SearchContext *context = NULL; gp_FindExtension(theGraph, K23SEARCH_ID, (void *)&context); if (context != NULL) { return context->functions.fpEmbedPostprocess(theGraph, v, edgeEmbeddingResult); } } return NOTOK; } /******************************************************************** ********************************************************************/ int _K23Search_CheckEmbeddingIntegrity(graphP theGraph, graphP origGraph) { if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK23) { return OK; } // When not searching for K2,3, we let the superclass do the work else { K23SearchContext *context = NULL; gp_FindExtension(theGraph, K23SEARCH_ID, (void *)&context); if (context != NULL) { return context->functions.fpCheckEmbeddingIntegrity(theGraph, origGraph); } } return NOTOK; } /******************************************************************** ********************************************************************/ int _K23Search_CheckObstructionIntegrity(graphP theGraph, graphP origGraph) { // When searching for K2,3, we ensure that theGraph is a subgraph of // the original graph and that it contains a K2,3 homeomorph if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK23) { int degrees[4], imageVerts[5]; if (_TestSubgraph(theGraph, origGraph) != TRUE) return NOTOK; if (_getImageVertices(theGraph, degrees, 3, imageVerts, 5) != OK) return NOTOK; if (_TestForK23GraphObstruction(theGraph, degrees, imageVerts) == TRUE) { return OK; } return NOTOK; } // When not searching for K2,3, we let the superclass do the work else { K23SearchContext *context = NULL; gp_FindExtension(theGraph, K23SEARCH_ID, (void *)&context); if (context != NULL) { return context->functions.fpCheckObstructionIntegrity(theGraph, origGraph); } } return NOTOK; } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/homeomorphSearch/graphK33Search.c000066400000000000000000002365361522057144000314720ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "graphK33Search.h" #include "graphK33Search.private.h" /* Imported functions */ // extern void _ClearAllVisitedFlagsInGraph(graphP); extern int _ClearAllVisitedFlagsInBicomp(graphP theGraph, int BicompRoot); extern int _ClearAllVisitedFlagsInOtherBicomps(graphP theGraph, int BicompRoot); extern void _ClearEdgeVisitedFlagsInUnembeddedEdges(graphP theGraph); extern int _FillVertexVisitedInfoInBicomp(graphP theGraph, int BicompRoot, int FillValue); // extern int _GetBicompSize(graphP theGraph, int BicompRoot); extern int _HideInternalEdges(graphP theGraph, int vertex); extern int _RestoreInternalEdges(graphP theGraph, int stackBottom); extern int _ClearInvertedFlagsInBicomp(graphP theGraph, int BicompRoot); extern int _ComputeEdgeRecordType(graphP theGraph, int a, int b, int edgeType); extern int _RestoreEdgeType(graphP theGraph, int u, int v); extern int _GetNeighborOnExtFace(graphP theGraph, int curVertex, int *pPrevLink); extern int _JoinBicomps(graphP theGraph); extern int _OrientVerticesInBicomp(graphP theGraph, int BicompRoot, int PreserveSigns); extern int _OrientVerticesInEmbedding(graphP theGraph); // extern void _InvertVertex(graphP theGraph, int V); extern int _ClearAllVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x); extern int _SetAllVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x); extern int _OrientExternalFacePath(graphP theGraph, int u, int v, int w, int x); extern int _ChooseTypeOfNonplanarityMinor(graphP theGraph, int v, int R); extern int _MarkLowestXYPath(graphP theGraph); extern int _IsolateKuratowskiSubgraph(graphP theGraph, int v, int R); extern int _GetLeastAncestorConnection(graphP theGraph, int cutVertex); extern int _FindUnembeddedEdgeToCurVertex(graphP theGraph, int cutVertex, int *pDescendant); extern int _FindUnembeddedEdgeToSubtree(graphP theGraph, int ancestor, int SubtreeRoot, int *pDescendant); extern int _MarkPathAlongBicompExtFace(graphP theGraph, int startVert, int endVert); extern int _AddAndMarkEdge(graphP theGraph, int ancestor, int descendant); extern int _DeleteUnmarkedVerticesAndEdges(graphP theGraph); extern int _IsolateMinorE1(graphP theGraph); #ifndef USE_MERGEBLOCKER extern int _IsolateMinorE2(graphP theGraph); #endif extern int _IsolateMinorE3(graphP theGraph); extern int _IsolateMinorE4(graphP theGraph); extern int _MarkDFSPathsToDescendants(graphP theGraph); extern int _AddAndMarkUnembeddedEdges(graphP theGraph); extern void _K33Search_InitEdgeRec(K33SearchContext *context, int e); /* Private functions for K_{3,3} searching. */ int _SearchForK33InBicomp(graphP theGraph, K33SearchContext *context, int v, int R); int _RunExtraK33Tests(graphP theGraph, K33SearchContext *context); int _SearchForMinorE1(graphP theGraph); int _FinishIsolatorContextInitialization(graphP theGraph, K33SearchContext *context); int _SearchForDescendantExternalConnection(graphP theGraph, K33SearchContext *context, int cutVertex, int u_max); int _Fast_GetLeastAncestorConnection(graphP theGraph, K33SearchContext *context, int cutVertex); int _GetAdjacentAncestorInRange(graphP theGraph, K33SearchContext *context, int vertex, int closerAncestor, int fartherAncestor); int _FindExternalConnectionDescendantEndpoint(graphP theGraph, int ancestor, int cutVertex, int *pDescendant); int _SearchForMergeBlocker(graphP theGraph, K33SearchContext *context, int v, int *pMergeBlocker); int _FindK33WithMergeBlocker(graphP theGraph, K33SearchContext *context, int v, int mergeBlocker); int _TestForZtoWPath(graphP theGraph); int _TestForStraddlingBridge(graphP theGraph, K33SearchContext *context, int u_max); int _K33Search_DeleteUnmarkedEdgesInBicomp(graphP theGraph, K33SearchContext *context, int BicompRoot); int _K33Search_DeleteEdge(graphP theGraph, K33SearchContext *context, int e); int _ReduceBicomp(graphP theGraph, K33SearchContext *context, int R); int _ReduceExternalFacePathToEdge(graphP theGraph, K33SearchContext *context, int u, int x, int edgeType); int _ReduceXYPathToEdge(graphP theGraph, K33SearchContext *context, int u, int x, int edgeType); int _RestoreReducedPath(graphP theGraph, K33SearchContext *context, int e); int _RestoreAndOrientReducedPaths(graphP theGraph, K33SearchContext *context); int _MarkStraddlingBridgePath(graphP theGraph, int u_min, int u_max, int u_d, int d); int _IsolateMinorE5(graphP theGraph); int _IsolateMinorE6(graphP theGraph, K33SearchContext *context); int _IsolateMinorE7(graphP theGraph, K33SearchContext *context); /**************************************************************************** _SearchForK33InBicomp() ****************************************************************************/ int _SearchForK33InBicomp(graphP theGraph, K33SearchContext *context, int v, int R) { isolatorContextP IC = theGraphIC(theGraph); int tempResult; /* Begin by determining which non-planarity minor is detected */ if (_ChooseTypeOfNonplanarityMinor(theGraph, v, R) != OK) return NOTOK; /* If minor A is selected, then the root of the oriented bicomp has been changed */ else R = IC->r; /* Minors A to D result in the desired K_{3,3} homeomorph, so we isolate it and return NONEMBEDDABLE. */ if (theGraphIC(theGraph)->minorType & (MINORTYPE_A | MINORTYPE_B | MINORTYPE_C | MINORTYPE_D)) { /* First we restore the orientations of the vertices in the one bicomp we have messed with so that there is no confusion. */ if (_OrientVerticesInBicomp(theGraph, R, 1) != OK) return NOTOK; /* Next we restore the orientation of the embedding so we can restore the reduced paths (because we avoid modifying the Kuratowski subgraph isolator to restore reduced paths, which are a construct of the K_{3,3} search). */ if (_OrientVerticesInEmbedding(theGraph) != OK || _RestoreAndOrientReducedPaths(theGraph, context) != OK) return NOTOK; /* Next we simply call the Kuratowski subgraph isolation since we know now that it will isolate a K_{3,3}. For minor A, we need to set up the stack that would be available immediately after a Walkdown failure. */ if (theGraphIC(theGraph)->minorType & MINORTYPE_A) { sp_ClearStack(theGraph->theStack); sp_Push2(theGraph->theStack, R, NIL); } if (_IsolateKuratowskiSubgraph(theGraph, v, R) != OK) return NOTOK; return NONEMBEDDABLE; } /* For minor E (a K5 minor), we run the additional tests to see if minors E1 to E4 apply since these minors isolate a K_{3,3} entangled with the K5. This is the key location where GetLeastAncestorConnection() must be constant time. */ IC->ux = _Fast_GetLeastAncestorConnection(theGraph, context, IC->x); IC->uy = _Fast_GetLeastAncestorConnection(theGraph, context, IC->y); IC->uz = _Fast_GetLeastAncestorConnection(theGraph, context, IC->z); if (IC->z != IC->w || IC->uz > MAX(IC->ux, IC->uy) || (IC->uz < MAX(IC->ux, IC->uy) && IC->ux != IC->uy) || (IC->x != IC->px || IC->y != IC->py)) { if (_OrientVerticesInBicomp(theGraph, R, 1) != OK) return NOTOK; if (_OrientVerticesInEmbedding(theGraph) != OK || _RestoreAndOrientReducedPaths(theGraph, context) != OK) return NOTOK; if (_IsolateKuratowskiSubgraph(theGraph, v, R) != OK) return NOTOK; return NONEMBEDDABLE; } /* If the Kuratowski subgraph isolator will not isolate a K_{3,3} based on minor E, then a K5 homeomorph could be isolated. However, a K_{3,3} may still be tangled with the K5, so we now run the additional tests of the K_{3,3} search algorithm. If the search finds a K_{3,3} (tempResult of NONEMBEDDABLE), then we remove unwanted edges from the graph and return NONEMBEDDABLE. If the search has a fault (NOTOK), then we return. If the result is OK, then a K_{3,3} was not found at this time and we proceed with some clean-up work below. */ if ((tempResult = _RunExtraK33Tests(theGraph, context)) != OK) { if (tempResult == NONEMBEDDABLE) if (_DeleteUnmarkedVerticesAndEdges(theGraph) != OK) return NOTOK; return tempResult; } /* The extra cases for finding a K_{3,3} did not succeed, so the bicomp rooted by R is either a K5 homeomorph (with at most a superficially entangled K_{3,3}) or we have made the special setting that allows us to detect the one "merge blocker" case that would be too costly to try now. Either way, we can safely reduce the bicomp to the 4-cycle (R, X, W, Y, R) and proceed with the planarity algorithm. We also restore the mixed orientation of the bicomp (i.e. the proper orientation in the context of the edge signs) because this code can work when ReduceBicomp doesn't do any actual work. */ if (_OrientVerticesInBicomp(theGraph, R, 1) != OK) return NOTOK; if (_ReduceBicomp(theGraph, context, R) != OK) return NOTOK; /* Set visitedInfo values in the bicomp to the initialized state so the planarity algorithm can properly do the Walkup procedure in future steps */ if (_FillVertexVisitedInfoInBicomp(theGraph, IC->r, gp_GetN(theGraph)) != OK) return NOTOK; /* We now intend to ignore the pertinence of W (conceptually eliminating the connection from W to the current vertex). Note that none of the bicomp roots in the pertinentRootsList (nor their respective subtrees) will be visited again by the planarity algorithm because they must've been only pertinent. If they were future pertinent and pertinent, then we would've found a K_{3,3} by non-planarity minor B. Thus, the original Walkup costs that identified the pertinent bicomps we intend to ignore are one-time costs, preserving linear time. */ gp_SetVertexPertinentEdge(theGraph, IC->w, NIL); gp_SetVertexPertinentRootsList(theGraph, IC->w, NIL); return OK; } /**************************************************************************** _RunExtraK33Tests() ****************************************************************************/ #define USE_MERGEBLOCKER int _RunExtraK33Tests(graphP theGraph, K33SearchContext *context) { isolatorContextP IC = theGraphIC(theGraph); int u_max = MAX3(IC->ux, IC->uy, IC->uz); #ifndef USE_MERGEBLOCKER int u; #endif /* Case 1: If there is a pertinent or future pertinent vertex other than W on the lower external face path between X and Y (the points of attachment of the x-y path), then we can isolate a K_{3,3} homeomorph by Minor E1. */ if (_SearchForMinorE1(theGraph) != OK) return NOTOK; if (IC->w != IC->z) { if (_FinishIsolatorContextInitialization(theGraph, context) != OK || _IsolateMinorE1(theGraph) != OK) return NOTOK; return NONEMBEDDABLE; } /* Case 2: If W/Z can make an external connection to an ancestor of V that is descendant to u_{max}, then a K_{3,3} homeomorph can be isolated with Minor E2. OPTIMIZATION: We do not need to check for this case. We avoid doing so because in very specially crafted cases it could be too costly if the connection doesn't exist. However, if the highest numbered ancestor H of the current vertex that has an external connection from W is a descendant u_{max} then we will discover a K_{3,3} by Minor A or B in step H (unless some other test succeeds at finding a K_{3,3} first), so we just let the non-planarity detector do its work since Minors A and B both provide a K_{3,3} when found. This happens because w is pertinent to H and future pertinent to u_max or an ancestor of u_max. Minor A will happen if, in step H, Walkdown descends to the bicomp containing the current vertex, x, y and w. Since x and y would still be future pertinent (they connect to u_max or higher, i.e. with lesser DFI, than u_max). Minor B will happen if the bicomp containing the current vertex, x, y and w is a descendant of a bicomp that blocks planarity in step H. The bicomp would be both pertinent (due to w's connection to H) and future pertinent(due to connections to ancestors of H by w, x and y). */ #ifndef USE_MERGEBLOCKER u = _SearchForDescendantExternalConnection(theGraph, context, IC->w, u_max); if (u > u_max) { IC->uz = u; if (_FinishIsolatorContextInitialization(theGraph, context) != OK || _IsolateMinorE2(theGraph) != OK) return NOTOK; return NONEMBEDDABLE; } #endif /* Case 3: If X or Y can make an external connection to an ancestor of V that is descendant to u_{max}, then a K_{3,3} homeomorph can be isolated with Minor E3. NOTE: Due to the prior use of the Kuratowski subgraph isolator, we know that at most one of X, Y or W/Z could have an external connection to an ancestor of u_{max} = MAX(ux, uy, uz). OPTIMIZATION: We do not check for the lower connection required to find Minor E3 because it might ultimately be too costly. Instead, we mark the vertex with a 'merge blocker' of u_{max}. If the planar embedder attempts to merge the vertex prior to step u_{max}, then the embedder has found the desired connection and a K_{3,3} homeomorph is isolated at that time. */ #ifdef USE_MERGEBLOCKER context->VI[IC->x].mergeBlocker = u_max; #endif #ifndef USE_MERGEBLOCKER u = _SearchForDescendantExternalConnection(theGraph, context, IC->x, u_max); if (u > u_max) { IC->ux = u; if (_FinishIsolatorContextInitialization(theGraph, context) != OK || _IsolateMinorE3(theGraph) != OK) return NOTOK; return NONEMBEDDABLE; } #endif #ifdef USE_MERGEBLOCKER context->VI[IC->y].mergeBlocker = u_max; #endif #ifndef USE_MERGEBLOCKER u = _SearchForDescendantExternalConnection(theGraph, context, IC->y, u_max); if (u > u_max) { IC->uy = u; if (_FinishIsolatorContextInitialization(theGraph, context) != OK || _IsolateMinorE3(theGraph) != OK) return NOTOK; return NONEMBEDDABLE; } #endif /* Case 4: If there exists any x-y path with points of attachment px and py such that px!=x or py!=y, then a K_{3,3} homeomorph can be isolated with Minor E4. */ // Prior tests to choose the type of non-planarity minor selected the highest // x-y path, so we need to clear the visited flags of that path before marking // instead the x-y path with the lowest attachment points (those closest to W // along the external face). if (_ClearAllVisitedFlagsInBicomp(theGraph, IC->r) != OK) return NOTOK; // Now mark the lowest x-y path so that we can test whether _any_ x-y path // has points of attachment, px or py, below x or y, respectively (where // below means closer to W than x or y, respectively, along the external face). if (_MarkLowestXYPath(theGraph) != OK) return NOTOK; // Now we test for E4 based on whether px!=x or py!=y. Note that the inequality // test is sufficient because not equal means attached lower by the time we are // testing for E4 because the prior test for non-planarity minor C already ruled // out the possibility that inequality could mean attached higher than x or y. if (IC->px != IC->x || IC->py != IC->y) { if (_FinishIsolatorContextInitialization(theGraph, context) != OK || _IsolateMinorE4(theGraph) != OK) return NOTOK; return NONEMBEDDABLE; } /* Case 5: If the x-y path contains an internal vertex that starts a second internal path from the internal vertex to W/Z, then a K_{3,3} homeomorph can be isolated with Minor E5. */ // Since the E4 test above has already marked the lowest X-Y path, and only // the lowest one could possibly have a Z-to-W path attached to it, we // simply reuse the x-y path from E4 here in the E5 test. // (NOTE: Only the lowest X-Y path could have a Z-to-W path because all // bicomps are planar embeddings, and so a Z-to-W path emanating // from a higher X-Y path would cross the lowest one, violating the // planarity of the bicomp). if (_TestForZtoWPath(theGraph) != OK) return NOTOK; if (gp_GetVisited(theGraph, IC->w)) { if (_FinishIsolatorContextInitialization(theGraph, context) != OK || _IsolateMinorE5(theGraph) != OK) return NOTOK; return NONEMBEDDABLE; } /* Case 6: If uz < u_{max} and there is an external connection (other than external connections involving X, Y and W/Z) between an ancestor of u_{max} and a vertex in the range [V...u_{max}), then a K_{3,3} homeomorph can be isolated with Minor E6. OPTIMIZATION: See _TestForStraddlingBridge() */ if (IC->uz < u_max) { if (gp_IsVertex(theGraph, _TestForStraddlingBridge(theGraph, context, u_max))) { if (_FinishIsolatorContextInitialization(theGraph, context) != OK || _IsolateMinorE6(theGraph, context) != OK) return NOTOK; return NONEMBEDDABLE; } } /* Case 7: If ux < u_{max} or uy < u_{max} and there is an external connection between an ancestor of u_{max} and a vertex in the range [V...u_{max}) (except for external connections involving X, Y and W/Z), then a K_{3,3} homeomorph can be isolated with Minor E7. OPTIMIZATION: Same as Case 6.*/ if (IC->ux < u_max || IC->uy < u_max) { if (gp_IsVertex(theGraph, _TestForStraddlingBridge(theGraph, context, u_max))) { if (_FinishIsolatorContextInitialization(theGraph, context) != OK || _IsolateMinorE7(theGraph, context) != OK) return NOTOK; return NONEMBEDDABLE; } } /* If none of the tests found a K_{3,3}, then we return OK to indicate that nothing went wrong, but a K_{3,3} was not found. */ return OK; } /**************************************************************************** _SearchForMinorE1() Search along the external face below the x-y path for a vertex Z other than W that is future pertinent or pertinent. ****************************************************************************/ int _SearchForMinorE1(graphP theGraph) { int Z = theGraphIC(theGraph)->px, ZPrevLink = 1; Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); while (Z != theGraphIC(theGraph)->py) { if (Z != theGraphIC(theGraph)->w) { gp_UpdateVertexFuturePertinentChild(theGraph, Z, theGraphIC(theGraph)->v); if (FUTUREPERTINENT(theGraph, Z, theGraphIC(theGraph)->v)) { theGraphIC(theGraph)->z = Z; theGraphIC(theGraph)->uz = _GetLeastAncestorConnection(theGraph, Z); return OK; } else if (PERTINENT(theGraph, Z)) { /* Swap the roles of W and Z */ theGraphIC(theGraph)->z = theGraphIC(theGraph)->w; theGraphIC(theGraph)->w = Z; /* If the new W (indicated by Z) was on the path (R, X, old W) then the new Z (the old W, which has no type mark) is on the path (X, new W, new Z, Y) so we change the type new Z to being on the RYW path. Otherwise, the order is (X, new Z, new W, Y), so the new Z (old W with no type) is type changed to be on the RXW path.*/ if (gp_GetObstructionMark(theGraph, Z) == ANYVERTEX_OBSTRUCTIONMARK_LOW_RXW) gp_ResetObstructionMark(theGraph, theGraphIC(theGraph)->z, ANYVERTEX_OBSTRUCTIONMARK_LOW_RYW); else gp_ResetObstructionMark(theGraph, theGraphIC(theGraph)->z, ANYVERTEX_OBSTRUCTIONMARK_LOW_RXW); /* For completeness, we change the new W to type unknown */ gp_ClearObstructionMark(theGraph, theGraphIC(theGraph)->w); /* The external activity ancestor connection of the new Z must be obtained */ theGraphIC(theGraph)->uz = _GetLeastAncestorConnection(theGraph, theGraphIC(theGraph)->z); return OK; } } Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); } return OK; } /**************************************************************************** _FinishIsolatorContextInitialization() Once it has been decided that a desired subgraph can be isolated, it becomes safe to finish the isolator context initialization. ****************************************************************************/ int _FinishIsolatorContextInitialization(graphP theGraph, K33SearchContext *context) { isolatorContextP IC = theGraphIC(theGraph); /* Restore the orientation of the bicomp on which we're working, then perform orientation of all vertices in graph. (An unnecessary but polite step that simplifies the description of key states of the data structures). */ if (_OrientVerticesInBicomp(theGraph, IC->r, 1) != OK) return NOTOK; if (_OrientVerticesInEmbedding(theGraph) != OK) return NOTOK; /* Restore any paths that were reduced to single edges */ if (_RestoreAndOrientReducedPaths(theGraph, context) != OK) return NOTOK; /* We assume that the current bicomp has been marked appropriately, but we must now clear the visitation flags of all other bicomps. */ if (_ClearAllVisitedFlagsInOtherBicomps(theGraph, IC->r) != OK) return NOTOK; /* To complete the normal behavior of _ClearAllVisitedFlagsInGraph() in the normal isolator context initialization, we also have to clear the visited flags on all edges that have not yet been embedded */ _ClearEdgeVisitedFlagsInUnembeddedEdges(theGraph); /* Now we can find the descendant ends of unembedded back edges based on the ancestor settings ux, uy and uz. */ if (_FindExternalConnectionDescendantEndpoint(theGraph, IC->ux, IC->x, &IC->dx) != OK || _FindExternalConnectionDescendantEndpoint(theGraph, IC->uy, IC->y, &IC->dy) != OK || _FindExternalConnectionDescendantEndpoint(theGraph, IC->uz, IC->z, &IC->dz) != OK) return NOTOK; /* Finally, we obtain the descendant end of an unembedded back edge to the current vertex. */ if (_FindUnembeddedEdgeToCurVertex(theGraph, IC->w, &IC->dw) != TRUE) return NOTOK; return OK; } /**************************************************************************** _Fast_GetLeastAncestorConnection() This function searches for an ancestor of the current vertex v adjacent by a cycle edge to the given cutVertex or one of its DFS descendants appearing in a separated bicomp. The given cutVertex is assumed to be future pertinent such that either the leastAncestor or the lowpoint of a separated DFS child is less than v. We obtain the minimum possible connection from the cutVertex to an ancestor of v. This function performs the same operation as _GetLeastAncestorConnection(), except in constant time. ****************************************************************************/ int _Fast_GetLeastAncestorConnection(graphP theGraph, K33SearchContext *context, int cutVertex) { int ancestor = gp_GetVertexLeastAncestor(theGraph, cutVertex); int child = context->VI[cutVertex].separatedDFSChildList; if (gp_IsVertex(theGraph, child) && ancestor > gp_GetVertexLowpoint(theGraph, child)) ancestor = gp_GetVertexLowpoint(theGraph, child); return ancestor; } /**************************************************************************** _GetAdjacentAncestorInRange() Returns the ancestor of theVertex that is adjacent to theVertex by an unembedded back edge and has a DFI strictly between closerAncestor and fartherAncestor. Returns NIL if theVertex has no such neighboring ancestor. ****************************************************************************/ int _GetAdjacentAncestorInRange(graphP theGraph, K33SearchContext *context, int theVertex, int closerAncestor, int fartherAncestor) { int e = context->VI[theVertex].backEdgeList; while (gp_IsEdge(theGraph, e)) { if (gp_GetNeighbor(theGraph, e) < closerAncestor && gp_GetNeighbor(theGraph, e) > fartherAncestor) return gp_GetNeighbor(theGraph, e); e = gp_GetNextEdge(theGraph, e); if (e == context->VI[theVertex].backEdgeList) e = NIL; } return NIL; } /**************************************************************************** _SearchForDescendantExternalConnection() Search the cutVertex and each separated child subtree for an external connection to a vertex ancestor to the current vertex V and descendant to u_max. The function returns the descendant of u_max found to have an external connection to the given cut vertex. ****************************************************************************/ int _SearchForDescendantExternalConnection(graphP theGraph, K33SearchContext *context, int cutVertex, int u_max) { isolatorContextP IC = theGraphIC(theGraph); int u2 = _GetAdjacentAncestorInRange(theGraph, context, cutVertex, IC->v, u_max); int child, descendant; // Test cutVertex for an external connection to descendant of u_max via direct back edge if (gp_IsVertex(theGraph, u2)) return u2; // If there is no direct back edge connection from the cut vertex // to a vertex on the path between V and u_max, then we will // look for such a connection in the DFS subtrees rooted by // separated DFS children of the vertex (ignoring those whose // lowpoint indicates that they make no external connections) // Begin by pushing the separated DFS children of the cut vertex with // lowpoints indicating connections to ancestors of the current vertex. sp_ClearStack(theGraph->theStack); child = gp_GetVertexSortedDFSChildList(theGraph, cutVertex); while (gp_IsVertex(theGraph, child)) { if (gp_GetVertexLowpoint(theGraph, child) < IC->v && gp_IsSeparatedDFSChild(theGraph, child)) sp_Push(theGraph->theStack, child); child = gp_GetVertexNextDFSChild(theGraph, cutVertex, child); } // Now process the stack until it is empty or until we've found the desired connection. while (!sp_IsEmpty(theGraph->theStack)) { sp_Pop(theGraph->theStack, descendant); // If the vertex has a lowpoint indicating that it makes no external connections, // then skip the subtree rooted by the vertex if (gp_GetVertexLowpoint(theGraph, descendant) < IC->v) { // Check the subtree root for the desired connection. u2 = _GetAdjacentAncestorInRange(theGraph, context, descendant, IC->v, u_max); if (gp_IsVertex(theGraph, u2)) return u2; // Push each child as a new subtree root to be considered, except skip those whose lowpoint is too great. child = gp_GetVertexSortedDFSChildList(theGraph, descendant); while (gp_IsVertex(theGraph, child)) { if (gp_GetVertexLowpoint(theGraph, child) < IC->v) sp_Push(theGraph->theStack, child); child = gp_GetVertexNextDFSChild(theGraph, descendant, child); } } } // The only external connections from the cutVertex lead to u_max, so return it. return u_max; } /**************************************************************************** _FindExternalConnectionDescendantEndpoint() This operation is similar to _FindUnembeddedEdgeToAncestor() except that we need to be more precise in this case, finding an external connection from a given cut vertex to a *particular* given ancestor. NOTE: By external we don't mean externall active so much as not embedded in the bicomp containing the cut vertex. Returns OK if it finds that either the given cutVertex or one of its descendants in a separated bicomp has an unembedded back edge connection to the given ancestor vertex. Returns NOTOK otherwise (it is an error to not find the descendant because this function is only called if _SearchForDescendantExternalConnection() has already determined the existence of the descendant). ****************************************************************************/ int _FindExternalConnectionDescendantEndpoint(graphP theGraph, int ancestor, int cutVertex, int *pDescendant) { int child, e; // Check whether the cutVertex is directly adjacent to the ancestor // by an unembedded back edge. e = gp_GetVertexFwdEdgeList(theGraph, ancestor); while (gp_IsEdge(theGraph, e)) { if (gp_GetNeighbor(theGraph, e) == cutVertex) { *pDescendant = cutVertex; return OK; } e = gp_GetNextEdge(theGraph, e); if (e == gp_GetVertexFwdEdgeList(theGraph, ancestor)) e = NIL; } // Now check the descendants of the cut vertex to see if any make // a connection to the ancestor. child = gp_GetVertexSortedDFSChildList(theGraph, cutVertex); while (gp_IsVertex(theGraph, child)) { if (gp_GetVertexLowpoint(theGraph, child) < theGraphIC(theGraph)->v && gp_IsSeparatedDFSChild(theGraph, child)) { if (_FindUnembeddedEdgeToSubtree(theGraph, ancestor, child, pDescendant) == TRUE) return OK; } child = gp_GetVertexNextDFSChild(theGraph, cutVertex, child); } return NOTOK; } /**************************************************************************** _SearchForMergeBlocker() This function helps to implement the merge blocking optimization of _SearchForDescendantExternalConnection(). The function RunExtraK33Tests() sets a mergeBlocker rather than run _SearchForDescendantExternalConnection() in certain cases. This procedure is called by MergeBicomps to test the embedding stack for a merge blocker before merging any biconnected components. If a merge blocker is found, then FindK33WithMergeBlocker() is called and ultimately the embedder's Walkdown function is terminated since a K_{3,3} is isolated. Returns OK on success (whether or not the search found a merge blocker) NOTOK on internal function failure pMergeBlocker is set to NIL unless a merge blocker is found. ****************************************************************************/ int _SearchForMergeBlocker(graphP theGraph, K33SearchContext *context, int v, int *pMergeBlocker) { stackP tempStack; int Z; /* Set return result to 'not found' then return if there is no stack to inspect */ *pMergeBlocker = NIL; if (sp_IsEmpty(theGraph->theStack)) return OK; /* Create a copy of the embedding stack */ tempStack = sp_Duplicate(theGraph->theStack); if (tempStack == NULL) return NOTOK; /* Search the copy of the embedding stack for a merge blocked vertex */ while (!sp_IsEmpty(tempStack)) { sp_Pop2_Discard(tempStack); /* Move (R, Rout) out of the way */ sp_Pop2_Discard1(tempStack, Z); /* Get Z, discard ZPrevLink */ if (gp_IsVertex(theGraph, context->VI[Z].mergeBlocker) && context->VI[Z].mergeBlocker < v) { *pMergeBlocker = Z; break; } } sp_Free(&tempStack); return OK; } /**************************************************************************** _FindK33WithMergeBlocker() This function completes the merge blocking optimization by isolating a K_{3,3} based on minor E3 if a merge blocked vertex was previously found. Returns OK on success, NOTOK on internal function failure ****************************************************************************/ int _FindK33WithMergeBlocker(graphP theGraph, K33SearchContext *context, int v, int mergeBlocker) { int R, RPrevLink, u_max, u, e; isolatorContextP IC = theGraphIC(theGraph); /* First, we orient the vertices so we can successfully restore all of the reduced paths. This needs to be done before reconstructing the context for CASE 3 of RunExtraK33Tests() because the reconstruction involves using the Walkup to v from a descendant of v, which will not work if the descendant is in one of the reduced paths. */ if (_OrientVerticesInEmbedding(theGraph) != OK || _RestoreAndOrientReducedPaths(theGraph, context) != OK) return NOTOK; /* Reconstruct the context that was present for CASE 3 of RunExtraK33Tests() when we decided to set a mergeBlocker rather than calling _SearchForDescendantExternalConnection() */ /* Obtain the root of the bicomp containing the mergeBlocker. */ RPrevLink = 1; R = mergeBlocker; while (gp_IsNotVirtualVertex(theGraph, R)) R = _GetNeighborOnExtFace(theGraph, R, &RPrevLink); /* Switch the 'current step' variable v to be equal to the non-virtual counterpart of the bicomp root. */ IC->v = gp_GetVertexFromBicompRoot(theGraph, R); /* Reset the visitation, pertinence and future pertinence settings from step u_max for step v */ for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { gp_SetVertexVisitedInfo(theGraph, v, gp_GetN(theGraph)); gp_SetVertexPertinentEdge(theGraph, v, NIL); gp_SetVertexPertinentRootsList(theGraph, v, NIL); // Any calls to actually determine FUTUREPERTINENT status for a vertex w will actually invoke // gp_UpdateVertexFuturePertinentChild(theGraph, w, v) beforehand, so only need to reinitialize here gp_SetVertexFuturePertinentChild(theGraph, v, gp_GetVertexSortedDFSChildList(theGraph, v)); } /* Restore the pertinence settings of step v by doing the Walkup for each back edge that was not embedded when step v was originally performed. */ e = gp_GetVertexFwdEdgeList(theGraph, IC->v); while (gp_IsEdge(theGraph, e)) { theGraph->functions->fpWalkUp(theGraph, IC->v, e); e = gp_GetNextEdge(theGraph, e); if (e == gp_GetVertexFwdEdgeList(theGraph, IC->v)) e = NIL; } /* Next, we make the standard initialization calls for when we have found a non-planarity condition. */ sp_ClearStack(theGraph->theStack); if (_ChooseTypeOfNonplanarityMinor(theGraph, IC->v, R) != OK) return NOTOK; IC->ux = _GetLeastAncestorConnection(theGraph, IC->x); IC->uy = _GetLeastAncestorConnection(theGraph, IC->y); IC->uz = _GetLeastAncestorConnection(theGraph, IC->z); u_max = MAX3(IC->ux, IC->uy, IC->uz); /* Perform the remainder of CASE 3 of RunExtraK33Tests() */ if (mergeBlocker == IC->x) { u = _SearchForDescendantExternalConnection(theGraph, context, IC->x, u_max); if (u > u_max) { IC->ux = u; if (_FinishIsolatorContextInitialization(theGraph, context) != OK || _IsolateMinorE3(theGraph) != OK) return NOTOK; } else return NOTOK; } else if (mergeBlocker == IC->y) { u = _SearchForDescendantExternalConnection(theGraph, context, IC->y, u_max); if (u > u_max) { IC->uy = u; if (_FinishIsolatorContextInitialization(theGraph, context) != OK || _IsolateMinorE3(theGraph) != OK) return NOTOK; } else return NOTOK; } else return NOTOK; /* Do the final clean-up to obtain the K_{3,3} */ if (_DeleteUnmarkedVerticesAndEdges(theGraph) != OK) return NOTOK; return OK; } /**************************************************************************** _TestForZtoWPath() This function tests whether there is a path inside the bicomp leading from W to some internal node of the x-y path. If there is, the path is marked (the visited flags of its vertices and edges are set). Upon function return, the marking (visited flag setting) of W distinguishes whether the path was found. The function returns NOTOK on internal error, OK otherwise. Preconditions: The X-Y path is marked visited by a prior invocation of the method _MarkLowestXYPath() above. So, we start a depth first search from W to find a visited vertex, except we prune the search to ignore vertices whose obstruction type is other than unknown. This ensures the path found, if any, avoids external face vertices, including avoiding X and Y. Furthermore, the path search is completed without traversing to R due to the obstructing X-Y path. The depth first search has to "mark" the vertices it has seen as visited, but the visited flags are already in use to distinguish the X-Y path. So, we reuse the visitedInfo setting of each vertex. The core planarity algorithm makes settings between 0 and N, so we will regard all of those as indicating 'unvisited' by this method, and use -1 to indicate visited. These markings need not be cleaned up because, if the desired path is found the a K_{3,3} is isolated and if the desired path is not found then the bicomp is reduced and the visitedInfo in the remaining vertices are set appropriately for future Walkup processing of the core planarity algorithm. For each vertex we visit, if it is an internal vertex on the X-Y path (i.e. visited flag set and obstruction type unknown), then we want to stop and unroll the stack to obtain the desired path (described below). If the vertex is internal but not on the X-Y path (i.e. visited flag clear and obstruction type unknown), then we want to visit its neighbors, except those already marked visited by this method (i.e. those with visitedInfo of -1) and those with a known obstruction type. We want to manage the stack so that it when the desired vertex is found, the stack contains the desired path. So, we do not simply push all the neighbors of the vertex being visited. First, given that we have popped some vertex-edge pair (v, e), we push *only* the next edge after e in v's adjacency list (starting with the first if e is NIL) that leads to a new 'eligible' vertex. An eligible vertex is one whose obstruction type is unknown and whose visitedInfo is other than -1 (so, internal and not yet processed by this method). Second, when we decide a new vertex w adjacent to v is eligible, we push not only (v, e) but also (w, NIL). When we later pop the vertex-edge pair containing NIL, we know that the vertex obstruction type is unknown so we test whether its visited flag is set (indicating an internal vertex on the X-Y path). If so, then we can stop the depth first search, then use the vertices and edges remaining on the stack to mark the desired path from the external face vertex W to an internal vertex Z on the X-Y path. If we pop (v, NIL) and find that the visited flag of v is clear, then it is not the desired connection endpoint to the X-Y path. We need to process all paths extending from it, but we don't want any of those paths to cycle back to this vertex, so we mark it as ineligible by putting -1 in its visitedInfo member. This is also the case in which the _first_ edge record e leading from v to an eligible vertex w is obtained, whereupon we push both (v, e) and (w, NIL). Eventually all paths leading from w to eligible vertices will be explored, and if none find the desired vertex connection to the X-Y path, then (v, e) is popped. Now we search the adjacency list of v starting after e to find the _next_ edge record that indicates the an eligible vertex to visit. None of the vertices processed while visiting paths extending from w will be eligible anymore, so it can be seen that this method is a depth first search. If no remaining edges from v indicate eligible vertices, then nothing is pushed and we simply go to the next iteration, which pops a 2-tuple containing the vertex u and the edge record e that points to v. Finally, if the stack empties without finding the desired vertex, then the first loop ends, and the second main loop does not mark a path because the stack is empty. ****************************************************************************/ int _TestForZtoWPath(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); int v, e, w; sp_ClearStack(theGraph->theStack); sp_Push2(theGraph->theStack, IC->w, NIL); while (!sp_IsEmpty(theGraph->theStack)) { sp_Pop2(theGraph->theStack, v, e); if (gp_IsNotEdge(theGraph, e)) { // If the vertex is visited, then it is a member of the X-Y path // Because it is being popped, its obstruction type is unknown because // that is the only kind of vertex pushed. // Hence, we break because we've found the desired path. if (gp_GetVisited(theGraph, v)) break; // Mark this vertex as being visited by this method (i.e. ineligible // to have processing started on it again) gp_SetVertexVisitedInfo(theGraph, v, -1); e = gp_GetFirstEdge(theGraph, v); } else e = gp_GetNextEdge(theGraph, e); // This while loop breaks on the first edge it finds that is eligible to be // pushed. Once that happens, we break. The successive edges of a vertex are // only pushed (see the else clause above) once all paths extending from v // through e have been explored and found not to contain the desired path while (gp_IsEdge(theGraph, e)) { w = gp_GetNeighbor(theGraph, e); // The test for w being a virtual vertex is just safeguarding the two subsequent calls, // but it can never happen due to the obstructing X-Y path. if (gp_IsNotVirtualVertex(theGraph, w) && gp_GetVertexVisitedInfo(theGraph, w) != -1 && gp_GetObstructionMark(theGraph, w) == ANYVERTEX_OBSTRUCTIONMARK_UNMARKED) { sp_Push2(theGraph->theStack, v, e); sp_Push2(theGraph->theStack, w, NIL); break; } e = gp_GetNextEdge(theGraph, e); } } while (!sp_IsEmpty(theGraph->theStack)) { sp_Pop2(theGraph->theStack, v, e); gp_SetVisited(theGraph, v); gp_SetEdgeVisited(theGraph, e); gp_SetEdgeVisited(theGraph, gp_GetTwin(theGraph, e)); } return OK; } /**************************************************************************** _TestForStraddlingBridge() We proceed on the path [V...u_{max}) from the current vertex V up to and excluding u_{max}. For each vertex p, we test whether p has a least ancestor less than u_{max} and whether p has a DFS child c that is not an ancestor of X, Y and W and that has a connection to an ancestor of u_{max} (in other words, whether the child C has a lowpoint less than u_{max}). The sortedDFSChildLIst of the vertex p is scanned for the separated DFS child c of least lowpoint, excluding the ancestor of X, Y and W. If no bridge straddling u_{max} is found, the function returns NIL. If a straddling bridge is found, the function returns a descendant d of p in the subtree rooted by c such that d has a leastAncestor less than u_{max}. Given the vertex d, the path through the straddling bridge required in Minors E6 and E7 is easy to identify: Mark the DFS tree path from d to p, and add and mark the edge from d to its least ancestor. OPTIMIZATION: If a straddling bridge is not found, then in each tree edge of the path [V...u_{max}) we set the member noStraddle equal to u_{max}. Then, we modify the above stated routine so that if it is testing for a straddling bridge of u_{max} along this path, it will stop if it encounters an edge with noStraddle equal to u_{max}. Also, the optimization will only set noStraddle equal to u_{max} on the portion of the path that is traversed. Finally, if noStraddle is set to a value other than NIL, the setting will be ignored and it will not be changed. Due to this optimization, we do not traverse a path more than once to find out whether a vertex on the path has a bridge that straddles u_{max}. This leaves two questions: 1) What if a future step must determine whether there is a straddling bridge of an ancestor of u_{max}? 2) What if a future step must determine whether there is a straddling bridge of a descendant of u_{max}? The condition described in the first question cannot occur because it would imply the ability to detect a straddling bridge now. The condition described by the second question may occur, but in the future step, the bicomp now being tested for a K_{3,3} will be part of a straddling bridge in that future step. Thus, the straddling bridge query is asked at most twice along any DFS tree path. ****************************************************************************/ int _TestForStraddlingBridge(graphP theGraph, K33SearchContext *context, int u_max) { isolatorContextP IC = theGraphIC(theGraph); int p, c, d, excludedChild, e; p = IC->v; excludedChild = gp_GetDFSChildFromBicompRoot(theGraph, IC->r); d = NIL; // Starting at V, traverse the ancestor path to u_max looking for a straddling bridge while (p > u_max) { // If we find a direct edge from p to an ancestor of u_max, the break. if (gp_GetVertexLeastAncestor(theGraph, p) < u_max) { d = p; break; } // Check for a path from p to an ancestor of u_max using the child of p // with the least Lowpoint, except the child that is an ancestor of X, Y and W. // It is possible to do this just using the sortedDFSChildList, but no point // in not using the separatedDFSChildList /* { int c = gp_GetVertexSortedDFSChildList(theGraph, p); while (gp_IsVertex(c)) { if (c != excludedChild && gp_IsSeparatedDFSChild(theGraph, c)) { if (gp_GetVertexLowpoint(theGraph, c) < u_max) break; } c = gp_GetVertexNextDFSChild(theGraph, p, c); } } */ c = context->VI[p].separatedDFSChildList; if (c == excludedChild) c = LCGetNext(context->separatedDFSChildLists, c, c); if (gp_IsVertex(theGraph, c) && gp_GetVertexLowpoint(theGraph, c) < u_max) { _FindUnembeddedEdgeToSubtree(theGraph, gp_GetVertexLowpoint(theGraph, c), c, &d); break; } // Check for noStraddle of u_max, break if found e = gp_GetFirstEdge(theGraph, p); if (context->E[e].noStraddle == u_max) break; // Go to the next ancestor excludedChild = p; p = gp_GetVertexParent(theGraph, p); } // If d is NIL, then no straddling bridge was found, so we do the noStraddle optimization. if (gp_IsNotVertex(theGraph, d)) { c = IC->v; while (c != p) { e = gp_GetFirstEdge(theGraph, c); if (gp_IsVertex(theGraph, context->E[e].noStraddle)) break; context->E[e].noStraddle = u_max; c = gp_GetVertexParent(theGraph, c); } } // Return either NIL indicating no bridge straddling u_max or the descendant d // used to help mark a straddling bridge that was found by this test. return d; } /**************************************************************************** _ReduceBicomp() We want to reduce the given biconnected component to a 4-cycle plus an internal edge connecting X and Y. Each edge is to be associated with a path from the original graph, preserving the depth first search tree paths that help connect the vertices R, X, Y, and W. If a K_{3,3} is later found, the paths are restored, but it is necessary to preserve the DFS tree so that functions like MarkDFSPath() will be able to pass through the restored bicomp. Also, if a K_{3,3} is later found due to the merge blocker optimization, then the internal X-Y path may be needed and, once the bicomp reduction is reversed, a full DFS subtree connecting all vertices in the bicomp will need to be restored or else functions that traverse the bicomp will not work. For example, _FindK33WithMergeBlocker() invokes ChooseTypeOfNonplanarityMinor() to help reconstruct the context under which the mergeBlocker was set. ChooseTypeOfNonplanarityMinor() calls _ClearAllVisitedFlagsInBicomp(), which depends on the DFS tree. NOTE: The following are some general steps taken in this method: 1) All edges in the bicomp are marked unvisited 2) selected paths are marked visited 3) unvisited edges are deleted 4) the edges of the bicomp are marked unvisited again 5) the remaining paths of the bicomp are reduced Some of the edges that get deleted in step 3 above may represent paths that were reduced in prior embedder iterations. We delete the reduction edge but not the path it represents. If a K_{3,3} is ever found, then the edges of these reduced paths are still in the graph, though not connected to anything important. The desired K_{3,3} is marked visited, but step 4 above ensures that these reduction paths are not marked visited. Hence, they will be deleted when the K_{3,3} is isolated, and this routine does not need to restore any reduced paths on the edges it deletes. We also don't (and don't have the time to) restore any reduction edges along the paths we intend to keep. ****************************************************************************/ int _ReduceBicomp(graphP theGraph, K33SearchContext *context, int R) { isolatorContextP IC = theGraphIC(theGraph); int min, max, A, A_edge, B, B_edge; int rxType, xwType, wyType, yrType, xyType; /* The vertices in the bicomp need to be oriented so that functions like MarkPathAlongBicompExtFace() will work. */ if (_OrientVerticesInBicomp(theGraph, R, 0) != OK) return NOTOK; /* The reduced edges start with a default type of 'tree' edge. The tests below, which identify the additional non-tree paths needed to complete the reduced bicomp, also identify which reduced edges need to be cycle edges.*/ rxType = xwType = wyType = yrType = xyType = EDGE_TYPE_PARENT; /* Now we calculate some values that help figure out the shape of the DFS subtree whose structure will be retained in the bicomp. */ min = MIN3(IC->x, IC->y, IC->w); max = MAX3(IC->x, IC->y, IC->w); // int mid = MAX3(MIN(IC->x, IC->y), MIN(IC->x, IC->w), MIN(IC->y, IC->w)); /* If the order of descendendancy from V goes first to X, then it can proceed either to W then Y or to Y then W */ if (min == IC->x) { /* A is a descendant adjacent to the current vertex by a cycle edge whose DFS tree path to either mid or max is combined with the cycle edge to form the path that will be reduced to the external face cycle edge (V, max). */ A_edge = gp_GetLastEdge(theGraph, IC->r); A = gp_GetNeighbor(theGraph, A_edge); yrType = EDGE_TYPE_BACK; /* If Y is max, then a path parallel to the X-Y path will be a second path reduced to a cycle edge. We find the neighbor B of min=X on the X-Y path. The edge (B, min) is a cycle edge that, along with the DFS tree path (B, ..., max), will be retained and reduced to a cycle edge. */ if (max == IC->y) { B_edge = gp_GetLastEdge(theGraph, IC->x); while (B_edge != gp_GetFirstEdge(theGraph, IC->x)) { if (gp_GetEdgeVisited(theGraph, B_edge)) break; B_edge = gp_GetPrevEdge(theGraph, B_edge); } if (!gp_GetEdgeVisited(theGraph, B_edge)) return NOTOK; B = gp_GetNeighbor(theGraph, B_edge); xyType = EDGE_TYPE_BACK; } /* Otherwise, W is max so we find the neighbor B of min=X on the lower external face path (X, ..., W), which excludes V. The cycle edge (B, min) and the DFS tree path (B, max) will be retained and reduced to a cycle edge.*/ else if (max == IC->w) { B_edge = gp_GetFirstEdge(theGraph, IC->x); B = gp_GetNeighbor(theGraph, B_edge); xwType = EDGE_TYPE_BACK; } else return NOTOK; } /* Otherwise, the order of descendancy from V goes first to Y, then it proceeds to either W then X or to X then W. The */ else { A_edge = gp_GetFirstEdge(theGraph, IC->r); A = gp_GetNeighbor(theGraph, A_edge); rxType = EDGE_TYPE_BACK; if (max == IC->x) { B_edge = gp_GetFirstEdge(theGraph, IC->y); while (B_edge != gp_GetLastEdge(theGraph, IC->y)) { if (gp_GetEdgeVisited(theGraph, B_edge)) break; B_edge = gp_GetNextEdge(theGraph, B_edge); } if (!gp_GetEdgeVisited(theGraph, B_edge)) return NOTOK; B = gp_GetNeighbor(theGraph, B_edge); xyType = EDGE_TYPE_BACK; } else if (max == IC->w) { B_edge = gp_GetLastEdge(theGraph, IC->y); B = gp_GetNeighbor(theGraph, B_edge); wyType = EDGE_TYPE_BACK; } else return NOTOK; } /* Now that we have collected the information on which cycle edge and which tree paths will actually be retained, we clear the visited flags so the current X-Y path will not be retained (an X-Y path formed mostly or entirely from DFS tree edges is retained). */ if (_ClearAllVisitedFlagsInBicomp(theGraph, R) != OK) return NOTOK; /* Now we mark the tree path from the maximum numbered vertex up to the bicomp root. This marks one of the following four paths: Case 1. (V, ..., X=min, ..., W=mid, ..., Y=max) Case 2. (V, ..., X=min, ..., Y=mid, ..., W=max) Case 3. (V, ..., Y=min, ..., W=mid, ..., X=max) Case 4. (V, ..., Y=min, ..., X=mid, ..., W=max) */ if (theGraph->functions->fpMarkDFSPath(theGraph, R, max) != OK) return NOTOK; /* Now we use A to mark a path on the external face corresponding to: Case 1. (V, ..., Y=max) Case 2. (V, ..., Y=mid) Case 3. (V, ..., X=max) Case 4. (V, ..., X=mid) */ if (theGraph->functions->fpMarkDFSPath(theGraph, min == IC->x ? IC->y : IC->x, A) != OK) return NOTOK; gp_SetEdgeVisited(theGraph, A_edge); gp_SetEdgeVisited(theGraph, gp_GetTwin(theGraph, A_edge)); /* Now we use B to mark either an X-Y path or a path of the external face corresponding to: Case 1. (X=min, ..., B, ..., Y=max) Case 2. (X=min, ..., B, ..., W=max) Case 3. (Y=min, ..., B, ..., X=max) Case 4. (Y=min, ..., B, ..., W=max) */ if (theGraph->functions->fpMarkDFSPath(theGraph, max, B) != OK) return NOTOK; gp_SetEdgeVisited(theGraph, B_edge); gp_SetEdgeVisited(theGraph, gp_GetTwin(theGraph, B_edge)); /* Delete the unmarked edges in the bicomp. Note that if an unmarked edge * represents a reduced path, then only the reduction edge is deleted here. * The path it represents is only deleted later (see NOTE above) */ if (_K33Search_DeleteUnmarkedEdgesInBicomp(theGraph, context, R) != OK) return NOTOK; /* Clear all visited flags in the bicomp. This is the important "step 4" mentioned in the NOTE above */ if (_ClearAllVisitedFlagsInBicomp(theGraph, R) != OK) return NOTOK; /* Clear all orientation signs in the bicomp. Note that the whole bicomp may not be properly oriented at this point because we may have exchanged external face paths for internal DFS tree paths. However, the reduced bicomp will be properly oriented, and the paths of degree 2 vertices will have their orientations fixed if/when reduction edges are restored. */ if (_ClearInvertedFlagsInBicomp(theGraph, R) != OK) return NOTOK; /* Reduce the paths to single edges. Note that although the whole bicomp may not be properly oriented at this point (as noted above), the four principal vertices R, X, W and Y still are consistently oriented with one another, e.g. R's link[0] indicates the external face path toward X that excludes W and Y, and X's link[1] indicates that same path. */ if (_ReduceExternalFacePathToEdge(theGraph, context, R, IC->x, rxType) != OK || _ReduceExternalFacePathToEdge(theGraph, context, IC->x, IC->w, xwType) != OK || _ReduceExternalFacePathToEdge(theGraph, context, IC->w, IC->y, wyType) != OK || _ReduceExternalFacePathToEdge(theGraph, context, IC->y, R, yrType) != OK) return NOTOK; if (_ReduceXYPathToEdge(theGraph, context, IC->x, IC->y, xyType) != OK) return NOTOK; return OK; } /******************************************************************** Edge deletion that occurs during a reduction or restoration of a reduction is augmented by clearing the K_{3,3} search-specific data members. This is augmentation is not needed in the delete edge operations that happen once a K_{3,3} homeomorph has been found and marked for isolation. ********************************************************************/ int _K33Search_DeleteEdge(graphP theGraph, K33SearchContext *context, int e) { _K33Search_InitEdgeRec(context, e); _K33Search_InitEdgeRec(context, gp_GetTwin(theGraph, e)); return gp_DeleteEdge(theGraph, e); } /******************************************************************** _K33Search_DeleteUnmarkedEdgesInBicomp() This function deletes from a given biconnected component all edges whose visited member is zero. The stack is used but preserved. In debug mode, NOTOK can result if there is a stack overflow. This method pushes at most one integer per vertex in the bicomp. This is the same as _DeleteUnmarkedEdgesInBicomp(), except it calls the overloaded _K33_DeleteEdge() rather than gp_DeleteEdge() Returns OK on success, NOTOK on implementation failure ********************************************************************/ int _K33Search_DeleteUnmarkedEdgesInBicomp(graphP theGraph, K33SearchContext *context, int BicompRoot) { int V, e, eNext; int stackBottom = sp_GetCurrentSize(theGraph->theStack); sp_Push(theGraph->theStack, BicompRoot); while (sp_GetCurrentSize(theGraph->theStack) > stackBottom) { sp_Pop(theGraph->theStack, V); e = gp_GetFirstEdge(theGraph, V); while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) sp_Push(theGraph->theStack, gp_GetNeighbor(theGraph, e)); eNext = gp_GetNextEdge(theGraph, e); if (!gp_GetEdgeVisited(theGraph, e)) _K33Search_DeleteEdge(theGraph, context, e); e = eNext; } } return OK; } /**************************************************************************** _ReduceExternalFacePathToEdge() ****************************************************************************/ int _ReduceExternalFacePathToEdge(graphP theGraph, K33SearchContext *context, int u, int x, int edgeType) { int prevLink, v, w, e; /* If the path is a single edge, then no need for a reduction */ prevLink = 1; v = _GetNeighborOnExtFace(theGraph, u, &prevLink); if (v == x) { gp_SetExtFaceVertex(theGraph, u, 0, x); gp_SetExtFaceVertex(theGraph, x, 1, u); return OK; } /* We have the endpoints u and x of the path, and we just computed the first vertex internal to the path and a neighbor of u. Now we compute the vertex internal to the path and a neighbor of x. */ prevLink = 0; w = _GetNeighborOnExtFace(theGraph, x, &prevLink); /* Delete the two edges that connect the path to the bicomp. If either edge is a reduction edge, then we have to restore the path it represents. We can only afford to visit the endpoints of the path. Note that in the restored path, the edge incident to each endpoint of the original path is a newly added edge, not a reduction edge. */ e = gp_GetFirstEdge(theGraph, u); // An edge e is a reduction edge if it has a pathConnector vertex set if (context->E[e].pathConnector != NIL) { if (_RestoreReducedPath(theGraph, context, e) != OK) return NOTOK; e = gp_GetFirstEdge(theGraph, u); v = gp_GetNeighbor(theGraph, e); } _K33Search_DeleteEdge(theGraph, context, e); e = gp_GetLastEdge(theGraph, x); // An edge e is a reduction edge if it has a pathConnector vertex set if (context->E[e].pathConnector != NIL) { if (_RestoreReducedPath(theGraph, context, e) != OK) return NOTOK; e = gp_GetLastEdge(theGraph, x); w = gp_GetNeighbor(theGraph, e); } _K33Search_DeleteEdge(theGraph, context, e); /* Add the reduction edge, then set its path connectors so the original path can be recovered and set the edge type so the essential structure of the DFS tree can be maintained (The 'Do X to Bicomp' functions and functions like MarkDFSPath(0 depend on this). */ gp_AddEdge(theGraph, u, 0, x, 1); e = gp_GetFirstEdge(theGraph, u); context->E[e].pathConnector = v; gp_SetEdgeType(theGraph, e, _ComputeEdgeRecordType(theGraph, u, x, edgeType)); e = gp_GetLastEdge(theGraph, x); context->E[e].pathConnector = w; gp_SetEdgeType(theGraph, e, _ComputeEdgeRecordType(theGraph, x, u, edgeType)); /* Set the external face info */ gp_SetExtFaceVertex(theGraph, u, 0, x); gp_SetExtFaceVertex(theGraph, x, 1, u); return OK; } /**************************************************************************** _ReduceXYPathToEdge() ****************************************************************************/ int _ReduceXYPathToEdge(graphP theGraph, K33SearchContext *context, int u, int x, int edgeType) { int e, v, w; e = gp_GetFirstEdge(theGraph, u); e = gp_GetNextEdge(theGraph, e); v = gp_GetNeighbor(theGraph, e); /* If the XY-path is a single edge, then no reduction is needed */ if (v == x) return OK; /* Otherwise, remove the two edges that join the XY-path to the bicomp */ // An edge e is a reduction edge if it has a pathConnector vertex set if (context->E[e].pathConnector != NIL) { if (_RestoreReducedPath(theGraph, context, e) != OK) return NOTOK; e = gp_GetFirstEdge(theGraph, u); e = gp_GetNextEdge(theGraph, e); v = gp_GetNeighbor(theGraph, e); } _K33Search_DeleteEdge(theGraph, context, e); e = gp_GetFirstEdge(theGraph, x); e = gp_GetNextEdge(theGraph, e); w = gp_GetNeighbor(theGraph, e); // An edge e is a reduction edge if it has a pathConnector vertex set if (context->E[e].pathConnector != NIL) { if (_RestoreReducedPath(theGraph, context, e) != OK) return NOTOK; e = gp_GetFirstEdge(theGraph, x); e = gp_GetNextEdge(theGraph, e); w = gp_GetNeighbor(theGraph, e); } _K33Search_DeleteEdge(theGraph, context, e); /* Now add a single edge to represent the XY-path */ gp_InsertEdge(theGraph, u, gp_GetFirstEdge(theGraph, u), 0, x, gp_GetFirstEdge(theGraph, x), 0); /* Now set up the path connectors so the original XY-path can be recovered if needed. Also, set the reduction edge's type to preserve the DFS tree structure */ e = gp_GetFirstEdge(theGraph, u); e = gp_GetNextEdge(theGraph, e); context->E[e].pathConnector = v; gp_SetEdgeType(theGraph, e, _ComputeEdgeRecordType(theGraph, u, x, edgeType)); e = gp_GetFirstEdge(theGraph, x); e = gp_GetNextEdge(theGraph, e); context->E[e].pathConnector = w; gp_SetEdgeType(theGraph, e, _ComputeEdgeRecordType(theGraph, x, u, edgeType)); return OK; } /**************************************************************************** _RestoreReducedPath() Given an edge record of an edge used to reduce a path, we want to restore the path in constant time. The path may contain more reduction edges internally, but we do not search for and process those since it would violate the constant time bound required of this function. return OK on success, NOTOK on failure ****************************************************************************/ int _RestoreReducedPath(graphP theGraph, K33SearchContext *context, int e) { int eTwin, u, v, w, x; int e0, e1, eTwin0, eTwin1; // Edge e does not represent a reducible path unless it has a // pathConnect vertex (i.e., a non-NIL value indicating the vertex) if (context->E[e].pathConnector == NIL) return OK; eTwin = gp_GetTwin(theGraph, e); u = gp_GetNeighbor(theGraph, eTwin); v = context->E[e].pathConnector; w = context->E[eTwin].pathConnector; x = gp_GetNeighbor(theGraph, e); /* Get the locations of the edge records between which the new edge records must be added in order to reconnect the path parallel to the edge. */ e0 = gp_GetNextEdge(theGraph, e); e1 = gp_GetPrevEdge(theGraph, e); eTwin0 = gp_GetNextEdge(theGraph, eTwin); eTwin1 = gp_GetPrevEdge(theGraph, eTwin); /* We first delete the edge represented by e and eTwin. We do so before restoring the path to ensure we do not exceed the maximum edge capacity. */ _K33Search_DeleteEdge(theGraph, context, e); /* Now we add the two edges to reconnect the reduced path represented by the edge [e, eTwin]. The edge record in u is added between e0 and e1. Likewise, the new edge record in x is added between eTwin0 and eTwin1. */ if (gp_IsEdge(theGraph, e0)) { if (gp_InsertEdge(theGraph, u, e0, 1, v, NIL, 0) != OK) return NOTOK; } else { if (gp_InsertEdge(theGraph, u, e1, 0, v, NIL, 0) != OK) return NOTOK; } if (gp_IsEdge(theGraph, eTwin0)) { if (gp_InsertEdge(theGraph, x, eTwin0, 1, w, NIL, 0) != OK) return NOTOK; } else { if (gp_InsertEdge(theGraph, x, eTwin1, 0, w, NIL, 0) != OK) return NOTOK; } // Set the types of the newly added edges. In both cases, the first of the two // vertex parameters is known to be degree 2 because they are internal to the // path being restored, so this operation is constant time. if (_RestoreEdgeType(theGraph, v, u) != OK || _RestoreEdgeType(theGraph, w, x) != OK) return NOTOK; return OK; } /**************************************************************************** _RestoreAndOrientReducedPaths() This function searches the embedding for any edges that are specially marked as being representative of a path that was previously reduced to a single edge by _ReduceBicomp(). The edge is replaced by the path. Note that the new path may contain more reduction edges, and these will be iteratively expanded by the outer for loop. If the edge records of an edge being expanded are the first or last edges of the edge's vertex endpoints, then the edge may be along the external face. If so, then the vertices along the path being restored must be given a consistent orientation with the endpoints. It is expected that the embedding will have been oriented prior to this operation. ****************************************************************************/ int _RestoreAndOrientReducedPaths(graphP theGraph, K33SearchContext *context) { int e, eTwin, u, v, w, x, visited; int e0, eTwin0, e1, eTwin1; for (e = gp_LowerBoundEdges(theGraph); e < gp_UpperBoundEdges(theGraph);) { // An edge e is a reduction edge if it has a pathConnector vertex set if (context->E[e].pathConnector != NIL) { visited = gp_GetEdgeVisited(theGraph, e); eTwin = gp_GetTwin(theGraph, e); u = gp_GetNeighbor(theGraph, eTwin); v = context->E[e].pathConnector; w = context->E[eTwin].pathConnector; x = gp_GetNeighbor(theGraph, e); /* Now we need the predecessor and successor edge records of e and eTwin. The edge (u, v) will be inserted so that the record in u's adjacency list that indicates v will be between e0 and e1. Likewise, the edge record (x -> w) will be placed between eTwin0 and eTwin1. */ e0 = gp_GetNextEdge(theGraph, e); e1 = gp_GetPrevEdge(theGraph, e); eTwin0 = gp_GetNextEdge(theGraph, eTwin); eTwin1 = gp_GetPrevEdge(theGraph, eTwin); /* We first delete the edge represented by e and eTwin. We do so before restoring the path to ensure we do not exceed the maximum edge capacity. */ _K33Search_DeleteEdge(theGraph, context, e); /* Now we add the two edges to reconnect the reduced path represented by the edge [e, eTwin]. The edge record in u is added between e0 and e1. Likewise, the new edge record in x is added between eTwin0 and eTwin1. */ if (gp_IsEdge(theGraph, e0)) { if (gp_InsertEdge(theGraph, u, e0, 1, v, NIL, 0) != OK) return NOTOK; } else { if (gp_InsertEdge(theGraph, u, e1, 0, v, NIL, 0) != OK) return NOTOK; } if (gp_IsEdge(theGraph, eTwin0)) { if (gp_InsertEdge(theGraph, x, eTwin0, 1, w, NIL, 0) != OK) return NOTOK; } else { if (gp_InsertEdge(theGraph, x, eTwin1, 0, w, NIL, 0) != OK) return NOTOK; } /* Set the types of the newly added edges */ if (_RestoreEdgeType(theGraph, u, v) != OK || _RestoreEdgeType(theGraph, w, x) != OK) return NOTOK; /* We determine whether the reduction edge may be on the external face, in which case we will need to ensure that the vertices on the path being restored are consistently oriented. This will accommodate future invocations of MarkPathAlongBicompExtFace(). Note: If e0, e1, eTwin0 or eTwin1 is not an edge, then it is because we've walked off the end of the edge record list, which happens when e and eTwin are either the first or last edge of the containing vertex. In turn, the first and last edges of a vertex are the ones that hold it onto the external face, if it is on the external face. */ if ((gp_IsNotEdge(theGraph, e0) && gp_IsNotEdge(theGraph, eTwin1)) || (gp_IsNotEdge(theGraph, e1) && gp_IsNotEdge(theGraph, eTwin0))) { if (_OrientExternalFacePath(theGraph, u, v, w, x) != OK) return NOTOK; } /* The internal XY path was already marked as part of the decision logic that made us decide we could find a K_{3,3} and hence that we should reverse all of the reductions. Subsequent code counts on the fact that the X-Y path is already marked, so if we replace a marked edge with a path, then we need to mark the path. Similarly, for an unmarked edge, the replacement path should be unmarked. */ if (visited) { if (_SetAllVisitedFlagsOnPath(theGraph, u, v, w, x) != OK) return NOTOK; } else { if (_ClearAllVisitedFlagsOnPath(theGraph, u, v, w, x) != OK) return NOTOK; } } else e += 2; } return OK; } /**************************************************************************** _MarkStraddlingBridgePath() ****************************************************************************/ int _MarkStraddlingBridgePath(graphP theGraph, int u_min, int u_max, int u_d, int d) { isolatorContextP IC = theGraphIC(theGraph); int p, e; /* Find the point of intersection p between the path (v ... u_max) and the path (d ... u_max). */ if (theGraph->functions->fpMarkDFSPath(theGraph, u_max, IC->r) != OK) return NOTOK; p = d; while (!gp_GetVisited(theGraph, p)) { gp_SetVisited(theGraph, p); e = gp_GetFirstEdge(theGraph, p); while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_PARENT) break; e = gp_GetNextEdge(theGraph, e); } gp_SetEdgeVisited(theGraph, e); gp_SetEdgeVisited(theGraph, gp_GetTwin(theGraph, e)); p = gp_GetNeighbor(theGraph, e); /* If p is a root copy, mark it visited and skip to the parent copy */ if (gp_IsVirtualVertex(theGraph, p)) { gp_SetVisited(theGraph, p); p = gp_GetVertexFromBicompRoot(theGraph, p); } } /* Unmark the path (p ... u_max), which was marked to help find p. The path from v to u_{max} is not needed to form a K_{3,3} except for the portion of the path up to p that, with the straddling bridge path, comprises part of the connection to u_d. In the minor, the path between v and p is edge contracted. */ while (p != u_max) { e = gp_GetFirstEdge(theGraph, p); while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_PARENT) break; e = gp_GetNextEdge(theGraph, e); } gp_ClearEdgeVisited(theGraph, e); gp_ClearEdgeVisited(theGraph, gp_GetTwin(theGraph, e)); p = gp_GetNeighbor(theGraph, e); gp_ClearVisited(theGraph, p); /* If p is a root copy, clear its visited flag and skip to the parent copy */ if (gp_IsVirtualVertex(theGraph, p)) { p = gp_GetVertexFromBicompRoot(theGraph, p); gp_ClearVisited(theGraph, p); } } /* The straddling bridge must join the path (u_max ... u_min). If u_d is an ancestor of u_min, then mark the path that joins u_d to u_min. */ if (u_d < u_min) if (theGraph->functions->fpMarkDFSPath(theGraph, u_d, u_min) != OK) return NOTOK; return OK; } /**************************************************************************** _IsolateMinorE5() The paths (x, w), (y, w) and (v, u_{max}) are not needed. The x-y path and the internal w-z path are already marked. ****************************************************************************/ int _IsolateMinorE5(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); if (_MarkPathAlongBicompExtFace(theGraph, IC->r, IC->x) != OK || _MarkPathAlongBicompExtFace(theGraph, IC->y, IC->r) != OK || theGraph->functions->fpMarkDFSPath(theGraph, MIN3(IC->ux, IC->uy, IC->uz), MAX3(IC->ux, IC->uy, IC->uz)) != OK || _MarkDFSPathsToDescendants(theGraph) != OK || _JoinBicomps(theGraph) != OK || _AddAndMarkUnembeddedEdges(theGraph) != OK) return NOTOK; return OK; } /**************************************************************************** _IsolateMinorE6() The paths (x, y), (v, w) and (v, u_{max}) are not needed. The path through the straddling bridge that connects from an ancestor of u_{max} to v is required, but it may connect to an ancestor p of v. In such a case, the path (v, p) is required, while (p, u_{max}) is not. ****************************************************************************/ int _IsolateMinorE6(graphP theGraph, K33SearchContext *context) { isolatorContextP IC = theGraphIC(theGraph); int u_min, u_max, d, u_d; /* Clear the previously marked x-y path */ if (_ClearAllVisitedFlagsInBicomp(theGraph, IC->r) != OK) return NOTOK; /* Clear dw to stop the marking of path (v, w) */ IC->dw = NIL; /* Mark (v, ..., x, ..., w, ..., y, ... v) */ if (_MarkPathAlongBicompExtFace(theGraph, IC->r, IC->r) != OK) return NOTOK; /* Mark the path through the straddling bridge (except for the final edge (u_d, d) which is added last by convention). */ u_min = MIN3(IC->ux, IC->uy, IC->uz); u_max = MAX3(IC->ux, IC->uy, IC->uz); d = _TestForStraddlingBridge(theGraph, context, u_max); u_d = gp_GetVertexLeastAncestor(theGraph, d); if (_MarkStraddlingBridgePath(theGraph, u_min, u_max, u_d, d) != OK) return NOTOK; /* Make the final markings and edge additions */ if (theGraph->functions->fpMarkDFSPath(theGraph, u_min, u_max) != OK || _MarkDFSPathsToDescendants(theGraph) != OK || _JoinBicomps(theGraph) != OK || _AddAndMarkUnembeddedEdges(theGraph) != OK || _AddAndMarkEdge(theGraph, u_d, d) != OK) return NOTOK; return OK; } /**************************************************************************** _IsolateMinorE7() ****************************************************************************/ int _IsolateMinorE7(graphP theGraph, K33SearchContext *context) { isolatorContextP IC = theGraphIC(theGraph); int u_min, u_max, d, u_d; /* Mark the appropriate two portions of the external face depending on symmetry condition */ if (IC->uy < IC->ux) { if (_MarkPathAlongBicompExtFace(theGraph, IC->r, IC->x) != OK || _MarkPathAlongBicompExtFace(theGraph, IC->w, IC->y) != OK) return NOTOK; } else { if (_MarkPathAlongBicompExtFace(theGraph, IC->x, IC->w) != OK || _MarkPathAlongBicompExtFace(theGraph, IC->y, IC->r) != OK) return NOTOK; } /* Mark the path through the straddling bridge (except for the final edge (u_d, d) which is added last by convention). */ u_min = MIN3(IC->ux, IC->uy, IC->uz); u_max = MAX3(IC->ux, IC->uy, IC->uz); d = _TestForStraddlingBridge(theGraph, context, u_max); u_d = gp_GetVertexLeastAncestor(theGraph, d); if (_MarkStraddlingBridgePath(theGraph, u_min, u_max, u_d, d) != OK) return NOTOK; /* Make the final markings and edge additions */ if (theGraph->functions->fpMarkDFSPath(theGraph, u_min, u_max) != OK || _MarkDFSPathsToDescendants(theGraph) != OK || _JoinBicomps(theGraph) != OK || _AddAndMarkUnembeddedEdges(theGraph) != OK || _AddAndMarkEdge(theGraph, u_d, d) != OK) return NOTOK; return OK; } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/homeomorphSearch/graphK33Search.h000066400000000000000000000011141522057144000314550ustar00rootroot00000000000000#ifndef GRAPH_K33SEARCH_H #define GRAPH_K33SEARCH_H /* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "../planarityRelated/graphPlanarity.h" #ifdef __cplusplus extern "C" { #endif // Create a K33Search Graph, i.e., subclass a Planarity Graph by extending it with // the ability to perform a search for a subgraph homeomorphic to K_{3,3}. #define K33SEARCH_NAME "K33Search" int gp_ExtendWith_K33Search(graphP theGraph); int gp_Detach_K33Search(graphP theGraph); #ifdef __cplusplus } #endif #endif graph-algorithms-planarity-08d7b51/planarity/c/graphLib/homeomorphSearch/graphK33Search.private.h000066400000000000000000000027171522057144000331400ustar00rootroot00000000000000#ifndef GRAPH_K33SEARCH_PRIVATE_H #define GRAPH_K33SEARCH_PRIVATE_H /* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "../planarityRelated/graphPlanarity.private.h" #ifdef __cplusplus extern "C" { #endif // Additional equipment for each EdgeRec typedef struct { int noStraddle, pathConnector; } K33Search_EdgeRec; typedef K33Search_EdgeRec *K33Search_EdgeRecP; // Additional equipment for each vertex (non-virtual only) typedef struct { int separatedDFSChildList, backEdgeList, mergeBlocker; } K33Search_VertexInfo; typedef K33Search_VertexInfo *K33Search_VertexInfoP; typedef struct { // Helps distinguish initialize from re-initialize int initialized; // The graph that this context augments graphP theGraph; // Parallel array for additional edge level equipment K33Search_EdgeRecP E; // Parallel array for additional vertex info level equipment K33Search_VertexInfoP VI; // Storage for the separatedDFSChildLists, and // to help with linear time sorting of same by lowpoints listCollectionP separatedDFSChildLists; int *buckets; listCollectionP bin; // Overloaded function pointers graphFunctionTableStruct functions; } K33SearchContext; extern int K33SEARCH_ID; #ifdef __cplusplus } #endif #endif graph-algorithms-planarity-08d7b51/planarity/c/graphLib/homeomorphSearch/graphK33Search_Extensions.c000066400000000000000000000756331522057144000337100ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include #include "graphK33Search.h" #include "graphK33Search.private.h" // Need to save and restore a graph flag related to IO #include "../io/graphIO.h" extern int _SearchForMergeBlocker(graphP theGraph, K33SearchContext *context, int v, int *pMergeBlocker); extern int _FindK33WithMergeBlocker(graphP theGraph, K33SearchContext *context, int v, int mergeBlocker); extern int _SearchForK33InBicomp(graphP theGraph, K33SearchContext *context, int v, int R); extern int _TestForK33GraphObstruction(graphP theGraph, int *degrees, int *imageVerts); extern int _getImageVertices(graphP theGraph, int *degrees, int maxDegree, int *imageVerts, int maxNumImageVerts); extern int _TestSubgraph(graphP theSubgraph, graphP theGraph); /* Forward declarations of local functions */ void _K33Search_ClearStructures(K33SearchContext *context); int _K33Search_CreateStructures(K33SearchContext *context); int _K33Search_InitStructures(K33SearchContext *context); void _K33Search_InitEdgeRec(K33SearchContext *context, int e); void _K33Search_InitVertexInfo(K33SearchContext *context, int v); /* Forward declarations of overloading functions */ int _K33Search_EmbeddingInitialize(graphP theGraph); void _CreateBackEdgeLists(graphP theGraph, K33SearchContext *context); void _CreateSeparatedDFSChildLists(graphP theGraph, K33SearchContext *context); void _K33Search_EmbedBackEdgeToDescendant(graphP theGraph, int RootSide, int RootVertex, int W, int WPrevLink); int _K33Search_MergeBicomps(graphP theGraph, int v, int RootVertex, int W, int WPrevLink); void _K33Search_MergeVertex(graphP theGraph, int W, int WPrevLink, int R); int _K33Search_HandleBlockedBicomp(graphP theGraph, int v, int RootVertex, int R); int _K33Search_EmbedPostprocess(graphP theGraph, int v, int edgeEmbeddingResult); int _K33Search_CheckEmbeddingIntegrity(graphP theGraph, graphP origGraph); int _K33Search_CheckObstructionIntegrity(graphP theGraph, graphP origGraph); int _K33Search_EnsureVertexCapacity(graphP theGraph, int N); void _K33Search_ResetGraphStorage(graphP theGraph); int _K33Search_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity); /* Forward declarations of functions used by the extension system */ void *_K33Search_DupContext(void *pContext, void *theGraph); int _K33Search_CopyData(void *dstContext, void *srcContext); void _K33Search_FreeContext(void *); /**************************************************************************** * K33SEARCH_ID - the variable used to hold the integer identifier for this * extension, enabling this feature's extension context to be distinguished * from other features' extension contexts that may be attached to a graph. ****************************************************************************/ int K33SEARCH_ID = 0; /**************************************************************************** gp_ExtendWith_K33Search() This function adjusts the graph data structure to attach the K3,3 search feature. ****************************************************************************/ int gp_ExtendWith_K33Search(graphP theGraph) { K33SearchContext *context = NULL; if (theGraph == NULL || gp_GetN(theGraph) <= 0) return NOTOK; // If the K3,3 search feature has already been attached to the graph, // then there is no need to attach it again gp_FindExtension(theGraph, K33SEARCH_ID, (void *)&context); if (context != NULL) { return OK; } // Ensure theGraph is a Planarity Graph if (gp_ExtendWith_Planarity(theGraph) != OK) return NOTOK; // Allocate a new extension context context = (K33SearchContext *)malloc(sizeof(K33SearchContext)); if (context == NULL) { return NOTOK; } // First, tell the context that it is not initialized context->initialized = 0; // Save a pointer to theGraph in the context context->theGraph = theGraph; // Put the overload functions into the context function table. // gp_AddExtension will overload the graph's functions with these, and // return the base function pointers in the context function table memset(&context->functions, 0, sizeof(graphFunctionTableStruct)); context->functions.fpEmbeddingInitialize = _K33Search_EmbeddingInitialize; context->functions.fpEmbedBackEdgeToDescendant = _K33Search_EmbedBackEdgeToDescendant; context->functions.fpMergeBicomps = _K33Search_MergeBicomps; context->functions.fpMergeVertex = _K33Search_MergeVertex; context->functions.fpHandleBlockedBicomp = _K33Search_HandleBlockedBicomp; context->functions.fpEmbedPostprocess = _K33Search_EmbedPostprocess; context->functions.fpCheckEmbeddingIntegrity = _K33Search_CheckEmbeddingIntegrity; context->functions.fpCheckObstructionIntegrity = _K33Search_CheckObstructionIntegrity; context->functions.fpEnsureVertexCapacity = _K33Search_EnsureVertexCapacity; context->functions.fpResetGraphStorage = _K33Search_ResetGraphStorage; context->functions.fpEnsureEdgeCapacity = _K33Search_EnsureEdgeCapacity; _K33Search_ClearStructures(context); // Store the K33 search context, including the data structure and the // function pointers, as an extension of the graph if (gp_AddExtension(theGraph, &K33SEARCH_ID, (void *)context, _K33Search_DupContext, _K33Search_CopyData, _K33Search_FreeContext, &context->functions) != OK) { _K33Search_FreeContext(context); context = NULL; return NOTOK; } // Create the K33-specific structures if the size of the graph is known // Attach functions are always invoked after gp_New(), but if a graph // extension must be attached before gp_Read(), then the attachment // also happens before gp_EnsureVertexCapacity(), which means N==0. // However, a feature can be attached after gp_EnsureVertexCapacity(), // in which case there is extra work to do when N > 0. if (gp_GetN(theGraph) > 0) { if (_K33Search_CreateStructures(context) != OK || _K33Search_InitStructures(context) != OK) { _K33Search_FreeContext(context); context = NULL; return NOTOK; } } return OK; } /******************************************************************** gp_Detach_K33Search() ********************************************************************/ int gp_Detach_K33Search(graphP theGraph) { return gp_RemoveExtension(theGraph, K33SEARCH_ID); } /******************************************************************** _K33Search_ClearStructures() ********************************************************************/ void _K33Search_ClearStructures(K33SearchContext *context) { if (!context->initialized) { // Before initialization, the pointers are stray, not NULL // Once NULL or allocated, free() or LCFree() can do the job context->E = NULL; context->VI = NULL; context->separatedDFSChildLists = NULL; context->buckets = NULL; context->bin = NULL; context->initialized = 1; } else { if (context->E != NULL) { free(context->E); context->E = NULL; } if (context->VI != NULL) { free(context->VI); context->VI = NULL; } LCFree(&context->separatedDFSChildLists); if (context->buckets != NULL) { free(context->buckets); context->buckets = NULL; } LCFree(&context->bin); } } /******************************************************************** _K33Search_CreateStructures() Create uninitialized structures for the vertex and edge levels, and initialized structures for the graph level ********************************************************************/ int _K33Search_CreateStructures(K33SearchContext *context) { int VIsize = gp_UpperBoundVertices(context->theGraph); int Esize = gp_UpperBoundEdgeStorage(context->theGraph); if (gp_GetN(context->theGraph) <= 0) return NOTOK; if ((context->E = (K33Search_EdgeRecP)malloc(Esize * sizeof(K33Search_EdgeRec))) == NULL || (context->VI = (K33Search_VertexInfoP)malloc(VIsize * sizeof(K33Search_VertexInfo))) == NULL || (context->separatedDFSChildLists = LCNew(VIsize)) == NULL || (context->buckets = (int *)malloc(VIsize * sizeof(int))) == NULL || (context->bin = LCNew(VIsize)) == NULL) { return NOTOK; } return OK; } /******************************************************************** _K33Search_InitStructures() ********************************************************************/ int _K33Search_InitStructures(K33SearchContext *context) { memset(context->VI, NIL_CHAR, gp_UpperBoundVertices(context->theGraph) * sizeof(K33Search_VertexInfo)); memset(context->E, NIL_CHAR, gp_UpperBoundEdgeStorage(context->theGraph) * sizeof(K33Search_EdgeRec)); return OK; } /******************************************************************** ********************************************************************/ int _K33Search_EnsureVertexCapacity(graphP theGraph, int N) { K33SearchContext *context = NULL; gp_FindExtension(theGraph, K33SEARCH_ID, (void *)&context); if (context == NULL) { return NOTOK; } theGraph->N = N; theGraph->NV = N; if (theGraph->edgeCapacity == 0) theGraph->edgeCapacity = DEFAULT_EDGE_CAPACITY_FACTOR * N; if (_K33Search_CreateStructures(context) != OK || _K33Search_InitStructures(context) != OK) return NOTOK; context->functions.fpEnsureVertexCapacity(theGraph, N); return OK; } /******************************************************************** ********************************************************************/ void _K33Search_ResetGraphStorage(graphP theGraph) { K33SearchContext *context = NULL; gp_FindExtension(theGraph, K33SEARCH_ID, (void *)&context); if (context != NULL) { // Reset the graph storage in base class(es) context->functions.fpResetGraphStorage(theGraph); // Do the reset that is specific to this module _K33Search_InitStructures(context); LCReset(context->separatedDFSChildLists); LCReset(context->bin); } } /******************************************************************** _K33Search_EnsureEdgeCapacity() ********************************************************************/ int _K33Search_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity) { K33SearchContext *context = NULL; K33Search_EdgeRecP oldE = NULL, newE = NULL; int oldEsize = gp_UpperBoundEdgeStorage(theGraph), newEsize = 0; // If the requirement is already satisfied, then no work to do if (gp_GetEdgeCapacity(theGraph) >= requiredEdgeCapacity) return OK; // Get the graph's extension context so we can work on it gp_FindExtension(theGraph, K33SEARCH_ID, (void *)&context); if (context == NULL) return NOTOK; // Call the superclass function to make sure lower levels of parallel // edge arrays can successfully meet the new capacity requirement if (context->functions.fpEnsureEdgeCapacity(theGraph, requiredEdgeCapacity) != OK) return NOTOK; // Save the current E so it can be freed once we replace it oldE = context->E; // The superclass EnsureEdgeCapacity method succeeded, so the graph's // new edge capacity is already set, which means we the upper bound of // the graph's edge storage gives the new parallel array size we need. newEsize = gp_UpperBoundEdgeStorage(theGraph); // We must successfully allocate the new parallel edge array newE = (K33Search_EdgeRecP)malloc(newEsize * sizeof(K33Search_EdgeRec)); if (newE == NULL) return NOTOK; // Clear all new edge records memset(newE, NIL_CHAR, newEsize * sizeof(K33Search_EdgeRec)); // Copy the old edge records to the new edge records memcpy(newE, oldE, oldEsize * sizeof(K33Search_EdgeRec)); // Set the new edge array into the context and free the old one context->E = newE; free(oldE); return OK; } /******************************************************************** _K33Search_DupContext() ********************************************************************/ void *_K33Search_DupContext(void *pContext, void *theGraph) { K33SearchContext *context = (K33SearchContext *)pContext; K33SearchContext *newContext = (K33SearchContext *)malloc(sizeof(K33SearchContext)); if (newContext != NULL) { int VIsize = gp_UpperBoundVertices((graphP)theGraph); int Esize = gp_UpperBoundEdgeStorage((graphP)theGraph); *newContext = *context; newContext->theGraph = (graphP)theGraph; newContext->initialized = 0; _K33Search_ClearStructures(newContext); if (((graphP)theGraph)->N > 0) { #ifdef INCLUDE_K33SEARCH_EMBEDDER if (_K33Search_TestForEOTreeChildren(context->associatedEONode) == TRUE) { ErrorMessage("_K33Search_DupContext(): Duplicating an embedding obstruction tree is unsupported.\n"); _K33Search_FreeContext(newContext); return NULL; } #endif if (_K33Search_CreateStructures(newContext) != OK) { _K33Search_FreeContext(newContext); newContext = NULL; return NULL; } memcpy(newContext->E, context->E, Esize * sizeof(K33Search_EdgeRec)); memcpy(newContext->VI, context->VI, VIsize * sizeof(K33Search_VertexInfo)); LCCopy(newContext->separatedDFSChildLists, context->separatedDFSChildLists); } } return newContext; } /******************************************************************** _K33Search_CopyData() ********************************************************************/ int _K33Search_CopyData(void *dstContext, void *srcContext) { K33SearchContext *dstK33Context = (K33SearchContext *)dstContext; K33SearchContext *srcK33Context = (K33SearchContext *)srcContext; int dstEdgeStorage, srcEdgeStorage; if (dstContext == NULL) return NOTOK; // If the srcContext is NULL, then the caller wants the data // structures in the dstContext to be reset/reinitialized if (srcContext == NULL) return _K33Search_InitStructures(dstK33Context); // ELSE: If there is also a srcContext, then we copy data from it dstEdgeStorage = gp_UpperBoundEdgeStorage(dstK33Context->theGraph); srcEdgeStorage = gp_UpperBoundEdgeStorage(srcK33Context->theGraph); // The caller (ultimately gp_CopyGraph()) is responsible for making sure that the // destination graph has enough edge capacity to receive the source graph content if (dstEdgeStorage < srcEdgeStorage) return NOTOK; // If the destination graph has more edge capacity, then we make sure that the // extra edge capacity is reinitialized if (dstEdgeStorage > srcEdgeStorage) { memset(dstK33Context->E, NIL_CHAR, gp_UpperBoundEdgeStorage(dstK33Context->theGraph) * sizeof(K33Search_EdgeRec)); } memcpy(dstK33Context->E, srcK33Context->E, gp_UpperBoundEdgeStorage(dstK33Context->theGraph) * sizeof(K33Search_EdgeRec)); memcpy(dstK33Context->VI, srcK33Context->VI, gp_UpperBoundVertices(dstK33Context->theGraph) * sizeof(K33Search_VertexInfo)); return OK; } /******************************************************************** _K33Search_FreeContext() ********************************************************************/ void _K33Search_FreeContext(void *pContext) { K33SearchContext *context = (K33SearchContext *)pContext; _K33Search_ClearStructures(context); free(pContext); } /******************************************************************** _K33Search_EmbeddingInitialize() This method overloads the embedding initialization phase of the core planarity algorithm to provide post-processing that creates the back edges list and separated DFS child list (sorted by lowpoint) for each vertex. ********************************************************************/ int _K33Search_EmbeddingInitialize(graphP theGraph) { K33SearchContext *context = NULL; gp_FindExtension(theGraph, K33SEARCH_ID, (void *)&context); if (context != NULL) { if (context->functions.fpEmbeddingInitialize(theGraph) != OK) return NOTOK; if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK33) { _CreateBackEdgeLists(theGraph, context); _CreateSeparatedDFSChildLists(theGraph, context); } return OK; } return NOTOK; } /******************************************************************** _CreateBackEdgeLists() ********************************************************************/ void _CreateBackEdgeLists(graphP theGraph, K33SearchContext *context) { int v, e, eTwin, ancestor; for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { e = gp_GetVertexFwdEdgeList(theGraph, v); while (gp_IsEdge(theGraph, e)) { // Get the ancestor endpoint and the associated back edge record ancestor = gp_GetNeighbor(theGraph, e); eTwin = gp_GetTwin(theGraph, e); // Put it into the back edge list of the ancestor if (gp_IsNotEdge(theGraph, context->VI[ancestor].backEdgeList)) { context->VI[ancestor].backEdgeList = eTwin; gp_SetPrevEdge(theGraph, eTwin, eTwin); gp_SetNextEdge(theGraph, eTwin, eTwin); } else { int eHead = context->VI[ancestor].backEdgeList; int eTail = gp_GetPrevEdge(theGraph, eHead); gp_SetPrevEdge(theGraph, eTwin, eTail); gp_SetNextEdge(theGraph, eTwin, eHead); gp_SetPrevEdge(theGraph, eHead, eTwin); gp_SetNextEdge(theGraph, eTail, eTwin); } // Advance to the next forward edge record of v (or NIL if done) e = gp_GetNextEdge(theGraph, e); if (e == gp_GetVertexFwdEdgeList(theGraph, v)) e = NIL; } } } /******************************************************************** _CreateSeparatedDFSChildLists() Each vertex gets a list of its DFS children, sorted by lowpoint. ********************************************************************/ void _CreateSeparatedDFSChildLists(graphP theGraph, K33SearchContext *context) { int *buckets; listCollectionP bin; int v, L, DFSParent, theList; buckets = context->buckets; bin = context->bin; // Initialize the bin and all the buckets to be empty LCReset(bin); for (L = gp_LowerBoundVertices(theGraph); L < gp_UpperBoundVertices(theGraph); L++) buckets[L] = NIL; // For each vertex, add it to the bucket whose index is equal to the lowpoint of the vertex. for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { L = gp_GetVertexLowpoint(theGraph, v); buckets[L] = LCAppend(bin, buckets[L], v); } // For each bucket, add each vertex in the bucket to the separatedDFSChildList of its DFSParent. // Since lower numbered buckets are processed before higher numbered buckets, vertices with lower // lowpoint values are added before those with higher lowpoint values, so the separatedDFSChildList // of each vertex is sorted by lowpoint for (L = gp_LowerBoundVertices(theGraph); L < gp_UpperBoundVertices(theGraph); L++) { v = buckets[L]; // Loop through all the vertices with lowpoint L, putting each in the list of its parent while (gp_IsVertex(theGraph, v)) { DFSParent = gp_GetVertexParent(theGraph, v); if (gp_IsVertex(theGraph, DFSParent) && DFSParent != v) { theList = context->VI[DFSParent].separatedDFSChildList; theList = LCAppend(context->separatedDFSChildLists, theList, v); context->VI[DFSParent].separatedDFSChildList = theList; } v = LCGetNext(bin, buckets[L], v); } } } /******************************************************************** _K33Search_EmbedBackEdgeToDescendant() The forward and back edge records of a back edge (cycle edge, co-tree edge, etc.) are embedded by the planarity version of this function. For K_{3,3} subgraph homeomorphism, we also maintain the list of unembedded back edges, so we need to remove the back edge from that list since it is now being put back into the adjacency list. ********************************************************************/ void _K33Search_EmbedBackEdgeToDescendant(graphP theGraph, int RootSide, int RootVertex, int W, int WPrevLink) { K33SearchContext *context = NULL; gp_FindExtension(theGraph, K33SEARCH_ID, (void *)&context); if (context != NULL) { // K33 search may have been attached, but not enabled if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK33) { // Get the forward edge record from the adjacentTo field, and // use it to get the back edge record int backEdgeRec = gp_GetTwin(theGraph, gp_GetVertexPertinentEdge(theGraph, W)); // Remove the backEdgeRecfrom the backEdgeList if (context->VI[W].backEdgeList == backEdgeRec) { if (gp_GetNextEdge(theGraph, backEdgeRec) == backEdgeRec) context->VI[W].backEdgeList = NIL; else context->VI[W].backEdgeList = gp_GetNextEdge(theGraph, backEdgeRec); } gp_SetNextEdge(theGraph, gp_GetPrevEdge(theGraph, backEdgeRec), gp_GetNextEdge(theGraph, backEdgeRec)); gp_SetPrevEdge(theGraph, gp_GetNextEdge(theGraph, backEdgeRec), gp_GetPrevEdge(theGraph, backEdgeRec)); } // Invoke the superclass version of the function context->functions.fpEmbedBackEdgeToDescendant(theGraph, RootSide, RootVertex, W, WPrevLink); } } /******************************************************************** This override of _MergeBicomps() detects a special merge block that indicates a K3,3 can be found. The merge blocker is an optimization needed for one case for which detecting a K3,3 could not be done in linear time by direct searching of a path of ancestors that is naturally explored eventually by the core planarity algorithm. Returns OK for a successful merge, NOTOK on an internal failure, or NONEMBEDDABLE if the merge was blocked, in which case a K_{3,3} homeomorph was isolated. ********************************************************************/ int _K33Search_MergeBicomps(graphP theGraph, int v, int RootVertex, int W, int WPrevLink) { K33SearchContext *context = NULL; gp_FindExtension(theGraph, K33SEARCH_ID, (void *)&context); if (context != NULL) { /* If the merge is blocked, then a K_{3,3} homeomorph is isolated, and NONEMBEDDABLE is returned so that the Walkdown terminates */ if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK33) { int mergeBlocker; // We want to test all merge points on the stack // as well as W, since the connection will go // from W. So we push W as a 'degenerate' merge point. sp_Push2(theGraph->theStack, W, WPrevLink); sp_Push2(theGraph->theStack, NIL, NIL); if (_SearchForMergeBlocker(theGraph, context, v, &mergeBlocker) != OK) return NOTOK; if (gp_IsVertex(theGraph, mergeBlocker)) { if (_FindK33WithMergeBlocker(theGraph, context, v, mergeBlocker) != OK) return NOTOK; return NONEMBEDDABLE; } // If no merge blocker was found, then remove W from the stack. sp_Pop2(theGraph->theStack, W, WPrevLink); sp_Pop2(theGraph->theStack, W, WPrevLink); } // If the merge was not blocked, then we perform the merge // When not doing a K3,3 search, then the merge is not // blocked as far as the K3,3 search method is concerned // Another algorithms could overload MergeBicomps and block // merges under certain conditions, but those would be based // on data maintained by the extension that implements the // other algorithm-- if *that* algorithm is the one being run return context->functions.fpMergeBicomps(theGraph, v, RootVertex, W, WPrevLink); } return NOTOK; } /******************************************************************** _K33Search_MergeVertex() Overload of merge vertex that does basic behavior but also removes the DFS child associated with R from the separatedDFSChildList of W. ********************************************************************/ void _K33Search_MergeVertex(graphP theGraph, int W, int WPrevLink, int R) { K33SearchContext *context = NULL; gp_FindExtension(theGraph, K33SEARCH_ID, (void *)&context); if (context != NULL) { if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK33) { int theList = context->VI[W].separatedDFSChildList; theList = LCDelete(context->separatedDFSChildLists, theList, gp_GetDFSChildFromBicompRoot(theGraph, R)); context->VI[W].separatedDFSChildList = theList; } context->functions.fpMergeVertex(theGraph, W, WPrevLink, R); } } /******************************************************************** ********************************************************************/ void _K33Search_InitEdgeRec(K33SearchContext *context, int e) { context->E[e].noStraddle = NIL; context->E[e].pathConnector = NIL; } /******************************************************************** ********************************************************************/ void _K33Search_InitVertexInfo(K33SearchContext *context, int v) { context->VI[v].separatedDFSChildList = NIL; context->VI[v].backEdgeList = NIL; context->VI[v].mergeBlocker = NIL; } /******************************************************************** ********************************************************************/ int _K33Search_HandleBlockedBicomp(graphP theGraph, int v, int RootVertex, int R) { K33SearchContext *context = NULL; gp_FindExtension(theGraph, K33SEARCH_ID, (void *)&context); if (context == NULL) return NOTOK; if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK33) { // If R is the root of a descendant bicomp of v, we push it, but then we know the search for K3,3 // will be successful and return NONEMBEDDABLE because this condition corresponds to minor A, which // is a K3,3. Thus, an "OK to proceed with Walkdown searching elsewhere" result cannot happen, // so we don't have to test for it to detect if we have to pop these two back off the stack. if (R != RootVertex) sp_Push2(theGraph->theStack, R, 0); // The possible results here are NONEMBEDDABLE if a K3,3 homeomorph is found, or OK if only // a K5 was found and unblocked such that it is OK for the Walkdown to continue searching // elsewhere. Note that the OK result can only happen if RootVertex==R since minor E can only // happen on a child bicomp of vertex v, not a descendant bicomp. return _SearchForK33InBicomp(theGraph, context, v, RootVertex); } // else if we are not doing a K3,3 homeomorph search, then call the superclass to handle return context->functions.fpHandleBlockedBicomp(theGraph, v, RootVertex, R); } /******************************************************************** ********************************************************************/ int _K33Search_EmbedPostprocess(graphP theGraph, int v, int edgeEmbeddingResult) { int savedEmbedFlags = 0, savedZEROBASEDIO = 0; // For K3,3 search, we just return the edge embedding result because the // search result has been obtained already. if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK33) { if (edgeEmbeddingResult == OK) { // When a graph does not contain a K3,3 homeomorph, the embedding // is meaningless, so we empty it out. We preserve the embedFlags // to ensure post-processing continues as expected. savedEmbedFlags = gp_GetEmbedFlags(theGraph); savedZEROBASEDIO = gp_GetGraphFlags(theGraph) & GRAPHFLAGS_ZEROBASEDIO; gp_ResetGraphStorage(theGraph); theGraph->embedFlags = savedEmbedFlags; theGraph->graphFlags &= savedZEROBASEDIO; } return edgeEmbeddingResult; } // When not searching for K3,3, we let the superclass do the work else { K33SearchContext *context = NULL; gp_FindExtension(theGraph, K33SEARCH_ID, (void *)&context); if (context != NULL) { return context->functions.fpEmbedPostprocess(theGraph, v, edgeEmbeddingResult); } } return NOTOK; } /******************************************************************** ********************************************************************/ int _K33Search_CheckEmbeddingIntegrity(graphP theGraph, graphP origGraph) { if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK33) { return OK; } // When not searching for K3,3, we let the superclass do the work else { K33SearchContext *context = NULL; gp_FindExtension(theGraph, K33SEARCH_ID, (void *)&context); if (context != NULL) { return context->functions.fpCheckEmbeddingIntegrity(theGraph, origGraph); } } return NOTOK; } /******************************************************************** ********************************************************************/ int _K33Search_CheckObstructionIntegrity(graphP theGraph, graphP origGraph) { // When searching for K3,3, we ensure that theGraph is a subgraph of // the original graph and that it contains a K3,3 homeomorph if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK33) { int degrees[5], imageVerts[6]; if (_TestSubgraph(theGraph, origGraph) != TRUE) { return NOTOK; } if (_getImageVertices(theGraph, degrees, 4, imageVerts, 6) != OK) { return NOTOK; } if (_TestForK33GraphObstruction(theGraph, degrees, imageVerts) == TRUE) { return OK; } return NOTOK; } // When not searching for K3,3, we let the superclass do the work else { K33SearchContext *context = NULL; gp_FindExtension(theGraph, K33SEARCH_ID, (void *)&context); if (context != NULL) { return context->functions.fpCheckObstructionIntegrity(theGraph, origGraph); } } return NOTOK; } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/homeomorphSearch/graphK4Search.c000066400000000000000000001660571522057144000314100ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "graphK4Search.h" #include "graphK4Search.private.h" /* Imported functions */ extern void _InitIsolatorContext(graphP theGraph); extern void _ClearAllVisitedFlagsInGraph(graphP); extern int _ClearAllVisitedFlagsInBicomp(graphP theGraph, int BicompRoot); // extern int _ClearAllVisitedFlagsInOtherBicomps(graphP theGraph, int BicompRoot); // extern void _ClearEdgeVisitedFlagsInUnembeddedEdges(graphP theGraph); extern int _ClearObstructionMarksInBicomp(graphP theGraph, int BicompRoot); // extern int _DeleteUnmarkedEdgesInBicomp(graphP theGraph, int BicompRoot); extern int _ComputeEdgeRecordType(graphP theGraph, int a, int b, int edgeType); extern int _RestoreEdgeType(graphP theGraph, int u, int v); extern int _GetNeighborOnExtFace(graphP theGraph, int curVertex, int *pPrevLink); extern int _JoinBicomps(graphP theGraph); // extern void _FindActiveVertices(graphP theGraph, int R, int *pX, int *pY); extern int _OrientVerticesInBicomp(graphP theGraph, int BicompRoot, int PreserveSigns); extern int _OrientVerticesInEmbedding(graphP theGraph); // extern void _InvertVertex(graphP theGraph, int V); extern int _ClearAllVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x); extern int _SetAllVisitedFlagsOnPath(graphP theGraph, int u, int v, int w, int x); extern int _OrientExternalFacePath(graphP theGraph, int u, int v, int w, int x); extern int _FindUnembeddedEdgeToAncestor(graphP theGraph, int cutVertex, int *pAncestor, int *pDescendant); extern int _FindUnembeddedEdgeToCurVertex(graphP theGraph, int cutVertex, int *pDescendant); extern int _GetLeastAncestorConnection(graphP theGraph, int cutVertex); extern int _SetVertexTypesForMarkingXYPath(graphP theGraph); extern int _MarkHighestXYPath(graphP theGraph); extern int _MarkPathAlongBicompExtFace(graphP theGraph, int startVert, int endVert); extern int _AddAndMarkEdge(graphP theGraph, int ancestor, int descendant); extern int _DeleteUnmarkedVerticesAndEdges(graphP theGraph); extern int _IsolateOuterplanarityObstructionA(graphP theGraph); // extern int _IsolateOuterplanarityObstructionB(graphP theGraph); extern int _IsolateOuterplanarityObstructionE(graphP theGraph); extern void _K4Search_InitEdgeRec(K4SearchContext *context, int e); /* Private functions for K4 searching (exposed to the extension). */ int _SearchForK4InBicomp(graphP theGraph, K4SearchContext *context, int v, int R); /* Private functions for K4 searching. */ int _K4_ChooseTypeOfNonOuterplanarityMinor(graphP theGraph, int v, int R); int _K4_FindSecondActiveVertexOnLowExtFacePath(graphP theGraph); int _K4_FindPlanarityActiveVertex(graphP theGraph, int v, int R, int prevLink, int *pW); int _K4_FindSeparatingInternalEdge(graphP theGraph, int R, int prevLink, int A, int *pW, int *pX, int *pY); void _K4_SetMarksOnExternalFacePath(graphP theGraph, int R, int prevLink, int A); void _K4_ClearMarksOnExternalFacePath(graphP theGraph, int R, int prevLink, int A); int _K4_IsolateMinorA1(graphP theGraph); int _K4_IsolateMinorA2(graphP theGraph); int _K4_IsolateMinorB1(graphP theGraph); int _K4_IsolateMinorB2(graphP theGraph); int _K4_ReduceBicompToEdge(graphP theGraph, K4SearchContext *context, int R, int W); int _K4_ReducePathComponent(graphP theGraph, K4SearchContext *context, int R, int prevLink, int A); int _K4_ReducePathToEdge(graphP theGraph, K4SearchContext *context, int edgeType, int R, int e_R, int A, int e_A); int _K4_GetCumulativeOrientationOnDFSPath(graphP theGraph, int ancestor, int descendant); int _K4_TestPathComponentForAncestor(graphP theGraph, int R, int prevLink, int A); void _K4_ClearVisitedInPathComponent(graphP theGraph, int R, int prevLink, int A); int _K4_DeleteUnmarkedEdgesInPathComponent(graphP theGraph, int R, int prevLink, int A); int _K4_DeleteUnmarkedEdgesInBicomp(graphP theGraph, K4SearchContext *context, int BicompRoot); int _K4_DeleteEdge(graphP theGraph, K4SearchContext *context, int e); int _K4_RestoreReducedPath(graphP theGraph, K4SearchContext *context, int e); int _K4_RestoreAndOrientReducedPaths(graphP theGraph, K4SearchContext *context); // int _MarkEdge(graphP theGraph, int x, int y); /**************************************************************************** _SearchForK4InBicomp() ****************************************************************************/ int _SearchForK4InBicomp(graphP theGraph, K4SearchContext *context, int v, int R) { isolatorContextP IC = theGraphIC(theGraph); if (context == NULL) { gp_FindExtension(theGraph, K4SEARCH_ID, (void *)&context); if (context == NULL) return NOTOK; } // Begin by determining whether minor A, B or E is detected if (_K4_ChooseTypeOfNonOuterplanarityMinor(theGraph, v, R) != OK) return NOTOK; // Minor A indicates the existence of K_{2,3} homeomorphs, but // we run additional tests to see whether we can either find an // entwined K4 homeomorph or reduce the bicomp so that the WalkDown // is enabled to continue to resolve pertinence if (theGraphIC(theGraph)->minorType & MINORTYPE_A) { // Now that we know we have minor A, we can afford to orient the // bicomp because we will either find the desired K4 or we will // reduce the bicomp to an edge. The tests for A1 and A2 are easier // to implement on an oriented bicomp. // NOTE: We're in the midst of the WalkDown, so the stack may be // non-empty, and it has to be preserved with constant cost. // The stack will have at most 4 integers per cut vertex // merge point, and this operation will push at most two // integers per tree edge in the bicomp, so the stack // will not overflow. if (sp_GetCapacity(theGraph->theStack) < 6 * gp_GetN(theGraph)) return NOTOK; if (_OrientVerticesInBicomp(theGraph, R, 1) != OK) return NOTOK; // Case A1: Test whether there is an active vertex Z other than W // along the external face path [X, ..., W, ..., Y] if (_K4_FindSecondActiveVertexOnLowExtFacePath(theGraph) == TRUE) { // Now that we know we can find a K4, the Walkdown will not continue // and we can do away with the stack content. sp_ClearStack(theGraph->theStack); // Restore the orientations of the vertices in the bicomp, then orient // the whole embedding, so we can restore and orient the reduced paths if (_OrientVerticesInBicomp(theGraph, R, 1) != OK || _OrientVerticesInEmbedding(theGraph) != OK || _K4_RestoreAndOrientReducedPaths(theGraph, context) != OK) return NOTOK; // Set up to isolate K4 homeomorph _ClearAllVisitedFlagsInGraph(theGraph); if (_FindUnembeddedEdgeToCurVertex(theGraph, IC->w, &IC->dw) != TRUE) return NOTOK; if (IC->uz < IC->v) { if (_FindUnembeddedEdgeToAncestor(theGraph, IC->z, &IC->uz, &IC->dz) != TRUE) return NOTOK; } else { if (_FindUnembeddedEdgeToCurVertex(theGraph, IC->z, &IC->dz) != TRUE) return NOTOK; } // Isolate the K4 homeomorph if (_K4_IsolateMinorA1(theGraph) != OK || _DeleteUnmarkedVerticesAndEdges(theGraph) != OK) return NOTOK; // Indicate success by returning NONEMBEDDABLE return NONEMBEDDABLE; } // Case A2: Test whether the bicomp has an XY path // NOTE: As mentioned above, the stack is also preserved here. // It will have at most 4 integers per cut vertex merge point, // and this operation will push at most one integer per tree // edge in the bicomp, so the stack will not overflow. if (_SetVertexTypesForMarkingXYPath(theGraph) != OK) return NOTOK; // Marking the X-Y path relies on the bicomp visited flags being cleared if (_ClearAllVisitedFlagsInBicomp(theGraph, R) != OK) return NOTOK; // Now Mark the X-Y path // NOTE: This call preserves the stack and does not overflow. There // are at most 4 integers per cut vertex merge point, all of which // are not in the bicomp, and this call pushes at most 3 integers // per bicomp vertex, so the maximum stack requirement is 4N if (_MarkHighestXYPath(theGraph) != OK) return NOTOK; // If there was an X-Y path to mark... if (theGraphIC(theGraph)->py != NIL) { // Now that we know we can find a K4, the Walkdown will not continue // and we can do away with the stack content. sp_ClearStack(theGraph->theStack); // Restore the orientations of the vertices in the bicomp, then orient // the whole embedding, so we can restore and orient the reduced paths if (_OrientVerticesInBicomp(theGraph, R, 1) != OK || _OrientVerticesInEmbedding(theGraph) != OK || _K4_RestoreAndOrientReducedPaths(theGraph, context) != OK) return NOTOK; // Set up to isolate K4 homeomorph _ClearAllVisitedFlagsInGraph(theGraph); if (_FindUnembeddedEdgeToCurVertex(theGraph, IC->w, &IC->dw) != TRUE) { return NOTOK; } // Fail if there is an internal error or if there isn't an X-Y path if (_MarkHighestXYPath(theGraph) != OK || theGraphIC(theGraph)->py == NIL) return NOTOK; // Isolate the K4 homeomorph if (_K4_IsolateMinorA2(theGraph) != OK || _DeleteUnmarkedVerticesAndEdges(theGraph) != OK) return NOTOK; // Indicate success by returning NONEMBEDDABLE return NONEMBEDDABLE; } // else if there was no X-Y path, then we restore the vertex types to // unknown (though it would suffice to do it just to R and W) if (_ClearObstructionMarksInBicomp(theGraph, R) != OK) return NOTOK; // Since neither A1 nor A2 is found, then we reduce the bicomp to the // tree edge (R, W). // NOTE: The visited flags for R and W are restored to values appropriate // for continuing with future embedding steps // NOTE: This method invokes several routines that use the stack, but // all of them preserve the stack and each pushes at most one // integer per bicomp vertex and pops all of them before returning. // Again, this means the stack will not overflow. if (_K4_ReduceBicompToEdge(theGraph, context, R, IC->w) != OK) return NOTOK; // Return OK so that the WalkDown can continue resolving the pertinence of v. return OK; } // Minor B also indicates the existence of K_{2,3} homeomorphs, but // we run additional tests to see whether we can either find an // entwined K4 homeomorph or reduce a portion of the bicomp so that // the WalkDown can be reinvoked on the bicomp else if (theGraphIC(theGraph)->minorType & MINORTYPE_B) { int a_x, a_y; // Reality check on stack state if (sp_NonEmpty(theGraph->theStack)) return NOTOK; // Find the vertices a_x and a_y that are active (pertinent or future pertinent) // and also first along the external face paths emanating from the bicomp root if (_K4_FindPlanarityActiveVertex(theGraph, v, R, 1, &a_x) != OK || _K4_FindPlanarityActiveVertex(theGraph, v, R, 0, &a_y) != OK) return NOTOK; // Case B1: If both a_x and a_y are future pertinent, then we can stop and // isolate a subgraph homeomorphic to K4. gp_UpdateVertexFuturePertinentChild(theGraph, a_x, v); gp_UpdateVertexFuturePertinentChild(theGraph, a_y, v); if (a_x != a_y && FUTUREPERTINENT(theGraph, a_x, v) && FUTUREPERTINENT(theGraph, a_y, v)) { if (_OrientVerticesInEmbedding(theGraph) != OK || _K4_RestoreAndOrientReducedPaths(theGraph, context) != OK) return NOTOK; // Set up to isolate K4 homeomorph _ClearAllVisitedFlagsInGraph(theGraph); IC->x = a_x; IC->y = a_y; if (_FindUnembeddedEdgeToAncestor(theGraph, IC->x, &IC->ux, &IC->dx) != TRUE || _FindUnembeddedEdgeToAncestor(theGraph, IC->y, &IC->uy, &IC->dy) != TRUE) return NOTOK; // Isolate the K4 homeomorph if (_K4_IsolateMinorB1(theGraph) != OK || _DeleteUnmarkedVerticesAndEdges(theGraph) != OK) return NOTOK; // Indicate success by returning NONEMBEDDABLE return NONEMBEDDABLE; } // Reality check: The bicomp with root R is pertinent, and the only // pertinent or future pertinent vertex on the external face is a_x, // so it must also be pertinent. if (a_x == a_y && !PERTINENT(theGraph, a_x)) return NOTOK; // Case B2: Determine whether there is an internal separating X-Y path for a_x or for a_y // The method makes appropriate isolator context settings if the separator edge is found if (_K4_FindSeparatingInternalEdge(theGraph, R, 1, a_x, &IC->w, &IC->px, &IC->py) == TRUE || _K4_FindSeparatingInternalEdge(theGraph, R, 0, a_y, &IC->w, &IC->py, &IC->px) == TRUE) { if (_OrientVerticesInEmbedding(theGraph) != OK || _K4_RestoreAndOrientReducedPaths(theGraph, context) != OK) return NOTOK; // Set up to isolate K4 homeomorph _ClearAllVisitedFlagsInGraph(theGraph); if (PERTINENT(theGraph, IC->w)) { if (_FindUnembeddedEdgeToCurVertex(theGraph, IC->w, &IC->dw) != TRUE) return NOTOK; } else { IC->z = IC->w; if (_FindUnembeddedEdgeToAncestor(theGraph, IC->z, &IC->uz, &IC->dz) != TRUE) return NOTOK; } // The X-Y path doesn't have to be the same one that was associated with // the separating internal edge (but it has to be there, else error). if (_SetVertexTypesForMarkingXYPath(theGraph) != OK || _MarkHighestXYPath(theGraph) != OK || theGraphIC(theGraph)->py == NIL) return NOTOK; // Isolate the K4 homeomorph if (_K4_IsolateMinorB2(theGraph) != OK || _DeleteUnmarkedVerticesAndEdges(theGraph) != OK) return NOTOK; // Indicate success by returning NONEMBEDDABLE return NONEMBEDDABLE; } // If K_4 homeomorph not found, make reductions along a_x and a_y paths. if (a_x == a_y) { // In the special case where both paths lead to the same vertex, we can // reduce the bicomp to a single edge, which avoids issues of reversed // orientation between the bicomp root and the vertex. if (_K4_ReduceBicompToEdge(theGraph, context, R, a_x) != OK) return NOTOK; } else { // When a_x and a_y are distinct, we reduce each path from root to the vertex if (_K4_ReducePathComponent(theGraph, context, R, 1, a_x) != OK || _K4_ReducePathComponent(theGraph, context, R, 0, a_y) != OK) return NOTOK; } // Return OK to indicate that WalkDown processing may proceed to resolve // more of the pertinence of this bicomp. return OK; } // Minor E indicates the desired K4 homeomorph, so we isolate it and return NONEMBEDDABLE else if (theGraphIC(theGraph)->minorType & MINORTYPE_E) { // Reality check on stack state if (sp_NonEmpty(theGraph->theStack)) return NOTOK; // Impose consistent orientation on the embedding so we can then // restore the reduced paths. if (_OrientVerticesInEmbedding(theGraph) != OK || _K4_RestoreAndOrientReducedPaths(theGraph, context) != OK) return NOTOK; // Set up to isolate minor E _ClearAllVisitedFlagsInGraph(theGraph); if (_FindUnembeddedEdgeToCurVertex(theGraph, IC->w, &IC->dw) != TRUE) return NOTOK; if (_SetVertexTypesForMarkingXYPath(theGraph) != OK) return NOTOK; if (_MarkHighestXYPath(theGraph) != OK || theGraphIC(theGraph)->py == NIL) return NOTOK; // Isolate the K4 homeomorph if (_IsolateOuterplanarityObstructionE(theGraph) != OK || _DeleteUnmarkedVerticesAndEdges(theGraph) != OK) return NOTOK; // Return indication that K4 homeomorph has been found return NONEMBEDDABLE; } // You never get here in an error-free implementation like this one return NOTOK; } /**************************************************************************** _K4_ChooseTypeOfNonOuterplanarityMinor() This is an overload of the function _ChooseTypeOfNonOuterplanarityMinor() that avoids processing the whole bicomp rooted by R, e.g. to orient its vertices or label the vertices of its external face. This is necessary in particular because of the reduction processing on MINORTYPE_B. When a K2,3 is found by minor B, we may not be able to find an entangled K4, so a reduction is performed, but it only eliminates part of the bicomp and the operations here need to avoid touching parts of the bicomp that won't be reduced, except by a constant amount of course. ****************************************************************************/ int _K4_ChooseTypeOfNonOuterplanarityMinor(graphP theGraph, int v, int R) { int XPrevLink = 1, YPrevLink = 0; int Wx, WxPrevLink, Wy, WyPrevLink; _InitIsolatorContext(theGraph); theGraphIC(theGraph)->v = v; theGraphIC(theGraph)->r = R; // Reality check on data structure integrity if (!gp_VirtualVertexInUse(theGraph, R)) return NOTOK; // We are essentially doing a _FindActiveVertices() here, except two things: // 1) for outerplanarity we know the first vertices along the paths from R // are the desired vertices because no vertices are "inactive" // 2) We have purposely not oriented the bicomp, so the XPrevLink result is // needed to help find the pertinent vertex W theGraphIC(theGraph)->x = _GetNeighborOnExtFace(theGraph, R, &XPrevLink); theGraphIC(theGraph)->y = _GetNeighborOnExtFace(theGraph, R, &YPrevLink); // We are essentially doing a _FindPertinentVertex() here, except two things: // 1) It is not known whether the reduction of the path through X or the path // through Y will enable the pertinence of W to be resolved, so it is // necessary to perform parallel face traversal to find W with a cost no // more than twice what it will take to resolve the W's pertinence // (assuming we have to do a reduction rather than finding an entangled K4) // 2) In the normal _FindPertinentVertex(), the bicomp is already oriented, so // the "prev link" is hard coded to traverse down the X side. In this // implementation, the bicomp is purposely not oriented, so we need to know // XPrevLink and YPrevLink in order to set off in the correct directions. Wx = theGraphIC(theGraph)->x; WxPrevLink = XPrevLink; Wy = theGraphIC(theGraph)->y; WyPrevLink = YPrevLink; theGraphIC(theGraph)->w = NIL; while (Wx != theGraphIC(theGraph)->y) { Wx = _GetNeighborOnExtFace(theGraph, Wx, &WxPrevLink); if (PERTINENT(theGraph, Wx)) { theGraphIC(theGraph)->w = Wx; break; } Wy = _GetNeighborOnExtFace(theGraph, Wy, &WyPrevLink); if (PERTINENT(theGraph, Wy)) { theGraphIC(theGraph)->w = Wy; break; } } if (gp_IsNotVertex(theGraph, theGraphIC(theGraph)->w)) return NOTOK; // If the root copy is not a root copy of the current vertex v, // then the Walkdown terminated on a descendant bicomp, which is Minor A. if (gp_GetVertexFromBicompRoot(theGraph, R) != v) theGraphIC(theGraph)->minorType |= MINORTYPE_A; // If W has a pertinent child bicomp, then we've found Minor B. // Notice this is different from planarity, in which minor B is indicated // only if the pertinent child bicomp is also future pertinent. else if (gp_IsVertex(theGraph, gp_GetVertexPertinentRootsList(theGraph, theGraphIC(theGraph)->w))) theGraphIC(theGraph)->minorType |= MINORTYPE_B; // The only other result is minor E (we will search for the X-Y path later) else theGraphIC(theGraph)->minorType |= MINORTYPE_E; return OK; } /**************************************************************************** _K4_FindSecondActiveVertexOnLowExtFacePath() This method is used in the processing of obstruction A, so it can take advantage of the bicomp being oriented beforehand. This method determines whether there is an active vertex Z other than W on the path [X, ..., W, ..., Y]. By active, we mean a vertex that connects by an unembedded edge to either v or an ancestor of v. That is, a vertex that is pertinent or future pertinent (would be pertinent in a future step of the embedder). ****************************************************************************/ int _K4_FindSecondActiveVertexOnLowExtFacePath(graphP theGraph) { int Z = theGraphIC(theGraph)->r, ZPrevLink = 1; // First we test X for future pertinence only (if it were pertinent, then // we wouldn't have been blocked up on this bicomp) Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); gp_UpdateVertexFuturePertinentChild(theGraph, Z, theGraphIC(theGraph)->v); if (FUTUREPERTINENT(theGraph, Z, theGraphIC(theGraph)->v)) { theGraphIC(theGraph)->z = Z; theGraphIC(theGraph)->uz = _GetLeastAncestorConnection(theGraph, Z); return TRUE; } // Now we move on to test all the vertices strictly between X and Y on // the lower external face path, except W, for either pertinence or // future pertinence. Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); while (Z != theGraphIC(theGraph)->y) { if (Z != theGraphIC(theGraph)->w) { gp_UpdateVertexFuturePertinentChild(theGraph, Z, theGraphIC(theGraph)->v); if (FUTUREPERTINENT(theGraph, Z, theGraphIC(theGraph)->v)) { theGraphIC(theGraph)->z = Z; theGraphIC(theGraph)->uz = _GetLeastAncestorConnection(theGraph, Z); return TRUE; } else if (PERTINENT(theGraph, Z)) { theGraphIC(theGraph)->z = Z; theGraphIC(theGraph)->uz = theGraphIC(theGraph)->v; return TRUE; } } Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); } // Now we test Y for future pertinence (same explanation as for X above) gp_UpdateVertexFuturePertinentChild(theGraph, Z, theGraphIC(theGraph)->v); if (FUTUREPERTINENT(theGraph, Z, theGraphIC(theGraph)->v)) { theGraphIC(theGraph)->z = Z; theGraphIC(theGraph)->uz = _GetLeastAncestorConnection(theGraph, Z); return TRUE; } // We didn't find the desired second vertex, so report FALSE return FALSE; } /**************************************************************************** _K4_FindPlanarityActiveVertex() This service routine starts out at R and heads off in the direction opposite the prevLink to find the first "planarity active" vertex, i.e. the first one that is pertinent or future pertinent. ****************************************************************************/ int _K4_FindPlanarityActiveVertex(graphP theGraph, int v, int R, int prevLink, int *pW) { int W = R, WPrevLink = prevLink; W = _GetNeighborOnExtFace(theGraph, R, &WPrevLink); while (W != R) { if (PERTINENT(theGraph, W)) { *pW = W; return OK; } else { gp_UpdateVertexFuturePertinentChild(theGraph, W, v); if (FUTUREPERTINENT(theGraph, W, v)) { *pW = W; return OK; } } W = _GetNeighborOnExtFace(theGraph, W, &WPrevLink); } return NOTOK; } /**************************************************************************** _K4_FindSeparatingInternalEdge() Logically, this method is similar to calling MarkHighestXYPath() to see if there is an internal separator between R and A. However, that method cannot be called because the bicomp is not oriented. Because this is an outerplanarity related algorithm, there are no internal vertices to contend with, so it is easier to inspect the internal edges incident to each vertex internal to the path (R ... A), i.e. excluding endpoints, to see whether any of the edges connects outside of the path [R ... A], including endpoints. In order to avoid adding cost to the core planarity algorithm, we'll just use the fact that the vertex obstruction types are pre-initialized to the unmarked state. Until we know if there is a separating internal edge, we cannot be sure that we can isolate a K4 homeomorph, so we can't afford to initialize the whole bicomp. The obstruction type of each vertex along the path [R ... A] is marked. Then, for each vertex in the range (R ... A), if there is any edge that is also incident to a vertex whose obstruction type is still unmarked, then that edge is the desired separator edge between R and W (i.e. A), and so we save information about it. If the separator edge is found, then this method sets the *pW to A, and it sets *pX and *pY values with the endpoints of the separator edge. The visited flags of the separator edge and its endpoint vertices are not set at this time because it is easier to set them later as part of the overall K4 homeomorph isolation. Lastly, we restore the unmarked obstruction type settings on the path [R ... A]. Returns TRUE if separator edge found or FALSE otherwise ****************************************************************************/ int _K4_FindSeparatingInternalEdge(graphP theGraph, int R, int prevLink, int A, int *pW, int *pX, int *pY) { int Z, ZPrevLink, e, neighbor; // Mark the vertex obstruction type settings along the path [R ... A] _K4_SetMarksOnExternalFacePath(theGraph, R, prevLink, A); // Search each of the vertices in the range (R ... A) *pX = *pY = NIL; ZPrevLink = prevLink; Z = _GetNeighborOnExtFace(theGraph, R, &ZPrevLink); while (Z != A) { // Search for a separator among the edges of Z // It is OK to not bother skipping the external face edges, since we // know they are marked visited and so are ignored e = gp_GetFirstEdge(theGraph, Z); while (gp_IsEdge(theGraph, e)) { neighbor = gp_GetNeighbor(theGraph, e); if (!gp_GetMarked(theGraph, neighbor)) { *pW = A; *pX = Z; *pY = neighbor; break; } e = gp_GetNextEdge(theGraph, e); } // If we found the separator edge, then we don't need to go on if (gp_IsVertex(theGraph, *pX)) { break; } // Go to the next vertex Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); } // Restore the unmarked obstruction type settings on the path [R ... A] _K4_ClearMarksOnExternalFacePath(theGraph, R, prevLink, A); return gp_IsVertex(theGraph, *pX) ? TRUE : FALSE; } /**************************************************************************** _K4_SetMarksOnExternalFacePath() Assumes A is a vertex along the external face of the bicomp rooted by R. Marks the obstruction type of vertices along the path (R ... A) that begins with R's link[1^prevLink] edge record. ****************************************************************************/ void _K4_SetMarksOnExternalFacePath(graphP theGraph, int R, int prevLink, int A) { int Z, ZPrevLink; gp_SetMarked(theGraph, R); ZPrevLink = prevLink; Z = R; while (Z != A) { Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); gp_SetMarked(theGraph, Z); } } /**************************************************************************** _K4_ClearMarksOnExternalFacePath() Assumes A is a vertex along the external face of the bicomp rooted by R. Unmarks the obstruction type of vertices along the path (R ... A) that begins with R's link[1^prevLink] edge record. ****************************************************************************/ void _K4_ClearMarksOnExternalFacePath(graphP theGraph, int R, int prevLink, int A) { int Z, ZPrevLink; gp_ClearMarked(theGraph, R); ZPrevLink = prevLink; Z = R; while (Z != A) { Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); gp_ClearMarked(theGraph, Z); } } /**************************************************************************** _K4_IsolateMinorA1() This pattern is essentially outerplanarity minor A, a K_{2,3}, except we get a K_4 via the additional path from some vertex Z to the current vertex. This path may be via some descendant of Z, and it may be a future pertinent connection to an ancestor of the current vertex. ****************************************************************************/ int _K4_IsolateMinorA1(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); if (IC->uz < IC->v) { if (theGraph->functions->fpMarkDFSPath(theGraph, IC->uz, IC->v) != OK) return NOTOK; } if (theGraph->functions->fpMarkDFSPath(theGraph, IC->z, IC->dz) != OK) return NOTOK; if (_IsolateOuterplanarityObstructionA(theGraph) != OK) return NOTOK; if (_AddAndMarkEdge(theGraph, IC->uz, IC->dz) != OK) { return NOTOK; } return OK; } /**************************************************************************** _K4_IsolateMinorA2() This pattern is essentially outerplanarity minor A, a K_{2,3}, except we get a K_4 via an additional X-Y path within the main bicomp, which is guaranteed to exist by the time this method is invoked. One might think to simply invoke _MarkHighestXYPath() to obtain the path, but the IC->px and IC->py values are already set before invoking this method, and the bicomp is outerplanar, so the XY path is just an edge. Also, one subcase of pattern B2 reduces to this pattern, except that the XY path is determined by the B2 isolator. ****************************************************************************/ int _K4_IsolateMinorA2(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); // We assume the X-Y path was already marked if (!gp_GetVisited(theGraph, IC->px) || !gp_GetVisited(theGraph, IC->py)) return NOTOK; return _IsolateOuterplanarityObstructionA(theGraph); } /**************************************************************************** _K4_IsolateMinorB1() It is possible to get a K_4 based on the pertinence of w, but we don't do it that way. If we use the pertinence of w, then we have to eliminate part of the bicomp external face, which has special cases if a_x==w or a_y==w. Typically we would mark (r ... a_x ... w ... a_y), which works even when a_y==w, but if instead a_x==w, then we'd have to mark (w ... a_y ... r). Since a_x and a_y are guaranteed to be distinct, it is easier to just ignore the pertinence of w, and instead use the lower bicomp external face path as the connection between a_x and a_y. This includes w, but then the isolation process is the same even if a_x==w or a_y==w. The other two connections for a_x and a_y are to v and MAX(ux, uy). ****************************************************************************/ int _K4_IsolateMinorB1(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); if (theGraph->functions->fpMarkDFSPath(theGraph, IC->x, IC->dx) != OK) return NOTOK; if (theGraph->functions->fpMarkDFSPath(theGraph, IC->y, IC->dy) != OK) return NOTOK; // The path from the bicomp root to MIN(ux,uy) is marked to ensure the // connection from the image vertices v and MAX(ux,uy) as well as the // connection from MAX(ux,uy) through MIN(ux,uy) to (ux==MIN(ux,uy)?x:y) if (theGraph->functions->fpMarkDFSPath(theGraph, MIN(IC->ux, IC->uy), IC->r) != OK) return NOTOK; // This makes the following connections (a_x ... v), (a_y ... v), and // (a_x ... w ... a_y), the last being tolerant of a_x==w or a_y==w if (_MarkPathAlongBicompExtFace(theGraph, IC->r, IC->r) != OK) return NOTOK; if (_JoinBicomps(theGraph) != OK) return NOTOK; if (_AddAndMarkEdge(theGraph, IC->ux, IC->dx) != OK) return NOTOK; if (_AddAndMarkEdge(theGraph, IC->uy, IC->dy) != OK) { return NOTOK; } return OK; } /**************************************************************************** _K4_IsolateMinorB2() The first subcase of B2 can be reduced to outerplanarity obstruction E The second subcase of B2 can be reduced to A2 by changing v to u ****************************************************************************/ int _K4_IsolateMinorB2(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); // First subcase, the active vertex is pertinent if (PERTINENT(theGraph, IC->w)) { // We assume the X-Y path was already marked if (!gp_GetVisited(theGraph, IC->px) || !gp_GetVisited(theGraph, IC->py)) return NOTOK; return _IsolateOuterplanarityObstructionE(theGraph); } // Second subcase, the active vertex is future pertinent else if (FUTUREPERTINENT(theGraph, IC->w, IC->v)) { IC->v = IC->uz; IC->dw = IC->dz; return _K4_IsolateMinorA2(theGraph); } return OK; } /**************************************************************************** _K4_ReduceBicompToEdge() This method is used when reducing the main bicomp of obstruction A to a single edge (R, W). We first delete all edges from the bicomp except those on the DFS tree path W to R, then we reduce that DFS tree path to a DFS tree edge. After the reduction, the outerplanarity Walkdown traversal can continue R to W without being blocked as was the case when R was adjacent to X and Y. Returns OK for success, NOTOK for internal (implementation) error. ****************************************************************************/ int _K4_ReduceBicompToEdge(graphP theGraph, K4SearchContext *context, int R, int W) { int newEdge; if (_OrientVerticesInBicomp(theGraph, R, 0) != OK || _ClearAllVisitedFlagsInBicomp(theGraph, R) != OK) return NOTOK; if (theGraph->functions->fpMarkDFSPath(theGraph, R, W) != OK) return NOTOK; if (_K4_DeleteUnmarkedEdgesInBicomp(theGraph, context, R) != OK) return NOTOK; // Now we have to reduce the path W -> R to the DFS tree edge (R, W) newEdge = _K4_ReducePathToEdge(theGraph, context, EDGE_TYPE_PARENT, R, gp_GetFirstEdge(theGraph, R), W, gp_GetFirstEdge(theGraph, W)); if (gp_IsNotEdge(theGraph, newEdge)) return NOTOK; // Finally, set the visited info state of W to unvisited so that // the core embedder (esp. Walkup) will not have any problems. gp_SetVertexVisitedInfo(theGraph, W, gp_GetN(theGraph)); return OK; } /**************************************************************************** _K4_ReducePathComponent() This method is invoked when the bicomp rooted by R contains a component subgraph that is separable from the bicomp by the 2-cut (R, A). The K_4 homeomorph isolator will have processed a significant fraction of the component, and so it must be reduced to an edge to ensure that said processing happens at most once on the component (except for future operations that are bound to linear time in total by other arguments). Because the bicomp is an outerplanar embedding, the component is known to consists of an external face path plus some internal edges that are parallel to that path. Otherwise, it wouldn't be separable by the 2-cut (R, A). The goal of this method is to reduce the component to the edge (R, A). This is done in such a way that, if the reduction must be restored, the DFS tree structure connecting the restored vertices is retained. The first step is to ensure that (R, A) is not already just an edge, in which case no reduction is needed. This can occur if A is future pertinent. Assuming a non-trivial reduction component, the next step is to determine the DFS tree structure within the component. Because it is separable by the 2-cut (R, A), there are only two cases: Case 1: The DFS tree path from A to R is within the reduction component. In this case, the DFS tree path is marked, the remaining edges of the reduction component are eliminated, and then the DFS tree path is reduced to the the tree edge (R, A). Note that the reduction component may also contain descendants of A as well as vertices that are descendant to R but are neither ancestors nor descendants of A. This depends on where the tree edge from R meets the external face path (R ... A). However, the reduction component can only contribute one path to any future K_4, so it suffices to preserve only the DFS tree path (A --> R). Case 2: The DFS tree path from A to R is not within the reduction component. In this case, the external face edge from R leads to a descendant D of A. We mark that back edge (R, D) plus the DFS tree path (D --> A). The remaining edges of the reduction component can be removed, and then the path (R, D, ..., A) is reduced to the edge (R, A). For the sake of contradiction, suppose that only part of the DFS tree path from A to R were contained by the reduction component. Then, a DFS tree edge would have to exit the reduction component and connect to some vertex not on the external face path (R, ..., A). This contradicts the assumption that the reduction subgraph is separable from the bicomp by the 2-cut (R, A). Returns OK for success, NOTOK for internal (implementation) error. ****************************************************************************/ int _K4_ReducePathComponent(graphP theGraph, K4SearchContext *context, int R, int prevLink, int A) { int e_R, e_A, Z, ZPrevLink, edgeType, invertedFlag = 0; // Check whether the external face path (R, ..., A) is just an edge e_R = gp_GetEdgeByLink(theGraph, R, 1 ^ prevLink); if (gp_GetNeighbor(theGraph, e_R) == A) return OK; // Check for Case 1: The DFS tree path from A to R is within the reduction component if (_K4_TestPathComponentForAncestor(theGraph, R, prevLink, A)) { _K4_ClearVisitedInPathComponent(theGraph, R, prevLink, A); if (theGraph->functions->fpMarkDFSPath(theGraph, R, A) != OK) return NOTOK; edgeType = EDGE_TYPE_PARENT; invertedFlag = _K4_GetCumulativeOrientationOnDFSPath(theGraph, R, A); } // Otherwise Case 2: The DFS tree path from A to R is not within the reduction component else { _K4_ClearVisitedInPathComponent(theGraph, R, prevLink, A); Z = gp_GetNeighbor(theGraph, e_R); gp_SetEdgeVisited(theGraph, e_R); gp_SetEdgeVisited(theGraph, gp_GetTwin(theGraph, e_R)); if (theGraph->functions->fpMarkDFSPath(theGraph, A, Z) != OK) { return NOTOK; } edgeType = EDGE_TYPE_BACK; } // The path to be kept/reduced is marked, so the other edges can go if (_K4_DeleteUnmarkedEdgesInPathComponent(theGraph, R, prevLink, A) != OK) return NOTOK; // Clear all the visited flags for safety, except the vertices R and A // will remain in the embedding, and the core embedder (Walkup) uses a // value greater than the current vertex to indicate an unvisited vertex _K4_ClearVisitedInPathComponent(theGraph, R, prevLink, A); gp_SetVertexVisitedInfo(theGraph, A, gp_GetN(theGraph)); // Find the component's remaining edges e_A and e_R incident to A and R ZPrevLink = prevLink; Z = R; while (Z != A) { Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); } e_A = gp_GetEdgeByLink(theGraph, A, ZPrevLink); e_R = gp_GetEdgeByLink(theGraph, R, 1 ^ prevLink); // Reduce the path (R ... A) to an edge e_R = _K4_ReducePathToEdge(theGraph, context, edgeType, R, e_R, A, e_A); if (gp_IsNotEdge(theGraph, e_R)) return NOTOK; // Preserve the net orientation along the DFS path in the case of a tree edge if (gp_GetEdgeType(theGraph, e_R) == EDGE_TYPE_CHILD) { if (invertedFlag) gp_SetEdgeFlagInverted(theGraph, e_R); } return OK; } /******************************************************************** _K4_DeleteUnmarkedEdgesInBicomp() This function deletes from a given biconnected component all edges whose visited member is zero. The stack is used but preserved. In debug mode, NOTOK can result if there is a stack overflow. This method pushes at most one integer per vertex in the bicomp. This is the same as _DeleteUnmarkedEdgesInBicomp(), except it calls the overloaded _K4_DeleteEdge() rather than gp_DeleteEdge() Returns OK on success, NOTOK on implementation failure ********************************************************************/ int _K4_DeleteUnmarkedEdgesInBicomp(graphP theGraph, K4SearchContext *context, int BicompRoot) { int V, e, eNext; int stackBottom = sp_GetCurrentSize(theGraph->theStack); sp_Push(theGraph->theStack, BicompRoot); while (sp_GetCurrentSize(theGraph->theStack) > stackBottom) { sp_Pop(theGraph->theStack, V); e = gp_GetFirstEdge(theGraph, V); while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) sp_Push(theGraph->theStack, gp_GetNeighbor(theGraph, e)); eNext = gp_GetNextEdge(theGraph, e); if (!gp_GetEdgeVisited(theGraph, e)) _K4_DeleteEdge(theGraph, context, e); e = eNext; } } return OK; } /******************************************************************** Edge deletion that occurs during a reduction or restoration of a reduction is augmented by clearing the K_4 search-specific data members. This is augmentation is not needed in the delete edge operations that happen once a K_4 homeomorph has been found and marked for isolation. ********************************************************************/ int _K4_DeleteEdge(graphP theGraph, K4SearchContext *context, int e) { _K4Search_InitEdgeRec(context, e); _K4Search_InitEdgeRec(context, gp_GetTwin(theGraph, e)); return gp_DeleteEdge(theGraph, e); } /**************************************************************************** _K4_GetCumulativeOrientationOnDFSPath() ****************************************************************************/ int _K4_GetCumulativeOrientationOnDFSPath(graphP theGraph, int ancestor, int descendant) { int e, parent; int invertedFlag = 0; /* If we are marking from a root vertex upward, then go up to the parent copy before starting the loop */ if (gp_IsVirtualVertex(theGraph, descendant)) descendant = gp_GetVertexFromBicompRoot(theGraph, descendant); while (descendant != ancestor) { if (descendant == NIL) return NOTOK; // If we are at a bicomp root, then ascend to its parent copy if (gp_IsVirtualVertex(theGraph, descendant)) { parent = gp_GetVertexFromBicompRoot(theGraph, descendant); } // If we are on a regular, non-virtual vertex then get the edge to the parent else { // Scan the edges for the one marked as the DFS parent parent = NIL; e = gp_GetFirstEdge(theGraph, descendant); while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_PARENT) { parent = gp_GetNeighbor(theGraph, e); break; } e = gp_GetNextEdge(theGraph, e); } // If the edge to the parent vertex was not found, then the data structure is corrupt if (parent == NIL) return NOTOK; // Add the inversion flag on the child edge record to the cumulative result e = gp_GetTwin(theGraph, e); if (gp_GetEdgeType(theGraph, e) != EDGE_TYPE_CHILD || gp_GetNeighbor(theGraph, e) != descendant) return NOTOK; invertedFlag ^= gp_GetEdgeFlagInverted(theGraph, e); } // Hop to the parent and reiterate descendant = parent; } return invertedFlag; } /**************************************************************************** _K4_TestPathComponentForAncestor() Tests the external face path between R and A for a DFS ancestor of A. Returns TRUE if found, FALSE otherwise. ****************************************************************************/ int _K4_TestPathComponentForAncestor(graphP theGraph, int R, int prevLink, int A) { int Z, ZPrevLink; ZPrevLink = prevLink; Z = R; while (Z != A) { Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); if (Z < A) return TRUE; } return FALSE; } /**************************************************************************** _K4_ClearVisitedInPathComponent() There is a subcomponent of the bicomp rooted by R that is separable by the 2-cut (R, A). The component contains the external face path from R to A. The 1^prevLink edge record of R is contained in that path (i.e. the first edge record if prevLink indicates the last, or the last edge record if prevLink indicates the first). The prevLink is passed because _GetNeighborOnExtFace() uses the opposing link to traverse to the "next" vertex. All vertices in this desired component are along the external face, so we traverse along the external face vertices strictly between R and A and clear all the visited flags of the edges and their incident vertices. Note that the vertices along the path (R ... A) only have edges incident to each other and to R and A because the component is separable by the (R, A)-cut. ****************************************************************************/ void _K4_ClearVisitedInPathComponent(graphP theGraph, int R, int prevLink, int A) { int Z, ZPrevLink, e; ZPrevLink = prevLink; Z = _GetNeighborOnExtFace(theGraph, R, &ZPrevLink); while (Z != A) { gp_ClearVisited(theGraph, Z); e = gp_GetFirstEdge(theGraph, Z); while (gp_IsEdge(theGraph, e)) { gp_ClearEdgeVisited(theGraph, e); gp_ClearEdgeVisited(theGraph, gp_GetTwin(theGraph, e)); gp_ClearVisited(theGraph, gp_GetNeighbor(theGraph, e)); e = gp_GetNextEdge(theGraph, e); } Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); } } /**************************************************************************** _K4_DeleteUnmarkedEdgesInPathComponent() There is a subcomponent of the bicomp rooted by R that is separable by the 2-cut (R, A) and contains the external face path from R to A that includes the gp_GetEdgeByLink(theGraph, R, 1^prevLink) edge record, which is the first edge record traversed by _GetNeighborOnExtFace(..., &prevLink). The edges in the component have been marked unvisited except for a path we intend to preserve. This routine deletes the unvisited edges. NOTE: This reduction invalidates the short-circuit extFace data structure, but it will be repaired for use by WalkUp and WalkDown when the path component reduction is completed. Returns OK on success, NOTOK on internal error ****************************************************************************/ int _K4_DeleteUnmarkedEdgesInPathComponent(graphP theGraph, int R, int prevLink, int A) { int Z, ZPrevLink, e; K4SearchContext *context = NULL; gp_FindExtension(theGraph, K4SEARCH_ID, (void *)&context); if (context == NULL) { return NOTOK; } // We need to use the stack to store up the edges we're going to delete. // We want to make sure there is enough stack capacity to handle it, // which is of course true because the stack is supposed to be empty. // We're doing a reduction on a bicomp on which the WalkDown has completed, // so the stack contains no bicomp roots to merge. if (sp_NonEmpty(theGraph->theStack)) return NOTOK; // Traverse all vertices internal to the path (R ... A) and push // all non-visited edges ZPrevLink = prevLink; Z = _GetNeighborOnExtFace(theGraph, R, &ZPrevLink); while (Z != A) { e = gp_GetFirstEdge(theGraph, Z); while (gp_IsEdge(theGraph, e)) { // The comparison of e to its twin is a useful way of ensuring we // don't push the edge twice, which is of course only applicable // when processing an edge whose endpoints are both internal to // the path (R ... A) if (!gp_GetEdgeVisited(theGraph, e) && (e < gp_GetTwin(theGraph, e) || gp_GetNeighbor(theGraph, e) == R || gp_GetNeighbor(theGraph, e) == A)) { sp_Push(theGraph->theStack, e); } e = gp_GetNextEdge(theGraph, e); } Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); } // Delete all the non-visited edges while (sp_NonEmpty(theGraph->theStack)) { sp_Pop(theGraph->theStack, e); _K4_DeleteEdge(theGraph, context, e); } return OK; } /**************************************************************************** _K4_ReducePathToEdge() Returns an edge record of the edge created on success, or NIL on failure On success, the edge record returned is in the adjacency list of R. The result can be tested for success or failure using gp_IsEdge() or gp_IsNotEdge() ****************************************************************************/ int _K4_ReducePathToEdge(graphP theGraph, K4SearchContext *context, int edgeType, int R, int e_R, int A, int e_A) { // Find out the links used in vertex R for edge e_R and in vertex A for edge e_A int Rlink = gp_GetFirstEdge(theGraph, R) == e_R ? 0 : 1; int Alink = gp_GetFirstEdge(theGraph, A) == e_A ? 0 : 1; // If the path is more than a single edge, then it must be reduced to an edge. // Note that even if the path is a single edge, the external face data structure // must still be modified since many edges connecting the external face have // been deleted if (gp_GetNeighbor(theGraph, e_R) != A) { int v_R, v_A; // Prepare for removing each of the two edges that join the path to the bicomp by // restoring it if it is a reduction edge (a constant time operation) // If e_R has a pathConnector vertex, then we prep by restoring a previously reduced // path for e_R if (context->E[e_R].pathConnector != NIL) { if (_K4_RestoreReducedPath(theGraph, context, e_R) != OK) { #ifdef DEBUG NOTOK; #endif return NIL; } e_R = gp_GetEdgeByLink(theGraph, R, Rlink); } // If e_A has a pathConnector vertex, then we prep by restoring a previously reduced // path for e_A if (context->E[e_A].pathConnector != NIL) { if (_K4_RestoreReducedPath(theGraph, context, e_A) != OK) { #ifdef DEBUG NOTOK; #endif return NIL; } e_A = gp_GetEdgeByLink(theGraph, A, Alink); } // Save the vertex neighbors of R and A indicated by e_R and e_A for // later use in setting up the path connectors. v_R = gp_GetNeighbor(theGraph, e_R); v_A = gp_GetNeighbor(theGraph, e_A); // Now delete the two edges that join the path to the bicomp. _K4_DeleteEdge(theGraph, context, e_R); _K4_DeleteEdge(theGraph, context, e_A); // Now add a single edge to represent the path // We use 1^Rlink, for example, because Rlink was the link from R that indicated e_R, // so 1^Rlink is the link that indicated e_R in the other edge record that was // adjacent to e_R. We want gp_InsertEdge to place the new edge record where e_R was // in R's adjacency list gp_InsertEdge(theGraph, R, gp_GetEdgeByLink(theGraph, R, Rlink), 1 ^ Rlink, A, gp_GetEdgeByLink(theGraph, A, Alink), 1 ^ Alink); // Now set up the path connectors so the original path can be recovered if needed. e_R = gp_GetEdgeByLink(theGraph, R, Rlink); context->E[e_R].pathConnector = v_R; e_A = gp_GetEdgeByLink(theGraph, A, Alink); context->E[e_A].pathConnector = v_A; // Also, set the reduction edge's type to preserve the DFS tree structure gp_SetEdgeType(theGraph, e_R, _ComputeEdgeRecordType(theGraph, R, A, edgeType)); gp_SetEdgeType(theGraph, e_A, _ComputeEdgeRecordType(theGraph, A, R, edgeType)); } // Set the external face data structure gp_SetExtFaceVertex(theGraph, R, Rlink, A); gp_SetExtFaceVertex(theGraph, A, Alink, R); // If the edge represents an entire bicomp, then more external face // settings are needed. if (gp_GetFirstEdge(theGraph, R) == gp_GetLastEdge(theGraph, R)) { gp_SetExtFaceVertex(theGraph, R, 1 ^ Rlink, A); gp_SetExtFaceVertex(theGraph, A, 1 ^ Alink, R); } return e_R; } /**************************************************************************** _K4_RestoreReducedPath() Given an edge record of an edge used to reduce a path, we want to restore the path in constant time. The path may contain more reduction edges internally, but we do not search for and process those since it would violate the constant time bound required of this function. Note that we don't bother amending the external face data structure because a reduced path is only restored when it will shortly be reduced again or when we don't really need the external face data structure anymore. Return OK on success, NOTOK on failure ****************************************************************************/ int _K4_RestoreReducedPath(graphP theGraph, K4SearchContext *context, int e) { int eTwin, u, v, w, x; int e0, e1, eTwin0, eTwin1; // An edge e does not represent a path reduction that needs to be restored // unless it was assigned a pathConnector vertex (and so is non-NIL) if (context->E[e].pathConnector == NIL) return OK; eTwin = gp_GetTwin(theGraph, e); u = gp_GetNeighbor(theGraph, eTwin); v = context->E[e].pathConnector; w = context->E[eTwin].pathConnector; x = gp_GetNeighbor(theGraph, e); // Get the locations of the EdgeRecs between which the new EdgeRecs // must be added in order to reconnect the path parallel to the edge. e0 = gp_GetNextEdge(theGraph, e); e1 = gp_GetPrevEdge(theGraph, e); eTwin0 = gp_GetNextEdge(theGraph, eTwin); eTwin1 = gp_GetPrevEdge(theGraph, eTwin); // We first delete the edge represented by e and eTwin. We do so before // restoring the path to ensure we do not exceed the maximum edge capacity. _K4_DeleteEdge(theGraph, context, e); // Now we add the two edges to reconnect the reduced path represented // by the edge [e, eTwin]. The edge record in u is added between e0 and e1. // Likewise, the new edge record in x is added between eTwin0 and eTwin1. if (gp_IsEdge(theGraph, e0)) { if (gp_InsertEdge(theGraph, u, e0, 1, v, NIL, 0) != OK) return NOTOK; } else { if (gp_InsertEdge(theGraph, u, e1, 0, v, NIL, 0) != OK) return NOTOK; } if (gp_IsEdge(theGraph, eTwin0)) { if (gp_InsertEdge(theGraph, x, eTwin0, 1, w, NIL, 0) != OK) return NOTOK; } else { if (gp_InsertEdge(theGraph, x, eTwin1, 0, w, NIL, 0) != OK) return NOTOK; } // Set the types of the newly added edges. In both cases, the first of the two // vertex parameters is known to be degree 2 because they are internal to the // path being restored, so this operation is constant time. if (_RestoreEdgeType(theGraph, v, u) != OK || _RestoreEdgeType(theGraph, w, x) != OK) return NOTOK; return OK; } /**************************************************************************** _K4_RestoreAndOrientReducedPaths() This function searches the embedding for any edges that are specially marked as being representative of a path that was previously reduced to a single edge by _ReducePathToEdge(). This method restores the path by replacing the edge with the path. Note that the new path may contain more reduction edges, and these will be iteratively expanded by the outer for loop. Equally, a reduced path may be restored into a path that itself is a reduction path that will only be attached to the embedding by some future step of the outer loop. The vertices along the path being restored must be given a consistent orientation with the endpoints. It is expected that the embedding will have been oriented prior to this operation. ****************************************************************************/ int _K4_RestoreAndOrientReducedPaths(graphP theGraph, K4SearchContext *context) { int e, eTwin, u, v, w, x, visited; for (e = gp_LowerBoundEdges(theGraph); e < gp_UpperBoundEdges(theGraph);) { // If e has a pathConnector vertex, then there is a reduced path // to restore and orient. if (context->E[e].pathConnector != NIL) { visited = gp_GetEdgeVisited(theGraph, e); eTwin = gp_GetTwin(theGraph, e); u = gp_GetNeighbor(theGraph, eTwin); v = context->E[e].pathConnector; w = context->E[eTwin].pathConnector; x = gp_GetNeighbor(theGraph, e); if (_K4_RestoreReducedPath(theGraph, context, e) != OK) return NOTOK; // If the path is on the external face, orient it if (gp_GetNeighbor(theGraph, gp_GetFirstEdge(theGraph, u)) == v || gp_GetNeighbor(theGraph, gp_GetLastEdge(theGraph, u)) == v) { // Reality check: ensure the path is connected to the // external face at both vertices. if (gp_GetNeighbor(theGraph, gp_GetFirstEdge(theGraph, x)) != w && gp_GetNeighbor(theGraph, gp_GetLastEdge(theGraph, x)) != w) return NOTOK; if (_OrientExternalFacePath(theGraph, u, v, w, x) != OK) return NOTOK; } if (visited) { if (_SetAllVisitedFlagsOnPath(theGraph, u, v, w, x) != OK) return NOTOK; } else { if (_ClearAllVisitedFlagsOnPath(theGraph, u, v, w, x) != OK) return NOTOK; } } else e += 2; } return OK; } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/homeomorphSearch/graphK4Search.h000066400000000000000000000011141522057144000313730ustar00rootroot00000000000000#ifndef GRAPH_K4SEARCH_H #define GRAPH_K4SEARCH_H /* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "../planarityRelated/graphOuterplanarity.h" #ifdef __cplusplus extern "C" { #endif // Create a K4Search Graph, i.e., subclass an Outerplanarity Graph by extending it // with the ability to perform a search for a subgraph homeomorphic to K_4. #define K4SEARCH_NAME "K4Search" int gp_ExtendWith_K4Search(graphP theGraph); int gp_Detach_K4Search(graphP theGraph); #ifdef __cplusplus } #endif #endif graph-algorithms-planarity-08d7b51/planarity/c/graphLib/homeomorphSearch/graphK4Search.private.h000066400000000000000000000032011522057144000330430ustar00rootroot00000000000000#ifndef GRAPH_K4SEARCH_PRIVATE_H #define GRAPH_K4SEARCH_PRIVATE_H /* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "../planarityRelated/graphOuterplanarity.private.h" #ifdef __cplusplus extern "C" { #endif /* Additional equipment for each EdgeRec pathConnector: Used in the edge records of a reduction edge to indicate the endpoints of a path that has been reduced from (removed from) the embedding so that the search for a K4 can continue. We only need a pathConnector because we reduce subgraphs that are separable by a 2-cut, so they can contribute at most one path to a subgraph homeomorphic to K4, if one is indeed found. Thus, we first delete all edges except for the desired path(s), then we reduce any retained path to an edge. */ typedef struct { int pathConnector; } K4Search_EdgeRec; typedef K4Search_EdgeRec *K4Search_EdgeRecP; /* Additional equipment for each vertex: None */ typedef struct { // Helps distinguish initialize from re-initialize int initialized; // The graph that this context augments graphP theGraph; // Parallel array for additional edge level equipment K4Search_EdgeRecP E; // Overloaded function pointers graphFunctionTableStruct functions; // Internal variable for converting a tail recursion into a simple loop int handlingBlockedBicomp; } K4SearchContext; extern int K4SEARCH_ID; #ifdef __cplusplus } #endif #endif graph-algorithms-planarity-08d7b51/planarity/c/graphLib/homeomorphSearch/graphK4Search_Extensions.c000066400000000000000000000517531522057144000336230ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include #include "graphK4Search.h" #include "graphK4Search.private.h" // Need to save and restore a graph flag related to IO #include "../io/graphIO.h" extern int _SearchForK4InBicomp(graphP theGraph, K4SearchContext *context, int v, int R); extern int _TestForCompleteGraphObstruction(graphP theGraph, int numVerts, int *degrees, int *imageVerts); extern int _getImageVertices(graphP theGraph, int *degrees, int maxDegree, int *imageVerts, int maxNumImageVerts); extern int _TestSubgraph(graphP theSubgraph, graphP theGraph); /* Forward declarations of local functions */ void _K4Search_ClearStructures(K4SearchContext *context); int _K4Search_CreateStructures(K4SearchContext *context); int _K4Search_InitStructures(K4SearchContext *context); void _K4Search_InitEdgeRec(K4SearchContext *context, int e); /* Forward declarations of overloading functions */ int _K4Search_HandleBlockedBicomp(graphP theGraph, int v, int RootVertex, int R); int _K4Search_EmbedPostprocess(graphP theGraph, int v, int edgeEmbeddingResult); int _K4Search_CheckEmbeddingIntegrity(graphP theGraph, graphP origGraph); int _K4Search_CheckObstructionIntegrity(graphP theGraph, graphP origGraph); int _K4Search_EnsureVertexCapacity(graphP theGraph, int N); void _K4Search_ResetGraphStorage(graphP theGraph); int _K4Search_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity); /* Forward declarations of functions used by the extension system */ void *_K4Search_DupContext(void *pContext, void *theGraph); int _K4Search_CopyData(void *dstContext, void *srcContext); void _K4Search_FreeContext(void *); /**************************************************************************** * K4SEARCH_ID - the variable used to hold the integer identifier for this * extension, enabling this feature's extension context to be distinguished * from other features' extension contexts that may be attached to a graph. ****************************************************************************/ int K4SEARCH_ID = 0; /**************************************************************************** gp_ExtendWith_K4Search() This function adjusts the graph data structure to attach the K4 search feature. ****************************************************************************/ int gp_ExtendWith_K4Search(graphP theGraph) { K4SearchContext *context = NULL; if (theGraph == NULL || gp_GetN(theGraph) <= 0) return NOTOK; // If the K4 search feature has already been attached to the graph, // then there is no need to attach it again gp_FindExtension(theGraph, K4SEARCH_ID, (void *)&context); if (context != NULL) { return OK; } // Ensure theGraph is an Outerplanarity Graph if (gp_ExtendWith_Outerplanarity(theGraph) != OK) return NOTOK; // Allocate a new extension context context = (K4SearchContext *)malloc(sizeof(K4SearchContext)); if (context == NULL) { return NOTOK; } // First, tell the context that it is not initialized context->initialized = 0; // Save a pointer to theGraph in the context context->theGraph = theGraph; // Put the overload functions into the context function table. // gp_AddExtension will overload the graph's functions with these, and // return the base function pointers in the context function table memset(&context->functions, 0, sizeof(graphFunctionTableStruct)); context->functions.fpHandleBlockedBicomp = _K4Search_HandleBlockedBicomp; context->functions.fpEmbedPostprocess = _K4Search_EmbedPostprocess; context->functions.fpCheckEmbeddingIntegrity = _K4Search_CheckEmbeddingIntegrity; context->functions.fpCheckObstructionIntegrity = _K4Search_CheckObstructionIntegrity; context->functions.fpEnsureVertexCapacity = _K4Search_EnsureVertexCapacity; context->functions.fpResetGraphStorage = _K4Search_ResetGraphStorage; context->functions.fpEnsureEdgeCapacity = _K4Search_EnsureEdgeCapacity; _K4Search_ClearStructures(context); // Store the K4 search context, including the data structure and the // function pointers, as an extension of the graph if (gp_AddExtension(theGraph, &K4SEARCH_ID, (void *)context, _K4Search_DupContext, _K4Search_CopyData, _K4Search_FreeContext, &context->functions) != OK) { _K4Search_FreeContext(context); context = NULL; return NOTOK; } // Create the K4-specific structures if the size of the graph is known // Attach functions are always invoked after gp_New(), but if a graph // extension must be attached before gp_Read(), then the attachment // also happens before gp_EnsureVertexCapacity(), which means N==0. // However, a feature can be attached after gp_EnsureVertexCapacity(), // in which case there is extra work to do when N > 0. if (gp_GetN(theGraph) > 0) { if (_K4Search_CreateStructures(context) != OK || _K4Search_InitStructures(context) != OK) { _K4Search_FreeContext(context); context = NULL; return NOTOK; } } return OK; } /******************************************************************** gp_Detach_K4Search() ********************************************************************/ int gp_Detach_K4Search(graphP theGraph) { return gp_RemoveExtension(theGraph, K4SEARCH_ID); } /******************************************************************** _K4Search_ClearStructures() ********************************************************************/ void _K4Search_ClearStructures(K4SearchContext *context) { if (!context->initialized) { // Before initialization, the pointers are stray, not NULL // Once NULL or allocated, free() or LCFree() can do the job context->E = NULL; context->handlingBlockedBicomp = FALSE; context->initialized = 1; } else { if (context->E != NULL) { free(context->E); context->E = NULL; } context->handlingBlockedBicomp = FALSE; } } /******************************************************************** _K4Search_CreateStructures() Create uninitialized structures for the vertex and edge levels, and initialized structures for the graph level ********************************************************************/ int _K4Search_CreateStructures(K4SearchContext *context) { if (gp_GetN(context->theGraph) <= 0) return NOTOK; if ((context->E = (K4Search_EdgeRecP)malloc(gp_UpperBoundEdgeStorage(context->theGraph) * sizeof(K4Search_EdgeRec))) == NULL || 0) { return NOTOK; } return OK; } /******************************************************************** _K4Search_InitStructures() ********************************************************************/ int _K4Search_InitStructures(K4SearchContext *context) { memset(context->E, NIL_CHAR, gp_UpperBoundEdgeStorage(context->theGraph) * sizeof(K4Search_EdgeRec)); return OK; } /******************************************************************** ********************************************************************/ int _K4Search_EnsureVertexCapacity(graphP theGraph, int N) { K4SearchContext *context = NULL; gp_FindExtension(theGraph, K4SEARCH_ID, (void *)&context); if (context == NULL) return NOTOK; theGraph->N = N; theGraph->NV = N; if (theGraph->edgeCapacity == 0) theGraph->edgeCapacity = DEFAULT_EDGE_CAPACITY_FACTOR * N; if (_K4Search_CreateStructures(context) != OK || _K4Search_InitStructures(context) != OK) return NOTOK; context->functions.fpEnsureVertexCapacity(theGraph, N); return OK; } /******************************************************************** ********************************************************************/ void _K4Search_ResetGraphStorage(graphP theGraph) { K4SearchContext *context = NULL; gp_FindExtension(theGraph, K4SEARCH_ID, (void *)&context); if (context != NULL) { // Reset the graph storage in base class(es) context->functions.fpResetGraphStorage(theGraph); // Do the reset that is specific to this module _K4Search_InitStructures(context); } } /******************************************************************** _K4Search_EnsureEdgeCapacity() ********************************************************************/ int _K4Search_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity) { K4SearchContext *context = NULL; K4Search_EdgeRecP oldE = NULL, newE = NULL; int oldEsize = gp_UpperBoundEdgeStorage(theGraph), newEsize = 0; // If the requirement is already satisfied, then no work to do if (gp_GetEdgeCapacity(theGraph) >= requiredEdgeCapacity) return OK; // Get the graph's extension context so we can work on it gp_FindExtension(theGraph, K4SEARCH_ID, (void *)&context); if (context == NULL) return NOTOK; // Call the superclass function to make sure lower levels of parallel // edge arrays can successfully meet the new capacity requirement if (context->functions.fpEnsureEdgeCapacity(theGraph, requiredEdgeCapacity) != OK) return NOTOK; // Save the current E so it can be freed once we replace it oldE = context->E; // The superclass EnsureEdgeCapacity method succeeded, so the graph's // new edge capacity is already set, which means we the upper bound of // the graph's edge storage gives the new parallel array size we need. newEsize = gp_UpperBoundEdgeStorage(theGraph); // We must successfully allocate the new parallel edge array newE = (K4Search_EdgeRecP)malloc(newEsize * sizeof(K4Search_EdgeRec)); if (newE == NULL) return NOTOK; // Clear all new edge records memset(newE, NIL_CHAR, newEsize * sizeof(K4Search_EdgeRec)); // Copy the old edge records to the new edge records memcpy(newE, oldE, oldEsize * sizeof(K4Search_EdgeRec)); // Set the new edge array into the context and free the old one context->E = newE; free(oldE); return OK; } /******************************************************************** _K4Search_DupContext() ********************************************************************/ void *_K4Search_DupContext(void *pContext, void *theGraph) { K4SearchContext *context = (K4SearchContext *)pContext; K4SearchContext *newContext = (K4SearchContext *)malloc(sizeof(K4SearchContext)); if (newContext != NULL) { int Esize = gp_UpperBoundEdgeStorage((graphP)theGraph); *newContext = *context; newContext->theGraph = (graphP)theGraph; newContext->initialized = 0; _K4Search_ClearStructures(newContext); if (((graphP)theGraph)->N > 0) { if (_K4Search_CreateStructures(newContext) != OK) { _K4Search_FreeContext(newContext); newContext = NULL; return NULL; } memcpy(newContext->E, context->E, Esize * sizeof(K4Search_EdgeRec)); } } return newContext; } /******************************************************************** _K4Search_CopyData() ********************************************************************/ int _K4Search_CopyData(void *dstContext, void *srcContext) { K4SearchContext *dstK4Context = (K4SearchContext *)dstContext; K4SearchContext *srcK4Context = (K4SearchContext *)srcContext; int dstEdgeStorage, srcEdgeStorage; if (dstContext == NULL) return NOTOK; // If the srcContext is NULL, then the caller wants the data // structures in the dstContext to be reset/reinitialized if (srcContext == NULL) return _K4Search_InitStructures(dstK4Context); // ELSE: If there is also a srcContext, then we copy data from it dstEdgeStorage = gp_UpperBoundEdgeStorage(dstK4Context->theGraph); srcEdgeStorage = gp_UpperBoundEdgeStorage(srcK4Context->theGraph); // The caller (ultimately gp_CopyGraph()) is responsible for making sure that the // destination graph has enough edge capacity to receive the source graph content if (dstEdgeStorage < srcEdgeStorage) return NOTOK; // If the destination graph has more edge capacity, then we make sure that the // extra edge capacity is reinitialized if (dstEdgeStorage > srcEdgeStorage) { memset(dstK4Context->E, NIL_CHAR, gp_UpperBoundEdgeStorage(dstK4Context->theGraph) * sizeof(K4Search_EdgeRec)); } memcpy(dstK4Context->E, srcK4Context->E, gp_UpperBoundEdgeStorage(dstK4Context->theGraph) * sizeof(K4Search_EdgeRec)); return OK; } /******************************************************************** _K4Search_FreeContext() ********************************************************************/ void _K4Search_FreeContext(void *pContext) { K4SearchContext *context = (K4SearchContext *)pContext; _K4Search_ClearStructures(context); free(pContext); } /******************************************************************** ********************************************************************/ void _K4Search_InitEdgeRec(K4SearchContext *context, int e) { context->E[e].pathConnector = NIL; } /******************************************************************** _K4Search_HandleBlockedBicomp() Returns OK if no K4 homeomorph found and blockage cleared (OK to proceed with Walkdown embedding) NONEMBEDDABLE if K4 homeomorph found, and Walkdown embedding should be terminated. NOTOK on internal error ********************************************************************/ int _K4Search_HandleBlockedBicomp(graphP theGraph, int v, int RootVertex, int R) { K4SearchContext *context = NULL; gp_FindExtension(theGraph, K4SEARCH_ID, (void *)&context); if (context == NULL) return NOTOK; if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK4) { int RetVal = OK; // If invoked on a descendant bicomp, then we push its root then search once // since not finding a K4 homeomorph will also clear the blockage and allow // the Walkdown to continue walking down if (R != RootVertex) { sp_Push2(theGraph->theStack, R, 0); if ((RetVal = _SearchForK4InBicomp(theGraph, context, v, R)) == OK) { // If the Walkdown will be told it is OK to continue, then we have to take the descendant // bicomp root back off the stack so the Walkdown can try to descend to it again. // The top of stack has the pair R and 0/1 direction Walkdown traversal proceeds from R // Need only R, so pop and discard the direction, then pop R sp_Pop2_Discard1(theGraph->theStack, R); // And we have to clear the indicator of the minor A that was reduced, since it was eliminated. theGraphIC(theGraph)->minorType = MINORTYPE_NONE; } } // Otherwise, if invoked on a child bicomp rooted by a virtual copy of v, // then we search for a K4 homeomorph, and if OK is returned, then that indicates // the blockage has been cleared and it is OK to Walkdown the bicomp. // But the Walkdown finished, already, so we launch it again. // If the Walkdown returns OK then all forward edge records of "back" edges were embedded. // If NONEMBEDDABLE is returned, then the bicomp got blocked again, so we have to reiterate the K4 search else { // If Walkdown has recursively called this handler on the bicomp rooted by RootVertex, // then it is still blocked, so we just return NONEMBEDDABLE, which causes Walkdown to // return to the loop below and signal that the loop should invoke the Walkdown again. if (context->handlingBlockedBicomp) return NONEMBEDDABLE; context->handlingBlockedBicomp = TRUE; do { // Detect whether bicomp can be used to find a K4 homeomorph. It it does, then // it returns NONEMBEDDABLE so we break the search because we found the desired K4 // If OK is returned, then the blockage was cleared and it is OK to Walkdown again. if ((RetVal = _SearchForK4InBicomp(theGraph, context, v, RootVertex)) != OK) break; // Walkdown again to embed more edges. If Walkdown returns OK, then all remaining // edges to its descendants are embedded, so we'll get out of this loop. If Walkdown // detects that it still has not embedded all the edges to descendants of the bicomp's // root edge child, then Walkdown calls this routine again, and the above non-reentrancy // code returns NONEMBEDDABLE, causing this loop to search again for a K4. theGraphIC(theGraph)->minorType = MINORTYPE_NONE; RetVal = theGraph->functions->fpWalkDown(theGraph, v, RootVertex); // Except if the Walkdown returns NONEMBEDDABLE due to finding a K4 homeomorph entangled // with a descendant bicomp (the R != RootVertex case above), then it was found // entangled with Minor A, so we can stop the search if minor A is detected if (theGraphIC(theGraph)->minorType & MINORTYPE_A) break; } while (RetVal == NONEMBEDDABLE); context->handlingBlockedBicomp = FALSE; } return RetVal; } // else if we are not doing a K3,3 homeomorph search, then call the superclass to handle return context->functions.fpHandleBlockedBicomp(theGraph, v, RootVertex, R); } /******************************************************************** ********************************************************************/ int _K4Search_EmbedPostprocess(graphP theGraph, int v, int edgeEmbeddingResult) { int savedEmbedFlags = 0, savedZEROBASEDIO = 0; // For K4 search, we just return the edge embedding result because the // search result has been obtained already. if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK4) { if (edgeEmbeddingResult == OK) { // When a graph does not contain a K4 homeomorph, the embedding // is meaningless, so we empty it out. We preserve the embedFlags // to ensure post-processing continues as expected. savedEmbedFlags = gp_GetEmbedFlags(theGraph); savedZEROBASEDIO = gp_GetGraphFlags(theGraph) & GRAPHFLAGS_ZEROBASEDIO; gp_ResetGraphStorage(theGraph); theGraph->embedFlags = savedEmbedFlags; theGraph->graphFlags &= savedZEROBASEDIO; } return edgeEmbeddingResult; } // When not searching for K4, we let the superclass do the work else { K4SearchContext *context = NULL; gp_FindExtension(theGraph, K4SEARCH_ID, (void *)&context); if (context != NULL) { return context->functions.fpEmbedPostprocess(theGraph, v, edgeEmbeddingResult); } } return NOTOK; } /******************************************************************** ********************************************************************/ int _K4Search_CheckEmbeddingIntegrity(graphP theGraph, graphP origGraph) { if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK4) { return OK; } // When not searching for K4, we let the superclass do the work else { K4SearchContext *context = NULL; gp_FindExtension(theGraph, K4SEARCH_ID, (void *)&context); if (context != NULL) { return context->functions.fpCheckEmbeddingIntegrity(theGraph, origGraph); } } return NOTOK; } /******************************************************************** ********************************************************************/ int _K4Search_CheckObstructionIntegrity(graphP theGraph, graphP origGraph) { // When searching for K4, we ensure that theGraph is a subgraph of // the original graph and that it contains a K4 homeomorph if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_SEARCHFORK4) { int degrees[4], imageVerts[4]; if (_TestSubgraph(theGraph, origGraph) != TRUE) return NOTOK; if (_getImageVertices(theGraph, degrees, 3, imageVerts, 4) != OK) return NOTOK; if (_TestForCompleteGraphObstruction(theGraph, 4, degrees, imageVerts) == TRUE) { return OK; } return NOTOK; } // When not searching for K4, we let the superclass do the work else { K4SearchContext *context = NULL; gp_FindExtension(theGraph, K4SEARCH_ID, (void *)&context); if (context != NULL) { return context->functions.fpCheckObstructionIntegrity(theGraph, origGraph); } } return NOTOK; } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/io/000077500000000000000000000000001522057144000237035ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/planarity/c/graphLib/io/g6-api-utilities.c000066400000000000000000000122111522057144000271400ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include #include "../lowLevelUtils/appconst.h" /* Private function declarations (exported within system) */ size_t _g6_GetNumCharsForEncoding(int order); int _g6_GetNumCharsForOrder(int order); size_t _g6_GetExpectedNumPaddingZeroes(const int order, const size_t numChars); // NOTE: this method is used by g6_ReadGraph() to ensure that graphs after the // first one in the file have the same order, and by g6_WriteGraph() to ensure // that the encoding of the graph order at the beginning of the graph encoding // is correct. The G6 format specification does not have this restriction, but // the docs for Nauty's geng utility indicate that its output files will only // contain all graphs up to isomorphism for the single graph order specified // with the positional command line argument. int _g6_ValidateOrderOfEncodedGraph(char *graphBuff, int order); // NOTE: this method is now used to validate each graph we're reading in, as // well as to check the validity of the encoding produced before attempting to // write. int _g6_ValidateGraphEncoding(char *graphBuff, const int order, const size_t numChars); /* Private functions */ size_t _g6_GetMaxEdgeCount(int); size_t _g6_GetMaxEdgeCount(int order) { return ((size_t)order * (order - 1)) / 2; } size_t _g6_GetNumCharsForEncoding(int order) { size_t maxNumEdges = _g6_GetMaxEdgeCount(order); return (maxNumEdges / 6) + (maxNumEdges % 6 ? 1 : 0); } int _g6_GetNumCharsForOrder(int order) { if (order > 0 && order < 63) { return 1; } else if (order >= 63 && order <= 100000) { return 4; } return -1; } size_t _g6_GetExpectedNumPaddingZeroes(const int order, const size_t numChars) { size_t maxNumEdges = _g6_GetMaxEdgeCount(order); size_t expectedNumPaddingZeroes = numChars * 6 - maxNumEdges; return expectedNumPaddingZeroes; } int _g6_ValidateOrderOfEncodedGraph(char *graphBuff, int order) { int n = 0; char currChar = graphBuff[0]; if (currChar == 126) { if (graphBuff[1] == 126) { gp_ErrorMessage("Can only handle graphs of order <= 100,000."); return NOTOK; } else if (graphBuff[1] > 126) { gp_ErrorMessage("Invalid graph order signifier."); return NOTOK; } else { int orderCharIndex = 2; for (int i = 1; i < 4; i++) n |= (graphBuff[i] - 63) << (6 * orderCharIndex--); } } else if (currChar > 62 && currChar < 126) n = currChar - 63; else { gp_ErrorMessage("Character doesn't correspond to a printable ASCII " "character."); return NOTOK; } if (n != order) { gp_ErrorMessage("Graph order %d doesn't match expected graph order %d", n, order); return NOTOK; } return OK; } int _g6_ValidateGraphEncoding(char *graphBuff, const int order, const size_t numChars) { int exitCode = OK; size_t numPaddingZeroes = 0, numCharsForGraphEncoding = 0; size_t expectedNumPaddingZeroes = 0, expectedNumChars = 0; char finalByte = '\0'; if (graphBuff == NULL || strlen(graphBuff) == 0) { gp_ErrorMessage("Invalid encoding: graphBuff is NULL or empty."); return NOTOK; } expectedNumPaddingZeroes = _g6_GetExpectedNumPaddingZeroes(order, numChars); finalByte = graphBuff[numChars - 1] - 63; // Num edges of the graph (and therefore the number of bits) is (n * (n-1))/2, and // since each resulting byte needs to correspond to an ascii character between 63 and 126, // each group is only comprised of 6 bits (to which we add 63 for the final byte value) expectedNumChars = _g6_GetNumCharsForEncoding(order); numCharsForGraphEncoding = strlen(graphBuff); if (expectedNumChars != numCharsForGraphEncoding) { gp_ErrorMessage("Invalid number of bytes for graph of order %d; got %d " "but expected %d", order, (int)numCharsForGraphEncoding, (int)expectedNumChars); return NOTOK; } // Check that characters are valid ASCII characters between 62 and 126 for (size_t i = 0; i < numChars; i++) { if (graphBuff[i] < 63 || graphBuff[i] > 126) { gp_ErrorMessage("Invalid character at index %d: '%c'", (int)i, graphBuff[i]); return NOTOK; } } // Check that there are no extraneous bits in representation (since we pad out to a // multiple of 6 before splitting into bytes and adding 63 to each byte) for (size_t i = 0; i < expectedNumPaddingZeroes; i++) { if (finalByte & (1 << i)) break; numPaddingZeroes++; } if (numPaddingZeroes != expectedNumPaddingZeroes) { gp_ErrorMessage("Expected %d padding zeroes, but got %d.", (int)expectedNumPaddingZeroes, (int)numPaddingZeroes); exitCode = NOTOK; } return exitCode; } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/io/g6-read-iterator.c000066400000000000000000000547411522057144000271360ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include #include #include "strOrFile.h" #include "g6-read-iterator.h" // For definition of zero-based IO flag #include "graphIO.h" /* Imported functions */ extern size_t _g6_GetNumCharsForEncoding(int order); extern int _g6_GetNumCharsForOrder(int order); extern size_t _g6_GetExpectedNumPaddingZeroes(const int order, const size_t numChars); extern int _g6_ValidateOrderOfEncodedGraph(char *graphBuff, int order); extern int _g6_ValidateGraphEncoding(char *graphBuff, const int order, const size_t numChars); /* Private function declarations (exported within system) */ int _g6_ReadGraphFromStrOrFile(graphP theGraph, strOrFileP *pInputContainer); /* Private functions */ int _g6_InitReaderWithStrOrFile(G6ReadIteratorP theG6ReadIterator, strOrFileP *pInputContainer); int _g6_InitReader(G6ReadIteratorP theG6ReadIterator); int _g6_IsReaderInitialized(G6ReadIteratorP theG6ReadIterator, int reportUninitializedParts); int _g6_ValidateHeader(strOrFileP inputContainer); int _g6_ValidateFirstChar(char c, const int lineNum); int _g6_DetermineOrderFromInput(strOrFileP inputContainer, int *order); int _g6_DecodeGraph(char *graphBuff, const int order, const int numChars, graphP theGraph); int _g6_ReadGraphFromFile(graphP theGraph, char *pathToG6File); int _g6_ReadGraphFromString(graphP theGraph, char *g6EncodedString); /******************************************************************** Package private structure declaration for read iterator ********************************************************************/ typedef struct strOrFileStruct strOrFileStruct; typedef strOrFileStruct *strOrFileP; struct G6ReadIteratorStruct { strOrFileP inputContainer; int numGraphsRead; int order; int numCharsForOrder; size_t numCharsForGraphEncoding; size_t currGraphBuffSize; char *currGraphBuff; graphP currGraph; int endReached; }; /******************************************************************** Public and package private method implementations for read iterator ********************************************************************/ int g6_NewReader(G6ReadIteratorP *pG6ReadIterator, graphP theGraph) { int exitCode = OK; if (pG6ReadIterator == NULL) { gp_ErrorMessage("Unable to allocate G6ReadIterator, as pointer to " "which to assign address of memory allocated for " "G6ReadIterator is NULL."); return NOTOK; } if (pG6ReadIterator != NULL && (*pG6ReadIterator) != NULL) { gp_ErrorMessage("G6ReadIterator is not NULL and therefore can't be " "allocated."); return NOTOK; } // numGraphsRead, order, numCharsForOrder, numCharsForGraphEncoding, and // currGraphBuffSize all set to 0 (*pG6ReadIterator) = (G6ReadIteratorP)calloc(1, sizeof(G6ReadIteratorStruct)); if ((*pG6ReadIterator) == NULL) { gp_ErrorMessage("Unable to allocate memory for G6ReadIterator."); return NOTOK; } (*pG6ReadIterator)->inputContainer = NULL; if (theGraph == NULL) { gp_ErrorMessage("Must allocate graph to be used by G6ReadIterator."); g6_FreeReader(pG6ReadIterator); } else { (*pG6ReadIterator)->currGraph = theGraph; } return exitCode; } int _g6_IsReaderInitialized(G6ReadIteratorP theG6ReadIterator, int reportUninitializedParts) { int readerInitialized = TRUE; if (theG6ReadIterator == NULL) { if (reportUninitializedParts) gp_ErrorMessage("G6ReadIterator is NULL."); readerInitialized = FALSE; } else { if (!sf_IsValidStrOrFile(theG6ReadIterator->inputContainer)) { if (reportUninitializedParts) gp_ErrorMessage("G6ReadIterator's inputContainer string-or-file " "container is not valid."); readerInitialized = FALSE; } if (theG6ReadIterator->currGraphBuff == NULL) { if (reportUninitializedParts) gp_ErrorMessage("G6ReadIterator's currGraphBuff is NULL."); readerInitialized = FALSE; } if (theG6ReadIterator->currGraph == NULL) { if (reportUninitializedParts) gp_ErrorMessage("G6ReadIterator's currGraph is NULL."); readerInitialized = FALSE; } } return readerInitialized; } int g6_EndReached(G6ReadIteratorP theG6ReadIterator) { if (theG6ReadIterator == NULL) return TRUE; return theG6ReadIterator->endReached; } int g6_InitReaderWithString(G6ReadIteratorP theG6ReadIterator, char *inputString) { strOrFileP inputContainer = NULL; if (theG6ReadIterator == NULL) { gp_ErrorMessage("Invalid parameter: theG6ReadIterator must be non-NULL."); return NOTOK; } if (_g6_IsReaderInitialized(theG6ReadIterator, FALSE)) { gp_ErrorMessage("Unable to initialize reader, as it was already " "previously initialized."); return NOTOK; } if (inputString == NULL || strlen(inputString) == 0) { gp_ErrorMessage("Unable to initialize reader with empty input string."); return NOTOK; } if ((inputContainer = sf_NewInputContainer(inputString, NULL)) == NULL) { gp_ErrorMessage("Unable to initialize reader with string, as we failed " "to allocate the inputContainer."); return NOTOK; } return _g6_InitReaderWithStrOrFile( theG6ReadIterator, (&inputContainer)); } int g6_InitReaderWithFileName(G6ReadIteratorP theG6ReadIterator, char const *const infileName) { strOrFileP inputContainer = NULL; if (theG6ReadIterator == NULL) { gp_ErrorMessage("Invalid parameter: theG6ReadIterator must be non-NULL."); return NOTOK; } if (_g6_IsReaderInitialized(theG6ReadIterator, FALSE)) { gp_ErrorMessage( "Unable to initialize reader, as it was already previously " "initialized.\n"); return NOTOK; } if (infileName == NULL || strlen(infileName) == 0) { gp_ErrorMessage("Unable to initialize reader with empty infile name."); return NOTOK; } if ((inputContainer = sf_NewInputContainer(NULL, infileName)) == NULL) { gp_ErrorMessage("Unable to initialize reader with file name, as we " "failed to allocate the inputContainer."); return NOTOK; } return _g6_InitReaderWithStrOrFile( theG6ReadIterator, (&inputContainer)); } int _g6_InitReaderWithStrOrFile(G6ReadIteratorP theG6ReadIterator, strOrFileP *pInputContainer) { if (theG6ReadIterator == NULL) { gp_ErrorMessage("Invalid parameter: theG6ReadIterator must be non-NULL."); return NOTOK; } if (pInputContainer == NULL || !sf_IsValidStrOrFile((*pInputContainer))) { gp_ErrorMessage("Unable to initialize reader with invalid strOrFile " "input container."); return NOTOK; } theG6ReadIterator->inputContainer = (*pInputContainer); // We have taken ownership of the inputContainer, and so we have set the // caller's pointer to NULL. The reader is responsible for freeing this // input container. (*pInputContainer) = NULL; return _g6_InitReader(theG6ReadIterator); } int _g6_InitReader(G6ReadIteratorP theG6ReadIterator) { char charConfirmation = EOF; int firstChar = '\0'; int lineNum = 1; int order = NIL; strOrFileP inputContainer = theG6ReadIterator->inputContainer; if ((firstChar = sf_getc(inputContainer)) == EOF) { gp_ErrorMessage("Unable to initialize reader: .g6 infile is empty."); return NOTOK; } else { charConfirmation = sf_ungetc((char)firstChar, inputContainer); if (charConfirmation != firstChar) { gp_ErrorMessage("Unable to initialize reader due to failure to " "ungetc first character."); return NOTOK; } if (firstChar == '>') { if (_g6_ValidateHeader(inputContainer) != OK) { gp_ErrorMessage("Unable to initialize reader due to inability " "to process and check .g6 infile header."); return NOTOK; } } } firstChar = sf_getc(inputContainer); charConfirmation = sf_ungetc((char)firstChar, inputContainer); if (charConfirmation != firstChar) { gp_ErrorMessage("Unable to initialize reader due to failure to ungetc " "first character."); return NOTOK; } if (_g6_ValidateFirstChar((char)firstChar, lineNum) != OK) return NOTOK; // Despite the general specification indicating that n \in [0, 68,719,476,735], // in practice n will be limited such that an integer will suffice in storing it. if (_g6_DetermineOrderFromInput(inputContainer, &order) != OK) { gp_ErrorMessage("Unable to initialize reader due to invalid graph " "order on line %d of .g6 file.", lineNum); return NOTOK; } if (gp_GetN(theG6ReadIterator->currGraph) == 0) { if (gp_EnsureVertexCapacity(theG6ReadIterator->currGraph, order) != OK) { gp_ErrorMessage("Unable to initialize reader due to failure " "initializing graph datastructure with order %d " "for graph on line %d of the .g6 file.", order, lineNum); return NOTOK; } theG6ReadIterator->order = order; } else { if (gp_GetN(theG6ReadIterator->currGraph) != order) { gp_ErrorMessage("Unable to initialize reader, as graph structure " "passed in was already initialized with order " "%d, which doesn't match the graph order %d " "specified in the file.", gp_GetN(theG6ReadIterator->currGraph), order); return NOTOK; } else { gp_ResetGraphStorage(theG6ReadIterator->currGraph); theG6ReadIterator->order = order; } } // Ensures zero-based flag is set regardless of whether the graph was initialized or reinitialized. theG6ReadIterator->currGraph->graphFlags |= GRAPHFLAGS_ZEROBASEDIO; theG6ReadIterator->numCharsForOrder = _g6_GetNumCharsForOrder(order); theG6ReadIterator->numCharsForGraphEncoding = _g6_GetNumCharsForEncoding(order); // Must add 3 bytes for newline, possible carriage return, and null terminator theG6ReadIterator->currGraphBuffSize = theG6ReadIterator->numCharsForOrder + theG6ReadIterator->numCharsForGraphEncoding + 3; theG6ReadIterator->currGraphBuff = (char *)calloc(theG6ReadIterator->currGraphBuffSize, sizeof(char)); if (theG6ReadIterator->currGraphBuff == NULL) { gp_ErrorMessage("Unable to allocate memory for currGraphBuff."); return NOTOK; } return OK; } int _g6_ValidateHeader(strOrFileP inputContainer) { char const *g6Header = ">>graph6<<"; char const *sparse6Header = ">>sparse6<"; char const *digraph6Header = ">>digraph6"; char headerCandidateChars[11]; headerCandidateChars[0] = '\0'; if (inputContainer == NULL) { gp_ErrorMessage("Invalid .g6 string-or-file container."); return NOTOK; } for (int i = 0; i < 10; i++) { headerCandidateChars[i] = sf_getc(inputContainer); } headerCandidateChars[10] = '\0'; if (strcmp(g6Header, headerCandidateChars) != 0) { if (strcmp(sparse6Header, headerCandidateChars) == 0) gp_ErrorMessage("Graph file is sparse6 format, which is not " "supported."); else if (strcmp(digraph6Header, headerCandidateChars) == 0) gp_ErrorMessage("Graph file is digraph6 format, which is not " "supported."); else gp_ErrorMessage("Invalid header for .g6 file."); return NOTOK; } return OK; } int _g6_ValidateFirstChar(char c, const int lineNum) { if (strchr(":;&", c) != NULL) { gp_ErrorMessage("Invalid first character on line %d, i.e. one of ':', " "';', or '&'.", lineNum); return NOTOK; } return OK; } int _g6_DetermineOrderFromInput(strOrFileP inputContainer, int *order) { int n = 0; int graphChar = '\0'; if (inputContainer == NULL) { gp_ErrorMessage("Invalid string-or-file container for .g6 input."); return NOTOK; } // Since geng: n must be in the range 1..32, and since edge-addition-planarity-suite // processing of random graphs may only handle up to n = 100,000, we will only check // if 1 or 4 bytes are necessary if ((graphChar = sf_getc(inputContainer)) == 126) { if ((graphChar = sf_getc(inputContainer)) == 126) { gp_ErrorMessage("Graphs of order n > 100000 are not supported at " "this time."); return NOTOK; } sf_ungetc((char)graphChar, inputContainer); for (int i = 2; i >= 0; i--) { graphChar = sf_getc(inputContainer) - 63; n |= graphChar << (6 * i); } if (n > 100000) { gp_ErrorMessage("Graph order greater than 100000 not supported."); return NOTOK; } } else if (graphChar > 62 && graphChar < 126) n = graphChar - 63; else { gp_ErrorMessage("Graph order is too small; character doesn't " "correspond to a printable ASCII character."); return NOTOK; } (*order) = n; return OK; } int g6_ReadGraph(G6ReadIteratorP theG6ReadIterator) { strOrFileP inputContainer = NULL; int lineNum = 0; char *currGraphBuff = NULL; char firstChar = '\0'; char *graphEncodingChars = NULL; graphP currGraph = NULL; const int order = theG6ReadIterator == NULL ? 0 : theG6ReadIterator->order; const int numCharsForOrder = theG6ReadIterator == NULL ? 0 : theG6ReadIterator->numCharsForOrder; const int numCharsForGraphEncoding = theG6ReadIterator == NULL ? 0 : theG6ReadIterator->numCharsForGraphEncoding; const int currGraphBuffSize = theG6ReadIterator == NULL ? 0 : theG6ReadIterator->currGraphBuffSize; if (!_g6_IsReaderInitialized(theG6ReadIterator, TRUE)) { gp_ErrorMessage("G6ReadIterator is not initialized."); return NOTOK; } inputContainer = theG6ReadIterator->inputContainer; lineNum = theG6ReadIterator->numGraphsRead + 1; currGraphBuff = theG6ReadIterator->currGraphBuff; currGraph = theG6ReadIterator->currGraph; if (sf_fgets(currGraphBuff, currGraphBuffSize, inputContainer) != NULL) { firstChar = currGraphBuff[0]; if (_g6_ValidateFirstChar(firstChar, lineNum) != OK) return NOTOK; // From https://stackoverflow.com/a/28462221, strcspn finds the index of the first // char in charset; this way, I replace the char at that index with the null-terminator currGraphBuff[strcspn(currGraphBuff, "\n\r")] = '\0'; // works for LF, CR, CRLF, LFCR, ... // If the line was too long, then we would have placed the null terminator at the final // index (where it already was; see strcpn docs), and the length of the string will be // longer than the line should have been, i.e. orderOffset + numCharsForGraphRepr if ((int)strlen(currGraphBuff) != (((lineNum == 1) ? 0 : numCharsForOrder) + numCharsForGraphEncoding)) { gp_ErrorMessage("Invalid line length read on line %d", lineNum); return NOTOK; } if (lineNum > 1) { if (_g6_ValidateOrderOfEncodedGraph(currGraphBuff, order) != OK) { gp_ErrorMessage("Order of graph on line %d is incorrect.", lineNum); return NOTOK; } } // On first line, we have already processed the characters corresponding to the graph // order, so there's no need to apply the offset. On subsequent lines, the orderOffset // must be applied so that we are only starting validation on the byte corresponding to // the encoding of the adjacency matrix. graphEncodingChars = (lineNum == 1) ? currGraphBuff : currGraphBuff + numCharsForOrder; if (_g6_ValidateGraphEncoding(graphEncodingChars, order, numCharsForGraphEncoding) != OK) { gp_ErrorMessage("Graph on line %d is invalid.", lineNum); return NOTOK; } if (lineNum > 1) { gp_ResetGraphStorage(currGraph); // Ensures zero-based flag is set after reinitializing graph. currGraph->graphFlags |= GRAPHFLAGS_ZEROBASEDIO; } if (_g6_DecodeGraph(graphEncodingChars, order, numCharsForGraphEncoding, currGraph) != OK) { gp_ErrorMessage("Unable to interpret bits on line %d to populate " "adjacency matrix.", lineNum); return NOTOK; } theG6ReadIterator->numGraphsRead = lineNum; } else { theG6ReadIterator->endReached = TRUE; } return OK; } // Takes the character array graphBuff, the derived number of vertices order, // and the numChars corresponding to the number of characters after the first byte // and performs the inverse transformation of the graph encoding: we subtract 63 from // each byte, then only process the 6 least significant bits of the resulting byte. For // the final byte, we determine how many padding zeroes to expect, and exclude them // from being processed. We index into the adjacency matrix by row and column, which // are incremented such that row ranges from 0 to one less than the column index. int _g6_DecodeGraph(char *graphBuff, const int order, const int numChars, graphP theGraph) { int numPaddingZeroes = _g6_GetExpectedNumPaddingZeroes(order, numChars); char currByte = '\0'; int bitValue = 0; int row = 0; int col = 1; if (theGraph == NULL) { gp_ErrorMessage("Must initialize graph datastructure before decoding " "the graph representation."); return NOTOK; } for (int i = 0; i < numChars; i++) { currByte = graphBuff[i] - 63; // j corresponds to the number of places one must bitshift the byte by // to read the next bit in the byte for (int j = sizeof(char) * 5; j >= 0; j--) { // If we are on the final byte, we know that the final // numPaddingZeroes bits can be ignored, so we break out of the loop if ((i == numChars) && j == numPaddingZeroes - 1) break; if (row == col) { row = 0; col++; } bitValue = ((currByte >> j) & 1u) ? 1 : 0; if (bitValue == 1) { // Also add the offset to the first vertex in in-memory storage, // because the G6 file is 0-based, but im-memory storage may not be. if (gp_DynamicAddEdge(theGraph, row + gp_LowerBoundVertexStorage(theGraph), 0, col + gp_LowerBoundVertexStorage(theGraph), 0) != OK) return NOTOK; } row++; } } return OK; } void g6_FreeReader(G6ReadIteratorP *pG6ReadIterator) { if (pG6ReadIterator != NULL && (*pG6ReadIterator) != NULL) { if ((*pG6ReadIterator)->inputContainer != NULL) sf_Free(&((*pG6ReadIterator)->inputContainer)); (*pG6ReadIterator)->numGraphsRead = 0; (*pG6ReadIterator)->order = 0; if ((*pG6ReadIterator)->currGraphBuff != NULL) { free((*pG6ReadIterator)->currGraphBuff); (*pG6ReadIterator)->currGraphBuff = NULL; } (*pG6ReadIterator)->currGraph = NULL; free((*pG6ReadIterator)); (*pG6ReadIterator) = NULL; } } int _g6_ReadGraphFromFile(graphP theGraph, char *pathToG6File) { strOrFileP inputContainer = NULL; if (pathToG6File == NULL || strlen(pathToG6File) == 0) { gp_ErrorMessage("Unable to read graph from file, as pathToG6File is " "NULL or empty string."); return NOTOK; } if ((inputContainer = sf_NewInputContainer(NULL, pathToG6File)) == NULL) { gp_ErrorMessage("Unable to allocate strOrFile container for infile " "\"%.*s\".", FILENAME_MAX, pathToG6File); return NOTOK; } return _g6_ReadGraphFromStrOrFile(theGraph, (&inputContainer)); } int _g6_ReadGraphFromString(graphP theGraph, char *g6EncodedString) { strOrFileP inputContainer = NULL; if (g6EncodedString == NULL || strlen(g6EncodedString) == 0) { gp_ErrorMessage("Unable to proceed with empty .g6 input string."); return NOTOK; } if ((inputContainer = sf_NewInputContainer(g6EncodedString, NULL)) == NULL) { gp_ErrorMessage("Unable to allocate strOrFile container for .g6 input " "string."); return NOTOK; } return _g6_ReadGraphFromStrOrFile(theGraph, (&inputContainer)); } int _g6_ReadGraphFromStrOrFile(graphP theGraph, strOrFileP *pInputContainer) { G6ReadIteratorP theG6ReadIterator = NULL; if (!sf_IsValidStrOrFile((*pInputContainer))) { gp_ErrorMessage("Invalid G6 output container."); return NOTOK; } if (g6_NewReader((&theG6ReadIterator), theGraph) != OK) { gp_ErrorMessage("Unable to allocate G6ReadIterator."); return NOTOK; } // NOTE: (*pInputContainer) will be NULL after we return from this call, // since the read iterator will take ownership of the input container. if (_g6_InitReaderWithStrOrFile(theG6ReadIterator, pInputContainer) != OK) { gp_ErrorMessage("Unable to initialize G6ReadIterator."); g6_FreeReader((&theG6ReadIterator)); return NOTOK; } if (g6_ReadGraph(theG6ReadIterator) != OK) gp_ErrorMessage("Unable to read graph from .g6 read iterator."); g6_FreeReader((&theG6ReadIterator)); return OK; } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/io/g6-read-iterator.h000066400000000000000000000015371522057144000271360ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #ifndef G6_READ_ITERATOR #define G6_READ_ITERATOR #ifdef __cplusplus extern "C" { #endif #include #include "../graph.h" typedef struct G6ReadIteratorStruct G6ReadIteratorStruct; typedef G6ReadIteratorStruct *G6ReadIteratorP; int g6_NewReader(G6ReadIteratorP *pG6ReadIterator, graphP theGraph); int g6_InitReaderWithString(G6ReadIteratorP theG6ReadIterator, char *inputString); int g6_InitReaderWithFileName(G6ReadIteratorP theG6ReadIterator, char const *const infileName); int g6_ReadGraph(G6ReadIteratorP theG6ReadIterator); int g6_EndReached(G6ReadIteratorP theG6ReadIterator); void g6_FreeReader(G6ReadIteratorP *pG6ReadIterator); #ifdef __cplusplus } #endif #endif /* G6_READ_ITERATOR */ graph-algorithms-planarity-08d7b51/planarity/c/graphLib/io/g6-write-iterator.c000066400000000000000000000514561522057144000273550ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include #include #include "strOrFile.h" #include "g6-write-iterator.h" /* Imported functions */ extern size_t _g6_GetNumCharsForEncoding(int order); extern int _g6_GetNumCharsForOrder(int order); extern int _g6_ValidateOrderOfEncodedGraph(char *graphBuff, int order); extern int _g6_ValidateGraphEncoding(char *graphBuff, const int order, const size_t numChars); /* Private function declarations (exported within system) */ int _g6_WriteGraphToStrOrFile(graphP theGraph, strOrFileP *pOutputContainer); /* Private functions */ int _g6_InitWriterWithStrOrFile(G6WriteIteratorP theG6WriteIterator, strOrFileP *pOutputContainer); int _g6_InitWriter(G6WriteIteratorP theG6WriteIterator); int _g6_IsWriterInitialized(G6WriteIteratorP theG6WriteIterator, int reportUninitializedParts); void _g6_PrecomputeColumnOffsets(size_t *columnOffsets, int order); void _g6_EncodeAdjMatAsG6(G6WriteIteratorP theG6WriteIterator); void _g6_GetFirstEdgeInUse(graphP theGraph, int *e, int *u, int *v); void _g6_GetNextEdgeInUse(graphP theGraph, int *e, int *u, int *v); int _g6_WriteEncodedGraph(G6WriteIteratorP theG6WriteIterator); int _g6_WriteGraphToFile(graphP theGraph, char *g6OutputFileName); int _g6_WriteGraphToString(graphP theGraph, char **pOutputStr); /******************************************************************** Package private structure declaration for write iterator ********************************************************************/ typedef struct strOrFileStruct strOrFileStruct; typedef strOrFileStruct *strOrFileP; struct G6WriteIteratorStruct { strOrFileP outputContainer; int order; int numCharsForOrder; size_t numCharsForGraphEncoding; size_t currGraphBuffSize; char *currGraphBuff; size_t *columnOffsets; graphP currGraph; }; /******************************************************************** Public and package private method implementations for write iterator ********************************************************************/ int g6_NewWriter(G6WriteIteratorP *pG6WriteIterator, graphP theGraph) { if (pG6WriteIterator == NULL) { gp_ErrorMessage( "Unable to allocate G6WriteIterator, as pointer to which to assign " "address of memory allocated for G6WriteIterator is NULL.\n"); return NOTOK; } if (pG6WriteIterator != NULL && (*pG6WriteIterator) != NULL) { gp_ErrorMessage("G6WriteIterator is not NULL and therefore can't be " "allocated."); return NOTOK; } if (theGraph == NULL || gp_GetN(theGraph) <= 0) { gp_ErrorMessage("Must allocate and initialize graph with an order " "greater than 0 to use the G6WriteIterator."); return NOTOK; } // order, numCharsForOrder, numCharsForGraphEncoding, and currGraphBuffSize // all set to 0 (*pG6WriteIterator) = (G6WriteIteratorP)calloc(1, sizeof(G6WriteIteratorStruct)); if ((*pG6WriteIterator) == NULL) { gp_ErrorMessage("Unable to allocate memory for G6WriteIterator."); return NOTOK; } (*pG6WriteIterator)->outputContainer = NULL; (*pG6WriteIterator)->currGraphBuff = NULL; (*pG6WriteIterator)->columnOffsets = NULL; (*pG6WriteIterator)->currGraph = theGraph; return OK; } int _g6_IsWriterInitialized(G6WriteIteratorP theG6WriteIterator, int reportUninitializedParts) { int writerIsInitialized = TRUE; if (theG6WriteIterator == NULL) { if (reportUninitializedParts) gp_ErrorMessage("G6WriteIterator is NULL."); writerIsInitialized = FALSE; } else { if (!sf_IsValidStrOrFile(theG6WriteIterator->outputContainer)) { if (reportUninitializedParts) gp_ErrorMessage("G6WriteIterator's outputContainer is not " "valid."); writerIsInitialized = FALSE; } if (theG6WriteIterator->currGraphBuff == NULL) { if (reportUninitializedParts) gp_ErrorMessage("G6WriteIterator's currGraphBuff is NULL."); writerIsInitialized = FALSE; } if (theG6WriteIterator->columnOffsets == NULL) { if (reportUninitializedParts) gp_ErrorMessage("G6WriteIterator's columnOffsets is NULL."); writerIsInitialized = FALSE; } if (theG6WriteIterator->currGraph == NULL) { if (reportUninitializedParts) gp_ErrorMessage("G6WriteIterator's currGraph is NULL."); writerIsInitialized = FALSE; } else { if (gp_GetN(theG6WriteIterator->currGraph) == 0) { if (reportUninitializedParts) gp_ErrorMessage("G6WriteIterator's currGraph does not " "contain a valid graph."); writerIsInitialized = FALSE; } } } return writerIsInitialized; } int g6_InitWriterWithString(G6WriteIteratorP theG6WriteIterator, char **pOutputString) { strOrFileP outputContainer = NULL; if (theG6WriteIterator == NULL) { gp_ErrorMessage("Invalid parameter: theG6WriteIterator must be " "non-NULL."); return NOTOK; } if (_g6_IsWriterInitialized(theG6WriteIterator, FALSE)) { gp_ErrorMessage( "Unable to initialize writer, as it was already previously " "initialized."); return NOTOK; } if (pOutputString == NULL) { gp_ErrorMessage("Unable to initialize writer with string, as pointer " "to which to assign address of output string is NULL."); return NOTOK; } if ((*pOutputString) != NULL) { gp_ErrorMessage("Unable to initialize writer with string, as pointer " "to which to assign address of output string points to " "allocated memory."); return NOTOK; } if ((outputContainer = sf_NewOutputContainer(pOutputString, NULL)) == NULL) { gp_ErrorMessage("Unable to initialize writer with string, as we failed " "to allocate the outputContainer."); return NOTOK; } return _g6_InitWriterWithStrOrFile( theG6WriteIterator, (&outputContainer)); } int g6_InitWriterWithFileName(G6WriteIteratorP theG6WriteIterator, char *outputFileName) { strOrFileP outputContainer = NULL; if (theG6WriteIterator == NULL) { gp_ErrorMessage("Invalid parameter: theG6WriteIterator must be " "non-NULL."); return NOTOK; } if (_g6_IsWriterInitialized(theG6WriteIterator, FALSE)) { gp_ErrorMessage("Unable to initialize writer, as it was already " "previously initialized."); return NOTOK; } if (outputFileName == NULL || strlen(outputFileName) == 0) { gp_ErrorMessage("Unable to initialize writer with NULL or empty output " "file name."); return NOTOK; } if ((outputContainer = sf_NewOutputContainer(NULL, outputFileName)) == NULL) { gp_ErrorMessage("Unable to initialize writer with file name, as we " "failed to allocate the outputContainer."); return NOTOK; } return _g6_InitWriterWithStrOrFile( theG6WriteIterator, (&outputContainer)); } int _g6_InitWriterWithStrOrFile(G6WriteIteratorP theG6WriteIterator, strOrFileP *pOutputContainer) { if (theG6WriteIterator == NULL) { gp_ErrorMessage("Invalid parameter: theG6WriteIterator must be " "non-NULL."); return NOTOK; } if (_g6_IsWriterInitialized(theG6WriteIterator, FALSE)) { gp_ErrorMessage("Unable to initialize writer, as it was already " "previously initialized."); return NOTOK; } if (!sf_IsValidStrOrFile((*pOutputContainer))) { gp_ErrorMessage("Unable to initialize writer with invalid strOrFile " "output container."); return NOTOK; } theG6WriteIterator->outputContainer = (*pOutputContainer); // We have taken ownership of the outputContainer, and so we have set the // caller's pointer to NULL. The writer is responsible for freeing this // output container. (*pOutputContainer) = NULL; return _g6_InitWriter(theG6WriteIterator); } int _g6_InitWriter(G6WriteIteratorP theG6WriteIterator) { char const *g6Header = ">>graph6<<"; theG6WriteIterator->order = gp_GetN(theG6WriteIterator->currGraph); if (theG6WriteIterator->order > 100000) { gp_ErrorMessage("Graphs of order n > 100000 are not supported at this " "time."); return NOTOK; } if (sf_fputs(g6Header, theG6WriteIterator->outputContainer) < 0) { gp_ErrorMessage("Unable to initialize writer due to failure to fputs " "header to outputContainer."); return NOTOK; } theG6WriteIterator->columnOffsets = (size_t *)calloc(theG6WriteIterator->order + 1, sizeof(size_t)); if (theG6WriteIterator->columnOffsets == NULL) { gp_ErrorMessage("Unable to initialize writer due to failure to " "allocate memory for column offsets."); return NOTOK; } _g6_PrecomputeColumnOffsets(theG6WriteIterator->columnOffsets, theG6WriteIterator->order); theG6WriteIterator->numCharsForOrder = _g6_GetNumCharsForOrder(theG6WriteIterator->order); theG6WriteIterator->numCharsForGraphEncoding = _g6_GetNumCharsForEncoding(theG6WriteIterator->order); // Must add 3 bytes for newline, possible carriage return, and null terminator theG6WriteIterator->currGraphBuffSize = theG6WriteIterator->numCharsForOrder + theG6WriteIterator->numCharsForGraphEncoding + 3; theG6WriteIterator->currGraphBuff = (char *)calloc(theG6WriteIterator->currGraphBuffSize, sizeof(char)); if (theG6WriteIterator->currGraphBuff == NULL) { gp_ErrorMessage("Unable to initialize writer due to failure to " "allocate memory for currGraphBuff."); return NOTOK; } return OK; } /* * NOTE: columnOffsets is an array of size_t rather than of int, because for a * graph with N <= 100000, the index for an edge can be as large as * (100000 * 99999) / 2, which overflows the size of a signed integer. */ void _g6_PrecomputeColumnOffsets(size_t *columnOffsets, int order) { if (columnOffsets == NULL) { gp_ErrorMessage("Must allocate columnOffsets memory before " "precomputation."); return; } columnOffsets[0] = 0; columnOffsets[1] = 0; for (int i = 2; i <= order; i++) columnOffsets[i] = columnOffsets[i - 1] + (i - 1); } int g6_WriteGraph(G6WriteIteratorP theG6WriteIterator) { char *graphEncodingChars = NULL; if (!_g6_IsWriterInitialized(theG6WriteIterator, TRUE)) { gp_ErrorMessage("Unable to write graph because G6WriteIterator is not " "initialized."); return NOTOK; } _g6_EncodeAdjMatAsG6(theG6WriteIterator); if (_g6_ValidateOrderOfEncodedGraph(theG6WriteIterator->currGraphBuff, theG6WriteIterator->order) != OK) { gp_ErrorMessage("Unable to write graph, as constructed encoding has " "incorrect order."); return NOTOK; } graphEncodingChars = theG6WriteIterator->currGraphBuff + theG6WriteIterator->numCharsForOrder; if (_g6_ValidateGraphEncoding(graphEncodingChars, theG6WriteIterator->order, theG6WriteIterator->numCharsForGraphEncoding) != OK) { gp_ErrorMessage("Unable to write graph, as constructed encoding is " "invalid."); return NOTOK; } if (_g6_WriteEncodedGraph(theG6WriteIterator) != OK) { gp_ErrorMessage("Unable to write g6 encoded graph to output " "container."); return NOTOK; } return OK; } void _g6_EncodeAdjMatAsG6(G6WriteIteratorP theG6WriteIterator) { char *g6Encoding = NULL; size_t *columnOffsets = NULL; graphP theGraph = NULL; int order = 0; int numCharsForOrder = 0; size_t numCharsForGraphEncoding = 0; size_t totalNumCharsForOrderAndGraph = 0; int u = NIL, v = NIL, e = NIL; size_t charOffset = 0; int bitPositionPower = 0; int bitPosition = 0; g6Encoding = theG6WriteIterator->currGraphBuff; columnOffsets = theG6WriteIterator->columnOffsets; theGraph = theG6WriteIterator->currGraph; // memset ensures all bits are zero, which means we only need to set the bits // that correspond to an edge; this also takes care of padding zeroes for us memset(theG6WriteIterator->currGraphBuff, 0, (theG6WriteIterator->currGraphBuffSize) * sizeof(char)); order = theG6WriteIterator->order; numCharsForOrder = theG6WriteIterator->numCharsForOrder; numCharsForGraphEncoding = theG6WriteIterator->numCharsForGraphEncoding; totalNumCharsForOrderAndGraph = numCharsForOrder + numCharsForGraphEncoding; if (order > 62) { // bytes 1 through 3 will be populated with the 18-bit representation of the graph order int intermediate = -1; g6Encoding[0] = 126; for (int i = 0; i < 3; i++) { intermediate = order >> (6 * i); g6Encoding[3 - i] = intermediate & 63; g6Encoding[3 - i] += 63; } } else if (order > 1 && order < 63) { g6Encoding[0] = (char)(order + 63); } u = v = e = NIL; _g6_GetFirstEdgeInUse(theGraph, &e, &u, &v); charOffset = bitPositionPower = 0; while (u != NIL && v != NIL) { // The in-memory vertex storage may 1-based or 0-based, so we subtract the index // of the first vertex in storage because the .g6 format is 0-based u -= gp_LowerBoundVertexStorage(theGraph); v -= gp_LowerBoundVertexStorage(theGraph); // The columnOffset machinery assumes that we are traversing the edges represented in // the upper-triangular matrix. Since we are dealing with simple graphs, if (v, u) // exists, then (u, v) exists, and so the edge is indicated by a 1 in row = min(u, v) // and col = max(u, v) in the upper-triangular adjacency matrix. if (v < u) { int tempVert = v; v = u; u = tempVert; } // (columnOffsets[v] + u) describes the bit index of the current edge // given the column and row in the adjacency matrix representation; // the byte is floor((columnOffsets[v] + u) / 6) and the we determine which // bit to set in that byte by left-shifting 1 by (5 - ((columnOffsets[v] + u) % 6)) // (transforming the ((columnOffsets[v] + u) % 6)th bit from the left to the // (5 - ((columnOffsets[v] + u) % 6))th bit from the right) // NOTE: We've made columnOffsets an array of size_t because as N approaches // 100000, the size of this calculation can exceed the limit of a signed // integer charOffset = numCharsForOrder + ((columnOffsets[v] + u) / 6); bitPositionPower = 5 - ((columnOffsets[v] + u) % 6); bitPosition = (1u << bitPositionPower); g6Encoding[charOffset] |= bitPosition; _g6_GetNextEdgeInUse(theGraph, &e, &u, &v); } // Bytes corresponding to graph order have already been modified to // correspond to printable ascii character (i.e. by adding 63); must // now do the same for bytes corresponding to edge lists for (size_t i = numCharsForOrder; i < totalNumCharsForOrderAndGraph; i++) g6Encoding[i] += 63; } void _g6_GetFirstEdgeInUse(graphP theGraph, int *e, int *u, int *v) { (*e) = NIL; _g6_GetNextEdgeInUse(theGraph, e, u, v); } void _g6_GetNextEdgeInUse(graphP theGraph, int *e, int *u, int *v) { (*u) = NIL; (*v) = NIL; if ((*e) == NIL) (*e) = gp_LowerBoundEdges(theGraph); else (*e) += 2; if ((*e) < gp_UpperBoundEdges(theGraph)) { while (!gp_EdgeInUse(theGraph, (*e))) { (*e) += 2; if ((*e) >= gp_UpperBoundEdges(theGraph)) break; } if ((*e) < gp_UpperBoundEdges(theGraph) && gp_EdgeInUse(theGraph, (*e))) { (*u) = gp_GetNeighbor(theGraph, (*e)); (*v) = gp_GetNeighbor(theGraph, gp_GetTwin(theGraph, (*e))); } } } int _g6_WriteEncodedGraph(G6WriteIteratorP theG6WriteIterator) { if (sf_fputs(theG6WriteIterator->currGraphBuff, theG6WriteIterator->outputContainer) < 0) { gp_ErrorMessage("Failed to output all characters of g6 encoding."); return NOTOK; } if (sf_fputs("\n", theG6WriteIterator->outputContainer) < 0) { gp_ErrorMessage("Failed to put line terminator after g6 encoding."); return NOTOK; } return OK; } // If the writer is initialized with string, then when we free the writer this // method will give the allocated string back to the user. // NOTE: This setting will occur if any writer operations returned NOTOK, so the // caller is responsible for checking if the string is NULL and freeing it in // all cases. void g6_FreeWriter(G6WriteIteratorP *pG6WriteIterator) { if (pG6WriteIterator != NULL && (*pG6WriteIterator) != NULL) { if ((*pG6WriteIterator)->outputContainer != NULL) sf_Free((&((*pG6WriteIterator)->outputContainer))); (*pG6WriteIterator)->order = 0; if ((*pG6WriteIterator)->currGraphBuff != NULL) { free((*pG6WriteIterator)->currGraphBuff); (*pG6WriteIterator)->currGraphBuff = NULL; } if ((*pG6WriteIterator)->columnOffsets != NULL) { free(((*pG6WriteIterator)->columnOffsets)); (*pG6WriteIterator)->columnOffsets = NULL; } // N.B. The G6WriteIterator doesn't "own" the graph, so we don't free it. (*pG6WriteIterator)->currGraph = NULL; free((*pG6WriteIterator)); (*pG6WriteIterator) = NULL; } } int _g6_WriteGraphToFile(graphP theGraph, char *g6OutputFileName) { strOrFileP outputContainer = NULL; if (g6OutputFileName == NULL || strlen(g6OutputFileName) == 0) { gp_ErrorMessage("Unable to write graph to file, as output file name " "supplied is NULL or empty."); return NOTOK; } if ((outputContainer = sf_NewOutputContainer(NULL, g6OutputFileName)) == NULL) { gp_ErrorMessage("Unable to allocate outputContainer to which to " "write."); return NOTOK; } return _g6_WriteGraphToStrOrFile(theGraph, (&outputContainer)); } int _g6_WriteGraphToString(graphP theGraph, char **pOutputStr) { strOrFileP outputContainer = NULL; if (pOutputStr == NULL) { gp_ErrorMessage("If writing G6 to string, must provide pointer-pointer " "to allow _g6_WriteGraphToString() to assign the " "address of the output string."); return NOTOK; } if ((*pOutputStr) != NULL) { gp_ErrorMessage("(*pOutputStr) should not point to allocated memory."); return NOTOK; } if ((outputContainer = sf_NewOutputContainer(pOutputStr, NULL)) == NULL) { gp_ErrorMessage("Unable to allocate outputContainer to which to " "write."); return NOTOK; } // N.B. Once the graph is successfully written, the string is taken from // the G6WriteIterator's outputContainer and assigned to (*pOutputStr) // before freeing the G6 write iterator. return _g6_WriteGraphToStrOrFile(theGraph, (&outputContainer)); } int _g6_WriteGraphToStrOrFile(graphP theGraph, strOrFileP *pOutputContainer) { G6WriteIteratorP theG6WriteIterator = NULL; if (!sf_IsValidStrOrFile((*pOutputContainer))) { gp_ErrorMessage("Invalid G6 output container."); return NOTOK; } if (g6_NewWriter((&theG6WriteIterator), theGraph) != OK) { gp_ErrorMessage("Unable to allocate G6WriteIterator."); g6_FreeWriter((&theG6WriteIterator)); return NOTOK; } // NOTE: (*pOutputContainer) will be NULL after we return from this call, // since the write iterator will take ownership of the output container. if (_g6_InitWriterWithStrOrFile(theG6WriteIterator, pOutputContainer) != OK) { gp_ErrorMessage("Unable to initialize G6WriteIterator."); g6_FreeWriter((&theG6WriteIterator)); return NOTOK; } if (g6_WriteGraph(theG6WriteIterator) != OK) { gp_ErrorMessage("Unable to write graph using G6WriteIterator."); g6_FreeWriter((&theG6WriteIterator)); return NOTOK; } g6_FreeWriter((&theG6WriteIterator)); return OK; } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/io/g6-write-iterator.h000066400000000000000000000014621522057144000273520ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #ifndef G6_WRITE_ITERATOR #define G6_WRITE_ITERATOR #ifdef __cplusplus extern "C" { #endif #include #include "../graph.h" typedef struct G6WriteIteratorStruct G6WriteIteratorStruct; typedef G6WriteIteratorStruct *G6WriteIteratorP; int g6_NewWriter(G6WriteIteratorP *pG6WriteIterator, graphP theGraph); int g6_InitWriterWithString(G6WriteIteratorP theG6WriteIterator, char **pOutputString); int g6_InitWriterWithFileName(G6WriteIteratorP theG6WriteIterator, char *outputFileName); int g6_WriteGraph(G6WriteIteratorP theG6WriteIterator); void g6_FreeWriter(G6WriteIteratorP *pG6WriteIterator); #ifdef __cplusplus } #endif #endif /* G6_WRITE_ITERATOR */ graph-algorithms-planarity-08d7b51/planarity/c/graphLib/io/graphIO.c000066400000000000000000001130771522057144000254110ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include #include #include #include "graphIO.h" #include "strOrFile.h" #include "../extensionSystem/graphExtensions.private.h" // To help with writing debug info #include "../planarityRelated/graphPlanarity.private.h" #include "../graphDFSUtils.h" // To help with graph construction #include "../graph.private.h" /* Imported functions */ extern int _g6_ReadGraphFromStrOrFile(graphP theGraph, strOrFileP *pG6InputContainer); extern int _g6_WriteGraphToStrOrFile(graphP theGraph, strOrFileP *pOutputContainer); /* Private functions (exported to system) */ int _ReadGraph(graphP theGraph, strOrFileP *pInputContainer); int _ReadAdjMatrix(graphP theGraph, strOrFileP inputContainer); int _ReadAdjList(graphP theGraph, strOrFileP inputContainer); int _ReadLEDAGraph(graphP theGraph, strOrFileP inputContainer); int _ReadPostprocess(graphP theGraph, char *extraData); int _WriteGraph(graphP theGraph, strOrFileP *outputContainer, int Mode); int _WriteAdjList(graphP theGraph, strOrFileP outputContainer); int _WriteAdjMatrix(graphP theGraph, strOrFileP outputContainer); int _WriteDebugInfo(graphP theGraph, strOrFileP outputContainer); int _WritePostprocess(graphP theGraph, char **pExtraData); /* Private functions */ char _GetEdgeTypeChar(graphP theGraph, int e); char _GetObstructionMarkChar(graphP theGraph, int v); /******************************************************************** _ReadAdjMatrix() This function reads the undirected graph in upper triangular matrix format. Though O(N^2) time is required, this routine is useful during reliability testing due to the wealth of graph generating software that uses this format for output. Returns: OK, NOTOK on internal error ********************************************************************/ int _ReadAdjMatrix(graphP theGraph, strOrFileP inputContainer) { int N = 0; int v = NIL, w = NIL, Flag = NIL; if (!sf_IsValidStrOrFile(inputContainer)) return NOTOK; // Read the number of vertices from the first line of the file if (sf_ReadSkipWhitespace(inputContainer) != OK) return NOTOK; if (sf_ReadInteger(&N, inputContainer) != OK) return NOTOK; // Initialize the graph based on the number of vertices if (gp_EnsureVertexCapacity(theGraph, N) != OK) return NOTOK; // Read an upper-triangular matrix row for each vertex // Note that for the last vertex, zero flags are read, per the upper triangular format for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { gp_SetIndex(theGraph, v, v); for (w = v + 1; w < gp_UpperBoundVertices(theGraph); w++) { // Read each of v's w-neighbor flags if (sf_ReadSkipWhitespace(inputContainer) != OK) return NOTOK; if (sf_ReadSingleDigit(&Flag, inputContainer) != OK) return NOTOK; // N.B. Currently do not allow edge-weights in Adjacency // Matrix format if (Flag != 0 && Flag != 1) return NOTOK; // Add the edge (v, w) if the flag is raised if (Flag) { if (gp_DynamicAddEdge(theGraph, v, 0, w, 0) != OK) return NOTOK; } } } return OK; } /******************************************************************** _ReadAdjList() This function reads the graph in adjacency list format. The graph format is: On the first line : N= On N subsequent lines: #: a b c ... -1 where # is a vertex number and a, b, c, ... are its neighbors. NOTE: The vertex number is for file documentation only. It is an error if the vertices are not in sorted order in the file. NOTE: If a loop edge is found, it is ignored without error. NOTE: This routine supports digraphs. For a directed edge (v -> W), an edge record is created in both vertices, v and W, and the edge record in v's adjacency list is marked OUTONLY while the edge record in W's list is marked INONLY. This makes it easy to used edge directedness when appropriate but also seamlessly process the corresponding undirected graph. Returns: OK on success, NOTOK on file content error (or internal error) ********************************************************************/ int _ReadAdjList(graphP theGraph, strOrFileP inputContainer) { int ErrorCode = OK; int N = 0, v = NIL, W = NIL, adjList = NIL, e = NIL, indexValue = NIL; int zeroBased = FALSE; if (!sf_IsValidStrOrFile(inputContainer)) return NOTOK; // Skip the "N=" and then read the N value for number of vertices if (sf_ReadSkipChar(inputContainer) != OK) return NOTOK; if (sf_ReadSkipChar(inputContainer) != OK) return NOTOK; if (sf_ReadSkipWhitespace(inputContainer) != OK) return NOTOK; if (sf_ReadInteger(&N, inputContainer) != OK) return NOTOK; if (sf_ReadSkipWhitespace(inputContainer) != OK) return NOTOK; // Initialize theGraph based on the number of vertices in the input if (gp_EnsureVertexCapacity(theGraph, N) != OK) return NOTOK; // Clear the visited members of the vertices so they can be used // during the adjacency list read operation for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) gp_SetVertexVisitedInfo(theGraph, v, NIL); // Do the adjacency list read operation for each vertex in order for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { // Read the vertex number if (sf_ReadSkipWhitespace(inputContainer) != OK) return NOTOK; if (sf_ReadInteger(&indexValue, inputContainer) != OK) return NOTOK; if (sf_ReadSkipWhitespace(inputContainer) != OK) return NOTOK; if (indexValue == 0 && v == gp_LowerBoundVertexStorage(theGraph)) zeroBased = TRUE; // If we are reading a zero-based input file, then we have to add to the // indexValue for v the offset of the first vertex in storage, which is // usually 1 (because we compile with USE_1BASEDARRAYS by default) but // which may be 0 if this library was compiled with USE_0BASEDARRAYS. if (zeroBased) indexValue += gp_LowerBoundVertexStorage(theGraph); gp_SetIndex(theGraph, v, indexValue); // The vertices are expected to be in numeric ascending order if (gp_GetIndex(theGraph, v) != v) return NOTOK; // Skip the colon after the vertex number if (sf_ReadSkipChar(inputContainer) != OK) return NOTOK; // If the vertex already has a non-empty adjacency list, then it is // the result of adding edges during processing of preceding vertices. // The list is removed from the current vertex v and saved for use // during the read operation for v. Adjacencies to preceding vertices // are pulled from this list, if present, or added as directed edges // if not. Adjacencies to succeeding vertices are added as undirected // edges, and will be corrected later if the succeeding vertex does not // have the matching adjacency using the following mechanism. After the // read operation for a vertex v, any adjacency nodes left in the saved // list are converted to directed edges from the preceding vertex to v. adjList = gp_GetFirstEdge(theGraph, v); if (gp_IsEdge(theGraph, adjList)) { // Store the adjacency node location in the visited member of each // of the preceding vertices to which v is adjacent so that we can // efficiently detect the adjacency during the read operation and // efficiently find the adjacency node. e = gp_GetFirstEdge(theGraph, v); while (gp_IsEdge(theGraph, e)) { gp_SetVertexVisitedInfo(theGraph, gp_GetNeighbor(theGraph, e), e); e = gp_GetNextEdge(theGraph, e); } // Make the adjacency list circular, for later ease of processing gp_SetPrevEdge(theGraph, adjList, gp_GetLastEdge(theGraph, v)); gp_SetNextEdge(theGraph, gp_GetLastEdge(theGraph, v), adjList); // Remove the list from the vertex gp_SetFirstEdge(theGraph, v, NIL); gp_SetLastEdge(theGraph, v, NIL); } // Read the adjacency list. while (1) { // Read the value indicating the next adjacent vertex (or the list end) if (sf_ReadSkipWhitespace(inputContainer) != OK) return NOTOK; if (sf_ReadInteger(&W, inputContainer) != OK) return NOTOK; if (sf_ReadSkipWhitespace(inputContainer) != OK) return NOTOK; // If we are reading a zero-based input file, then we have to add to W // the offset of the first vertex in storage, which is usually 1 // (because we compile with USE_1BASEDARRAYS by default) but which may // be 0 if this library was compiled with USE_0BASEDARRAYS. if (zeroBased) W += gp_LowerBoundVertexStorage(theGraph); // A value below the valid range indicates the adjacency list end // This was written before gp_IsNotVertex() existed if (W < gp_LowerBoundVertices(theGraph)) break; // A value above the valid range is an error if (W >= gp_UpperBoundVertices(theGraph)) return NOTOK; // Loop edges are not supported else if (W == v) return NOTOK; // If the adjacency is to a succeeding, higher numbered vertex, // then we'll add an undirected edge for now else if (v < W) { if ((ErrorCode = gp_DynamicAddEdge(theGraph, v, 0, W, 0)) != OK) return ErrorCode; } // If the adjacency is to a preceding, lower numbered vertex, then // we have to pull the adjacency node from the preexisting adjList, // if it is there, and if not then we have to add a directed edge. else { // If the directed edge already exists, then we add it // as the new first edge of the vertex and delete it from adjList if (gp_IsEdge(theGraph, gp_GetVertexVisitedInfo(theGraph, W))) { e = gp_GetVertexVisitedInfo(theGraph, W); // Remove the directed edge e from the adjList construct gp_SetVertexVisitedInfo(theGraph, W, NIL); if (adjList == e) { if ((adjList = gp_GetNextEdge(theGraph, e)) == e) adjList = NIL; } gp_SetPrevEdge(theGraph, gp_GetNextEdge(theGraph, e), gp_GetPrevEdge(theGraph, e)); gp_SetNextEdge(theGraph, gp_GetPrevEdge(theGraph, e), gp_GetNextEdge(theGraph, e)); gp_AttachFirstEdge(theGraph, v, e); } // If an adjacency node to the lower numbered vertex W does not // already exist, then we make a new directed edge from the current // vertex v to W. else { // It is added as the new first edge in both vertices if ((ErrorCode = gp_DynamicAddEdge(theGraph, v, 0, W, 0)) != OK) return ErrorCode; // Note that this call also sets OUTONLY on the twin edge record gp_SetDirection(theGraph, gp_GetFirstEdge(theGraph, W), EDGEFLAG_DIRECTION_INONLY); // This macro expands to constant conditional expression, but it's the proper use of the API } } } // If there are still adjList entries after the read operation // then those entries are not representative of full undirected edges. // Rather, they represent incoming directed edge from other vertices // into vertex v. They need to be added back into v's adjacency list but // marked as "INONLY", while the twin is marked "OUTONLY" (by the same function). while (gp_IsEdge(theGraph, adjList)) { e = adjList; gp_SetVertexVisitedInfo(theGraph, gp_GetNeighbor(theGraph, e), NIL); if ((adjList = gp_GetNextEdge(theGraph, e)) == e) adjList = NIL; gp_SetPrevEdge(theGraph, gp_GetNextEdge(theGraph, e), gp_GetPrevEdge(theGraph, e)); gp_SetNextEdge(theGraph, gp_GetPrevEdge(theGraph, e), gp_GetNextEdge(theGraph, e)); gp_AttachFirstEdge(theGraph, v, e); gp_SetDirection(theGraph, e, EDGEFLAG_DIRECTION_INONLY); // This macro expands to constant conditional expression, but it's the proper use of the API } } if (zeroBased) theGraph->graphFlags |= GRAPHFLAGS_ZEROBASEDIO; return OK; } /******************************************************************** _ReadLEDAGraph() Reads the edge list from a LEDA file containing a simple undirected graph. LEDA files use a one-based numbering system, which is converted to zero-based numbers if the graph reports starting at zero as the first vertex. Returns: OK on success, NOTOK on file content error (or internal error) ********************************************************************/ int _ReadLEDAGraph(graphP theGraph, strOrFileP inputContainer) { int ErrorCode = OK; int graphType = 0; int N = 0, M = 0, u = NIL, v = NIL; int zeroBasedOffset = gp_LowerBoundVertexStorage(theGraph) == 0 ? 1 : 0; char Line[MAXLINE + 1]; memset(Line, '\0', (MAXLINE + 1)); if (!sf_IsValidStrOrFile(inputContainer)) return NOTOK; /* N.B. Skip the lines that say LEDA.GRAPH and give the node and edge types then determine if graph is directed (-1) or undirected (-2); we only support undirected graphs at this time. */ for (int i = 0; i < 3; i++) if (sf_ReadSkipLineRemainder(inputContainer) != OK) return NOTOK; if (sf_ReadInteger(&graphType, inputContainer) != OK) return NOTOK; // N.B. We currently only support undirected graphs if (graphType != -2) return NOTOK; /* Skip any preceding whitespace, read the number of vertices N, and skip any subsequent whitespace. */ if (sf_ReadSkipWhitespace(inputContainer) != OK) return NOTOK; if (sf_ReadInteger(&N, inputContainer) != OK) return NOTOK; if (sf_ReadSkipWhitespace(inputContainer) != OK) return NOTOK; if (gp_EnsureVertexCapacity(theGraph, N) != OK) return NOTOK; for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) if (sf_fgets(Line, MAXLINE, inputContainer) == NULL) return NOTOK; /* Read the number of edges */ if (sf_ReadSkipWhitespace(inputContainer) != OK) return NOTOK; if (sf_ReadInteger(&M, inputContainer) != OK) return NOTOK; if (sf_ReadSkipWhitespace(inputContainer) != OK) return NOTOK; /* Read and add each edge, omitting loops and parallel edges */ for (int m = 0; m < M; m++) { if (sf_ReadSkipWhitespace(inputContainer) != OK) return NOTOK; if (sf_ReadInteger(&u, inputContainer) != OK) return NOTOK; if (sf_ReadSkipWhitespace(inputContainer) != OK) return NOTOK; if (sf_ReadInteger(&v, inputContainer) != OK) return NOTOK; if (sf_ReadSkipLineRemainder(inputContainer) != OK) return NOTOK; if (u != v && !gp_IsNeighbor(theGraph, u - zeroBasedOffset, v - zeroBasedOffset)) { if ((ErrorCode = gp_DynamicAddEdge(theGraph, u - zeroBasedOffset, 0, v - zeroBasedOffset, 0)) != OK) return ErrorCode; } } if (zeroBasedOffset) theGraph->graphFlags |= GRAPHFLAGS_ZEROBASEDIO; return OK; } /******************************************************************** gp_Read() Populates theGraph from the contents of the input file with path and name given by fileName. Pass "stdin" for the fileName to read from the stdin stream. Returns: OK, NOTOK on internal error ********************************************************************/ int gp_Read(graphP theGraph, char const *fileName) { strOrFileP inputContainer = NULL; if (theGraph == NULL || fileName == NULL || strlen(fileName) == 0) return NOTOK; if ((inputContainer = sf_NewInputContainer(NULL, fileName)) == NULL) return NOTOK; return _ReadGraph(theGraph, (&inputContainer)); } /******************************************************************** gp_ReadFromString() Populates theGraph using the information stored in inputStr. The caller owns the memory of inputStr, as the contents of inputStr are copied into the inputContainer's internal strBuf, and therefore is responsible for freeing the inputStr after gp_ReadFromString(). Returns NOTOK for any error, or OK otherwise ********************************************************************/ int gp_ReadFromString(graphP theGraph, char *inputStr) { strOrFileP inputContainer = NULL; if (theGraph == NULL || inputStr == NULL || strlen(inputStr) == 0) return NOTOK; if ((inputContainer = sf_NewInputContainer(inputStr, NULL)) == NULL) return NOTOK; return _ReadGraph(theGraph, (&inputContainer)); } /******************************************************************** _ReadGraph() Determines the graph input format by parsing the first line of the input stream or string contained by the inputContainer and calling the appropriate read function, then then cleans up the inputContainer and returns the graph. Digraphs and loop edges are not supported in the adjacency matrix format, which is upper triangular. In the adjacency list format, digraphs are supported. Loop edges are ignored without producing an error. ********************************************************************/ int _ReadGraph(graphP theGraph, strOrFileP *pInputContainer) { int RetVal = OK; int extraDataAllowed = FALSE; char lineBuff[MAXLINE + 1]; memset(lineBuff, '\0', (MAXLINE + 1)); if (!sf_IsValidStrOrFile((*pInputContainer))) return NOTOK; if (sf_fgets(lineBuff, MAXLINE, (*pInputContainer)) == NULL) { sf_Free(pInputContainer); return NOTOK; } if (sf_ungets(lineBuff, (*pInputContainer)) != OK) { sf_Free(pInputContainer); return NOTOK; } if (strncmp(lineBuff, "LEDA.GRAPH", strlen("LEDA.GRAPH")) == 0) { RetVal = _ReadLEDAGraph(theGraph, (*pInputContainer)); } else if (strncmp(lineBuff, "N=", strlen("N=")) == 0) { RetVal = _ReadAdjList(theGraph, (*pInputContainer)); if (RetVal == OK) extraDataAllowed = TRUE; } else if (isdigit(lineBuff[0])) { RetVal = _ReadAdjMatrix(theGraph, (*pInputContainer)); if (RetVal == OK) extraDataAllowed = TRUE; } else { // N.B. Unlike the other _Read functions, we are relinquishing // ownership of inputContainer to the G6ReadIterator, which // calls sf_Free() when ending iteration. This will mean that // (*pInputContainer) is NULL after we return from this call. RetVal = _g6_ReadGraphFromStrOrFile(theGraph, pInputContainer); } // The possibility of "extra data" is not allowed for .g6 format: // .g6 files may contain multiple graphs, which are not valid input // for the extra data readers (i.e. fpReadPostProcess) Additionally, // we don't want to process extra data unless the graph reading // was OK. if (extraDataAllowed) { char charAfterGraphRead = EOF; if ((charAfterGraphRead = sf_getc((*pInputContainer))) != EOF) { if (sf_ungetc(charAfterGraphRead, (*pInputContainer)) != charAfterGraphRead) RetVal = NOTOK; else { strBufP extraData = sb_New(0); if (extraData == NULL) RetVal = NOTOK; else { while (sf_fgets(lineBuff, MAXLINE, (*pInputContainer)) != NULL) { if (sb_ConcatString(extraData, lineBuff) != OK) { RetVal = NOTOK; break; } } if (sb_GetSize(extraData) > 0) RetVal = theGraph->functions->fpReadPostprocess(theGraph, sb_GetReadString(extraData)); sb_Free(&extraData); extraData = NULL; } } } } // This is a no-op if pInputContainer or *pInputContainer is already NULL, // such as in the case of G6 file processing. This cleans up for the other // file types. sf_Free(pInputContainer); return RetVal; } int _ReadPostprocess(graphP theGraph, char *extraData) { return OK; } /******************************************************************** _WriteAdjList() For each vertex, we write its number, a colon, the list of adjacent vertices, then a NIL. The vertices occupy the first N positions of theGraph. Each vertex is also has indicators of the first and last adjacency nodes (edge records) in its adjacency list. Returns: NOTOK for parameter errors; OK otherwise. ********************************************************************/ int _WriteAdjList(graphP theGraph, strOrFileP outputContainer) { int v = NIL, e = NIL; int zeroBasedVertexOffset = 0, adjacencyListTerminator = NIL; char numberStr[MAXCHARSFOR32BITINT + 1]; memset(numberStr, '\0', (MAXCHARSFOR32BITINT + 1) * sizeof(char)); if (theGraph == NULL || !sf_IsValidStrOrFile(outputContainer)) return NOTOK; // Write the number of vertices of the graph to the file or string buffer if (sprintf(numberStr, "N=%d\n", gp_GetN(theGraph)) < 1) return NOTOK; if (sf_fputs(numberStr, outputContainer) == EOF) return NOTOK; // If we are supposed to write 0-based output, then we have to adjust the vertex offset and the // adjacency list terminator based on whether this library has been compiled with 0-based or // 1-based array indexing for the in-memory data structure (i.e., compiled with // USE_1BASEDARRAYS USE_0BASEDARRAYS). The macro invoked is responsive to the difference. if (gp_GetGraphFlags(theGraph) & GRAPHFLAGS_ZEROBASEDIO) { zeroBasedVertexOffset = gp_LowerBoundVertexStorage(theGraph); // If the graph must be written 0-based, then the adjacency list terminator must be -1, // even if the internal representation is 1-based (i.e. when USE_1BASEDARRAYS, NIL == 0, // but the output needs to be -1 for 0-based output) adjacencyListTerminator = -1; } // Write the adjacency list of each vertex for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { if (sprintf(numberStr, "%d:", v - zeroBasedVertexOffset) < 1) return NOTOK; if (sf_fputs(numberStr, outputContainer) == EOF) return NOTOK; e = gp_GetLastEdge(theGraph, v); while (gp_IsEdge(theGraph, e)) { if (gp_GetDirection(theGraph, e) != EDGEFLAG_DIRECTION_INONLY) { if (sprintf(numberStr, " %d", gp_GetNeighbor(theGraph, e) - zeroBasedVertexOffset) < 1) return NOTOK; if (sf_fputs(numberStr, outputContainer) == EOF) return NOTOK; } e = gp_GetPrevEdge(theGraph, e); } // Write NIL at the end of the adjacency list (in zero-based I/O, NIL was -1) if (sprintf(numberStr, " %d\n", adjacencyListTerminator) < 1) return NOTOK; if (sf_fputs(numberStr, outputContainer) == EOF) return NOTOK; } return OK; } /******************************************************************** _WriteAdjMatrix() Outputs upper triangular matrix representation capable of being read by _ReadAdjMatrix(). theGraph and one of Outfile or theStrBuf must be non-NULL. Note: This routine does not support digraphs and will return an error if a directed edge is found. returns OK for success, NOTOK for failure ********************************************************************/ int _WriteAdjMatrix(graphP theGraph, strOrFileP outputContainer) { int v = NIL, e = NIL; char *Row = NULL; char numberStr[MAXCHARSFOR32BITINT + 1]; memset(numberStr, '\0', (MAXCHARSFOR32BITINT + 1) * sizeof(char)); if (theGraph == NULL || !sf_IsValidStrOrFile(outputContainer)) return NOTOK; // Write the number of vertices in the graph to the file or string buffer if (sprintf(numberStr, "%d\n", gp_GetN(theGraph)) < 1) return NOTOK; if (sf_fputs(numberStr, outputContainer) == EOF) return NOTOK; // Allocate memory for storing a string expression of one row at a time Row = (char *)malloc((gp_GetN(theGraph) + 2) * sizeof(char)); if (Row == NULL) return NOTOK; // Construct the upper triangular matrix representation one row at a time for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { for (int i = gp_LowerBoundVertices(theGraph); i <= v; i++) Row[i - gp_LowerBoundVertices(theGraph)] = ' '; for (int i = v + 1; i < gp_UpperBoundVertices(theGraph); i++) Row[i - gp_LowerBoundVertices(theGraph)] = '0'; e = gp_GetFirstEdge(theGraph, v); while (gp_IsEdge(theGraph, e)) { if (gp_GetDirection(theGraph, e) == EDGEFLAG_DIRECTION_INONLY) return NOTOK; if (gp_GetNeighbor(theGraph, e) > v) Row[gp_GetNeighbor(theGraph, e) - gp_LowerBoundVertices(theGraph)] = '1'; e = gp_GetNextEdge(theGraph, e); } Row[gp_GetN(theGraph)] = '\n'; Row[gp_GetN(theGraph) + 1] = '\0'; // Write the row to the file or string buffer if (sf_fputs(Row, outputContainer) == EOF) return NOTOK; } free(Row); Row = NULL; return OK; } /******************************************************************** ********************************************************************/ char _GetEdgeTypeChar(graphP theGraph, int e) { char type = 'U'; if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) type = 'C'; else if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_FORWARD) type = 'F'; else if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_PARENT) type = 'P'; else if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_BACK) type = 'B'; else if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_TREE) type = 'T'; return type; } /******************************************************************** ********************************************************************/ char _GetObstructionMarkChar(graphP theGraph, int v) { char type = 'U'; if (gp_GetObstructionMark(theGraph, v) == ANYVERTEX_OBSTRUCTIONMARK_HIGH_RXW) type = 'X'; else if (gp_GetObstructionMark(theGraph, v) == ANYVERTEX_OBSTRUCTIONMARK_LOW_RXW) type = 'x'; if (gp_GetObstructionMark(theGraph, v) == ANYVERTEX_OBSTRUCTIONMARK_HIGH_RYW) type = 'Y'; else if (gp_GetObstructionMark(theGraph, v) == ANYVERTEX_OBSTRUCTIONMARK_LOW_RYW) type = 'y'; return type; } /******************************************************************** _WriteDebugInfo() Writes adjacency list, but also includes the type value of each edge, e.g. is it an edge record to a DFS child, a descendant (forward edge), or ancestor (back edge), and the L, A and DFSParent of each vertex. ********************************************************************/ int _WriteDebugInfo(graphP theGraph, strOrFileP outputContainer) { int v = NIL, e = NIL; char lineBuf[MAXLINE + 1]; memset(lineBuf, '\0', (MAXLINE + 1) * sizeof(char)); if (theGraph == NULL || !sf_IsValidStrOrFile(outputContainer)) return NOTOK; /* Print parent copy vertices and their adjacency lists */ if (sprintf(lineBuf, "DEBUG N=%d M=%d\n", gp_GetN(theGraph), gp_GetM(theGraph)) < 1) return NOTOK; if (sf_fputs(lineBuf, outputContainer) == EOF) return NOTOK; for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { if (sprintf(lineBuf, "%d(P=%d,lA=%d,LowPt=%d,v=%d):", v, gp_GetVertexParent(theGraph, v), gp_GetVertexLeastAncestor(theGraph, v), gp_GetVertexLowpoint(theGraph, v), gp_GetIndex(theGraph, v)) < 1) return NOTOK; if (sf_fputs(lineBuf, outputContainer) == EOF) return NOTOK; e = gp_GetFirstEdge(theGraph, v); while (gp_IsEdge(theGraph, e)) { if (sprintf(lineBuf, " %d(e=%d)", gp_GetNeighbor(theGraph, e), e) < 1) return NOTOK; if (sf_fputs(lineBuf, outputContainer) == EOF) return NOTOK; e = gp_GetNextEdge(theGraph, e); } if (sprintf(lineBuf, " %d\n", NIL) < 1) return NOTOK; if (sf_fputs(lineBuf, outputContainer) == EOF) return NOTOK; } /* Print any root copy vertices and their adjacency lists */ for (v = gp_LowerBoundVirtualVertices(theGraph); v < gp_UpperBoundVirtualVertices(theGraph); ++v) { if (!gp_VirtualVertexInUse(theGraph, v)) continue; if (sprintf(lineBuf, "%d(copy of=%d, DFS child=%d):", v, gp_GetIndex(theGraph, v), gp_GetDFSChildFromBicompRoot(theGraph, v)) < 1) return NOTOK; if (sf_fputs(lineBuf, outputContainer) == EOF) return NOTOK; e = gp_GetFirstEdge(theGraph, v); while (gp_IsEdge(theGraph, e)) { if (sprintf(lineBuf, " %d(e=%d)", gp_GetNeighbor(theGraph, e), e) < 1) return NOTOK; if (sf_fputs(lineBuf, outputContainer) == EOF) return NOTOK; e = gp_GetNextEdge(theGraph, e); } if (sprintf(lineBuf, " %d\n", NIL) < 1) return NOTOK; if (sf_fputs(lineBuf, outputContainer) == EOF) return NOTOK; } /* Print information about vertices and root copy (virtual) vertices */ if (sf_fputs("\nVERTEX INFORMATION\n", outputContainer) == EOF) return NOTOK; for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { if (sprintf(lineBuf, "V[%3d] index=%3d, type=%c, first edge=%3d, last edge=%3d\n", v, gp_GetIndex(theGraph, v), (gp_IsVirtualVertex(theGraph, v) ? 'X' : _GetObstructionMarkChar(theGraph, v)), gp_GetFirstEdge(theGraph, v), gp_GetLastEdge(theGraph, v)) < 1) return NOTOK; if (sf_fputs(lineBuf, outputContainer) == EOF) return NOTOK; } for (v = gp_LowerBoundVirtualVertices(theGraph); v < gp_UpperBoundVirtualVertices(theGraph); ++v) { if (gp_VirtualVertexNotInUse(theGraph, v)) continue; if (sprintf(lineBuf, "V[%3d] index=%3d, type=%c, first edge=%3d, last edge=%3d\n", v, gp_GetIndex(theGraph, v), (gp_IsVirtualVertex(theGraph, v) ? 'X' : _GetObstructionMarkChar(theGraph, v)), gp_GetFirstEdge(theGraph, v), gp_GetLastEdge(theGraph, v)) < 1) return NOTOK; if (sf_fputs(lineBuf, outputContainer) == EOF) return NOTOK; } /* Print information about edges */ if (sf_fputs("\nEDGE INFORMATION\n", outputContainer) == EOF) return NOTOK; for (e = gp_LowerBoundEdges(theGraph); e < gp_UpperBoundEdges(theGraph); ++e) { if (gp_EdgeInUse(theGraph, e)) { if (sprintf(lineBuf, "E[%3d] neighbor=%3d, type=%c, next edge=%3d, prev edge=%3d\n", e, gp_GetNeighbor(theGraph, e), _GetEdgeTypeChar(theGraph, e), gp_GetNextEdge(theGraph, e), gp_GetPrevEdge(theGraph, e)) < 1) return NOTOK; if (sf_fputs(lineBuf, outputContainer) == EOF) return NOTOK; } } return OK; } /******************************************************************** gp_Write() Writes theGraph into the file. Pass "stdout" or "stderr" to fileName to write to the corresponding stream Pass WRITE_G6, WRITE_ADJLIST, WRITE_ADJMATRIX, or WRITE_DEBUGINFO for writeMode NOTE: For digraphs, it is an error to use a writeMode other than WRITE_ADJLIST Returns NOTOK on error, OK on success. ********************************************************************/ int gp_Write(graphP theGraph, char const *fileName, int writeMode) { int RetVal = OK; strOrFileP outputContainer = NULL; if (theGraph == NULL || fileName == NULL || strlen(fileName) == 0) return NOTOK; if (strcmp(fileName, "nullwrite") == 0) return OK; if ((outputContainer = sf_NewOutputContainer(NULL, fileName)) == NULL) return NOTOK; RetVal = _WriteGraph(theGraph, &outputContainer, writeMode); sf_Free(&outputContainer); return RetVal; } /******************************************************************** * gp_WriteToString() * * Writes the information of theGraph into a string that is returned * to the caller via the pointer pointer pOutputStr. * The string is owned by the caller and should be released with * free() when the caller doesn't need the string anymore. * The format of the content written into the returned string is based * on writeMode: WRITE_G6, WRITE_ADJLIST, or WRITE_ADJMATRIX * (the WRITE_DEBUGINFO writeMode is not supported at this time) NOTE: For digraphs, it is an error to use a mode other than WRITE_ADJLIST Returns NOTOK on error, or OK on success along with an allocated string *pOutputStr that the caller must free() ********************************************************************/ int gp_WriteToString(graphP theGraph, char **pOutputStr, int writeMode) { int RetVal = OK; strOrFileP outputContainer = NULL; if (theGraph == NULL || pOutputStr == NULL || (*pOutputStr) != NULL) return NOTOK; if ((outputContainer = sf_NewOutputContainer(pOutputStr, NULL)) == NULL) return NOTOK; RetVal = _WriteGraph(theGraph, &outputContainer, writeMode); sf_Free(&outputContainer); // NOTE: (#56) If an error was encountered when we _WriteGraph(), we do not // want to return garbage to the caller. When we free the output container, // if writing to string, this means that we will have taken the string from // the internal theStrBuf and have assigned it to the container's // pointer-pointer pOutputStr for output; if the RetVal is not OK, we // must free the string and set the pointer-pointer to NULL. if (RetVal != OK) { if (pOutputStr != NULL && (*pOutputStr) != NULL) { free((*pOutputStr)); pOutputStr = NULL; } } // NOTE: If the output string is NULL or empty, need to report NOTOK if (pOutputStr != NULL && (*pOutputStr) == NULL) RetVal = NOTOK; else if (pOutputStr != NULL && strlen(*pOutputStr) == 0) { free((*pOutputStr)); pOutputStr = NULL; RetVal = NOTOK; } return RetVal; } /******************************************************************** _WriteGraph() Writes theGraph into the strOrFile container. Pass WRITE_G6, WRITE_ADJLIST, WRITE_ADJMATRIX, or WRITE_DEBUGINFO for the Mode NOTE: For digraphs, it is an error to use a mode other than WRITE_ADJLIST Returns NOTOK on error, OK on success. ********************************************************************/ int _WriteGraph(graphP theGraph, strOrFileP *pOutputContainer, int Mode) { int RetVal = OK; switch (Mode) { case WRITE_G6: // This call takes ownership of the outputContainer, so (*pOutputContainer) // will be NULL upon return from this function. RetVal = _g6_WriteGraphToStrOrFile(theGraph, pOutputContainer); break; case WRITE_ADJLIST: RetVal = _WriteAdjList(theGraph, (*pOutputContainer)); break; case WRITE_ADJMATRIX: RetVal = _WriteAdjMatrix(theGraph, (*pOutputContainer)); break; case WRITE_DEBUGINFO: RetVal = _WriteDebugInfo(theGraph, (*pOutputContainer)); break; default: RetVal = NOTOK; break; } if (RetVal == OK) { char *extraData = NULL; RetVal = theGraph->functions->fpWritePostprocess(theGraph, &extraData); if (extraData != NULL) { if (sf_fputs(extraData, (*pOutputContainer)) == EOF) RetVal = NOTOK; free(extraData); extraData = NULL; } } return RetVal; } /******************************************************************** _WritePostprocess() By default, no additional information is written. ********************************************************************/ int _WritePostprocess(graphP theGraph, char **pExtraData) { return OK; } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/io/graphIO.h000066400000000000000000000016341522057144000254110ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #ifndef GRAPHIO_H #define GRAPHIO_H #ifdef __cplusplus extern "C" { #endif #include "../graph.h" int gp_Read(graphP theGraph, char const *fileName); int gp_ReadFromString(graphP theGraph, char *inputStr); int gp_Write(graphP theGraph, char const *fileName, int writeMode); int gp_WriteToString(graphP theGraph, char **pOutputStr, int writeMode); // Mode values for gp_Write() and gp_WriteToString() #define WRITE_ADJLIST 1 #define WRITE_ADJMATRIX 2 #define WRITE_DEBUGINFO 3 #define WRITE_G6 4 // Graph Flags: see gp_GetGraphFlags() // GRAPHFLAGS_ZEROBASEDIO is typically set by gp_Read() to indicate that the // adjacency list representation in a file began with index 0. #define GRAPHFLAGS_ZEROBASEDIO 16 #ifdef __cplusplus } #endif #endif /* GRAPHIO_H */ graph-algorithms-planarity-08d7b51/planarity/c/graphLib/io/strOrFile.c000066400000000000000000000605701522057144000257700ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include #include #include #include #include "../lowLevelUtils/appconst.h" #include "strOrFile.h" /******************************************************************** sf_NewInputContainer() The string-or-file object supports two IO modes: reading input (ioMode == READTEXT), and writing output (ioMode == WRITETEXT). The string-or-file object also may only contain a string (stored using a strBufP to leverage its string manipulation functions) XOR a FILE *. For the input mode, sf_NewInputContainer() should either receive a non-NULL and nonempty input string (which the container *does not own*, but rather copies into the internal strBufP) XOR a non-NULL and nonempty fileName (which may correspond to stdin). Returns the allocated string-or-file container, or NULL on error. ********************************************************************/ strOrFileP sf_NewInputContainer(char const *const inputStr, char const *const fileName) { strOrFileP theStrOrFile; if ( ((fileName != NULL) && (inputStr != NULL)) || ((fileName == NULL) && (inputStr == NULL))) return NULL; theStrOrFile = (strOrFileP)calloc(1, sizeof(strOrFileStruct)); if (theStrOrFile != NULL) { theStrOrFile->containerType = INPUT_CONTAINER; if (fileName != NULL) { // N.B. If the fileName indicates a stream, then input containers // may only contain stdin. if (strcmp(fileName, "stdin") == 0) theStrOrFile->pFile = stdin; else if ( (strcmp(fileName, "stdout") == 0) || (strcmp(fileName, "stderr") == 0)) { sf_Free(&theStrOrFile); theStrOrFile = NULL; return NULL; } else { if ((theStrOrFile->pFile = fopen(fileName, READTEXT)) == NULL) { sf_Free(&theStrOrFile); theStrOrFile = NULL; return NULL; } } } else { if ((theStrOrFile->theStrBuf = sb_New(0)) == NULL) { sf_Free(&theStrOrFile); theStrOrFile = NULL; return NULL; } if ( (inputStr == NULL || (strlen(inputStr) == 0)) || sb_ConcatString(theStrOrFile->theStrBuf, inputStr) != OK) { sf_Free(&theStrOrFile); theStrOrFile = NULL; return NULL; } } theStrOrFile->ungetBuf = sp_New(MAXLINE); if (theStrOrFile->ungetBuf == NULL) { sf_Free(&theStrOrFile); theStrOrFile = NULL; return NULL; } } return theStrOrFile; } /******************************************************************** sf_NewOutputContainer() The string-or-file object supports two IO modes: reading input (ioMode == READTEXT), and writing output (ioMode == WRITETEXT). The string-or-file object also may only contain a string (stored using a strBufP to leverage its string manipulation functions) XOR a FILE *. For the output mode, sf_NewOutputContainer() should receive either a non-NULL pointer-pointer that initially points to NULL (to which we will assign the output string upon freeing the container) XOR a non-NULL and nonempty fileName (which may correspond to stdout or stderr). If theStr is not NULL, then the desired output string will be constructed internally in the string-or-file object, which will only be returned to the caller when freeing the strOrFile via this pointer-pointer. Note that if the fileName is not NULL, then the internal strBufP will not be constructed. Returns the allocated string-or-file container, or NULL on error. ********************************************************************/ strOrFileP sf_NewOutputContainer(char **pOutputStr, char const *const fileName) { strOrFileP theStrOrFile; if ( ((fileName != NULL) && (pOutputStr != NULL)) || ((fileName == NULL) && (pOutputStr == NULL)) || ((pOutputStr != NULL) && ((*pOutputStr) != NULL))) return NULL; theStrOrFile = (strOrFileP)calloc(1, sizeof(strOrFileStruct)); if (theStrOrFile != NULL) { theStrOrFile->containerType = OUTPUT_CONTAINER; if (fileName != NULL) { if (strcmp(fileName, "stdin") == 0) { sf_Free(&theStrOrFile); theStrOrFile = NULL; return NULL; } else if (strcmp(fileName, "stdout") == 0) theStrOrFile->pFile = stdout; else if (strcmp(fileName, "stderr") == 0) theStrOrFile->pFile = stderr; else { if ( (theStrOrFile->pFile = fopen(fileName, WRITETEXT)) == NULL) { sf_Free(&theStrOrFile); theStrOrFile = NULL; return NULL; } } } else { if ((theStrOrFile->theStrBuf = sb_New(0)) == NULL) { sf_Free(&theStrOrFile); theStrOrFile = NULL; return NULL; } theStrOrFile->pOutputStr = pOutputStr; } } return theStrOrFile; } /******************************************************************** sf_ValidateStrOrFile() Ensures that theStrOrFile: 1. Is not NULL 2. Has ungetBuf allocated 3. Both pFile and theStrBuf are not NULL 4. Both pFile and theStrBuf are not both assigned (since this container should only contain one source). 5. containerType is either set to INPUT_CONTAINER or OUTPUT_CONTAINER Returns FALSE if any of these conditions are not met, otherwise TRUE. ********************************************************************/ int sf_IsValidStrOrFile(strOrFileP theStrOrFile) { if (theStrOrFile == NULL || (theStrOrFile->pFile == NULL && theStrOrFile->theStrBuf == NULL) || (theStrOrFile->pFile != NULL && theStrOrFile->theStrBuf != NULL) || (theStrOrFile->containerType != INPUT_CONTAINER && theStrOrFile->containerType != OUTPUT_CONTAINER)) return FALSE; if (theStrOrFile->containerType == INPUT_CONTAINER) { if ( (theStrOrFile->ungetBuf == NULL) || (theStrOrFile->theStrBuf != NULL && sb_GetSize(theStrOrFile->theStrBuf) == 0)) { return FALSE; } } else // Otherwise, due to the above validation, can only be an output container { if (theStrOrFile->ungetBuf != NULL) { return FALSE; } } return TRUE; } /******************************************************************** sf_getc() If strOrFileP has a non-empty ungetBuf, pop and return the character. If the ungetBuf is empty, then we'll read from pFile using getc() OR from theStrBuf by fetching the character at theStrPos and incrementing theStrPos. ********************************************************************/ char sf_getc(strOrFileP theStrOrFile) { char theChar = EOF; if (!sf_IsValidStrOrFile(theStrOrFile) || theStrOrFile->containerType != INPUT_CONTAINER) return EOF; if ((theStrOrFile->ungetBuf != NULL) && (sp_GetCurrentSize(theStrOrFile->ungetBuf) > 0)) { int currChar = 0; // Technically, this returns NOTOK on error, but the error is underflow, which is // checked above and so cannot happen. Therefore, safe to use sp_Pop() here. #ifndef DEBUG sp_Pop(theStrOrFile->ungetBuf, currChar); #else // In DEBUG, MSVC cl is misreading the printf() generated by sp_Pop(), // so we cut to the underlying debug method to stop its warnings sp__Pop(theStrOrFile->ungetBuf, &(currChar)); #endif theChar = (char)currChar; } else if (theStrOrFile->pFile != NULL) theChar = (char)getc(theStrOrFile->pFile); else if (theStrOrFile->theStrBuf != NULL && sb_GetUnreadCharCount(theStrOrFile->theStrBuf) > 0) { theChar = sb_GetReadString(theStrOrFile->theStrBuf) != NULL ? sb_GetReadString(theStrOrFile->theStrBuf)[0] : EOF; if (theChar != EOF) sb_ReadSkipChar(theStrOrFile->theStrBuf); } return theChar; } /******************************************************************** sf_ReadSkipChar() Calls sf_getc() and does nothing with the returned character ********************************************************************/ int sf_ReadSkipChar(strOrFileP theStrOrFile) { if (!sf_IsValidStrOrFile(theStrOrFile) || theStrOrFile->containerType != INPUT_CONTAINER) return NOTOK; if (sf_getc(theStrOrFile) == EOF) return NOTOK; return OK; } /******************************************************************** sf_ReadSkipWhitespace() Repeatedly calls sf_getc() to find the next non-space character before hitting EOF ********************************************************************/ int sf_ReadSkipWhitespace(strOrFileP theStrOrFile) { char currChar = EOF; if (!sf_IsValidStrOrFile(theStrOrFile) || theStrOrFile->containerType != INPUT_CONTAINER) return NOTOK; while ((currChar = sf_getc(theStrOrFile)) != EOF && isspace(currChar)) { continue; } if (sf_ungetc(currChar, theStrOrFile) != currChar) return NOTOK; return OK; } /******************************************************************** sf_ReadSingleDigit() Calls sf_getc() and tests whether the character read corresponds to a digit. Returns NOTOK if the character returned from sf_getc() is not a digit. Assigns the digit read to the int * and returns OK upon success. ********************************************************************/ int sf_ReadSingleDigit(int *digitToRead, strOrFileP theStrOrFile) { int candidateDigit = EOF; if (!sf_IsValidStrOrFile(theStrOrFile) || theStrOrFile->containerType != INPUT_CONTAINER) return NOTOK; candidateDigit = sf_getc(theStrOrFile); if (!isdigit(candidateDigit)) return NOTOK; // N.B. Subtract '0' = 48 to convert the digit // char to the corresponding int (*digitToRead) = candidateDigit - '0'; return OK; } /******************************************************************** sf_ReadInteger() Repeatedly calls sf_getc() to obtain the characters corresponding to an int, then parses that char* using sscanf() to extract the integer. Returns OK if successfully extracted the digits of and produced the int from theStrOrFile, or NOTOK otherwise. ********************************************************************/ int sf_ReadInteger(int *intToRead, strOrFileP theStrOrFile) { int exitCode = OK; int intCandidate = 0, intCandidateIndex = 0; char currChar = '\0', nextChar = '\0'; int startedReadingInt = FALSE, isNegative = FALSE; char intCandidateStr[MAXCHARSFOR32BITINT + 1]; memset(intCandidateStr, '\0', (MAXCHARSFOR32BITINT + 1) * sizeof(char)); if (!sf_IsValidStrOrFile(theStrOrFile) || theStrOrFile->containerType != INPUT_CONTAINER) return NOTOK; do { currChar = sf_getc(theStrOrFile); if (currChar == '-') { if (startedReadingInt) { exitCode = NOTOK; break; } else { nextChar = sf_getc(theStrOrFile); if (sf_ungetc(nextChar, theStrOrFile) != nextChar) { exitCode = NOTOK; break; } if (!isdigit(nextChar)) { exitCode = NOTOK; break; } else { intCandidateStr[intCandidateIndex++] = currChar; isNegative = TRUE; } } } else if (isdigit(currChar)) { intCandidateStr[intCandidateIndex++] = currChar; startedReadingInt = TRUE; } else { if (sf_ungetc(currChar, theStrOrFile) != currChar) exitCode = NOTOK; break; } if ( (!isNegative && (intCandidateIndex == (MAXCHARSFOR32BITINT - 2))) || (isNegative && (intCandidateIndex == (MAXCHARSFOR32BITINT - 1)))) { if (sscanf(intCandidateStr, "%d", &intCandidate) != 1) exitCode = NOTOK; else { nextChar = sf_getc(theStrOrFile); if (isdigit(nextChar)) { // N.B. The only way we could be here is if `i` is less than the max possible // length of the string representation of a signed 32-bit integer (10 for // positive and 11 for negative) int underflowThreshold = (INT32_MIN / 10), overflowThreshold = (INT32_MAX / 10); if (isNegative) { if (intCandidate < underflowThreshold) exitCode = NOTOK; else if (intCandidate == underflowThreshold && nextChar == '9') exitCode = NOTOK; } else { if (intCandidate > overflowThreshold) exitCode = NOTOK; else if (intCandidate == overflowThreshold && (nextChar == '8' || nextChar == '9')) exitCode = NOTOK; } if (exitCode == OK) { intCandidateStr[intCandidateIndex++] = nextChar; } } else if (sf_ungetc(nextChar, theStrOrFile) != nextChar) exitCode = NOTOK; } break; } } while (currChar != EOF); if (exitCode == OK) { if (sscanf(intCandidateStr, "%d", &intCandidate) != 1) exitCode = NOTOK; else (*intToRead) = intCandidate; } return exitCode; } /******************************************************************** sf_ReadSkipInteger() Calls sf_ReadInteger() and discards the result. ********************************************************************/ int sf_ReadSkipInteger(strOrFileP theStrOrFile) { int temp = 0; if (sf_ReadInteger(&temp, theStrOrFile) != OK) return NOTOK; return OK; } /******************************************************************** sf_ReadSkipLineRemainder() Calls sf_fgets() and discards the result. ********************************************************************/ int sf_ReadSkipLineRemainder(strOrFileP theStrOrFile) { char lineRemainderToSkip[MAXLINE + 1]; memset(lineRemainderToSkip, '\0', (MAXLINE + 1)); if (sf_fgets(lineRemainderToSkip, MAXLINE, theStrOrFile) == NULL) return NOTOK; return OK; } /******************************************************************** sf_ungetc() Order of parameters matches stdio ungetc(). For both the case where the strOrFile contains a FILE * and the case where it contains a strBufP, we unget to the ungetBuf; this ungetBuf is consumed first when we sf_getc(), sf_fgets(), etc. Like ungetc() in stdio, on success theChar is returned. On failure, EOF is returned. ********************************************************************/ char sf_ungetc(char theChar, strOrFileP theStrOrFile) { if (theChar == EOF || !sf_IsValidStrOrFile(theStrOrFile) || theStrOrFile->containerType != INPUT_CONTAINER || sp_GetCurrentSize(theStrOrFile->ungetBuf) >= sp_GetCapacity(theStrOrFile->ungetBuf)) return EOF; // Acceptable downcast, allowing char rather than int return type #ifndef DEBUG sp_Push(theStrOrFile->ungetBuf, theChar); #else // In DEBUG, MSVC cl is misreading the printf() generated by sp_Push(), // so we cut to the underlying debug method to stop its warnings sp__Push(theStrOrFile->ungetBuf, theChar); #endif return theChar; } /******************************************************************** sf_ungets() Pushes characters of strToUnget in reverse order to the ungetBuf so that they can be fetched from the ungetBuf in the order of the original string. Returns OK on success and NOTOK on failure. ********************************************************************/ int sf_ungets(char *strToUnget, strOrFileP theStrOrFile) { if (!sf_IsValidStrOrFile(theStrOrFile) || theStrOrFile->containerType != INPUT_CONTAINER || (int)strlen(strToUnget) > (sp_GetCapacity(theStrOrFile->ungetBuf) - sp_GetCurrentSize(theStrOrFile->ungetBuf))) return NOTOK; for (int i = (strlen(strToUnget) - 1); i >= 0; i--) sp_Push(theStrOrFile->ungetBuf, strToUnget[i]); return OK; } /******************************************************************** sf_fgets() Order of parameters matches stdio fgets(). First param is the string to populate (assumes allocated (count + 1) bytes), second param is the max number of characters to read, and third param is the pointer to the string-or-file container from which we wish to read count characters (or up to and including \n). Like fgets() in stdio, this function doesn't check that enough memory is allocated for str to contain count characters plus \0. Like fgets() in stdio, on success the pointer to the buffer is returned. On failure, NULL is returned. ********************************************************************/ char *sf_fgets(char *str, int count, strOrFileP theStrOrFile) { int charsToReadFromUngetBuf = 0; int charsToReadFromStrOrFile = count; if (str == NULL || count < 0 || !sf_IsValidStrOrFile(theStrOrFile) || theStrOrFile->containerType != INPUT_CONTAINER) return NULL; if (theStrOrFile->ungetBuf != NULL) { int numCharsInUngetBuf = sp_GetCurrentSize(theStrOrFile->ungetBuf); if (numCharsInUngetBuf > 0) { char currChar = '\0'; int encounteredNewline = FALSE; charsToReadFromUngetBuf = (count > numCharsInUngetBuf) ? numCharsInUngetBuf : count; for (int i = 0; i < charsToReadFromUngetBuf; i++) { currChar = sf_getc(theStrOrFile); if (currChar == EOF) return NULL; str[i] = currChar; str[i + 1] = '\0'; // N.B. fgets() includes the \n in the string returned, and // no further characters shall be read if (currChar == '\n') { encounteredNewline = TRUE; break; } } // N.B. If we broke out of the loop early due to \n, do not read // any further characters from stream charsToReadFromStrOrFile = (encounteredNewline) ? 0 : ((count > numCharsInUngetBuf) ? (count - charsToReadFromUngetBuf) : 0); } } if (charsToReadFromStrOrFile > 0) { if (theStrOrFile->pFile != NULL) { // N.B. if fgets() returns NULL (can't read more characters) AND the ungetBuf was empty, // then return NULL (error trying to read from empty stream). Otherwise, return str (that // was read from ungetBuf) if (fgets(str + charsToReadFromUngetBuf, charsToReadFromStrOrFile, theStrOrFile->pFile) == NULL) { if (charsToReadFromUngetBuf == 0) return NULL; } } else if (theStrOrFile->theStrBuf != NULL) { char *theStrBuf = sb_GetReadString(theStrOrFile->theStrBuf); if (theStrBuf != NULL && sb_GetUnreadCharCount(theStrOrFile->theStrBuf) > 0) { if (strncpy( str + charsToReadFromUngetBuf, theStrBuf, charsToReadFromStrOrFile) == NULL) return NULL; sb_SetReadPos(theStrOrFile->theStrBuf, (sb_GetReadPos(theStrOrFile->theStrBuf) + charsToReadFromStrOrFile)); } else if (charsToReadFromUngetBuf == 0) return NULL; } } return str; } /******************************************************************** sf_fputs() Order of parameters matches stdio fputs(). First param is the string to append, and the second param is the string-or-file container to which we wish to append. On success, returns the number of characters written. On failure, returns EOF. ********************************************************************/ int sf_fputs(char const *strToWrite, strOrFileP theStrOrFile) { int outputLen = EOF; if (strToWrite == NULL || !sf_IsValidStrOrFile(theStrOrFile) || theStrOrFile->containerType != OUTPUT_CONTAINER) return EOF; // N.B. fputs() will fail and return EOF if pFile doesn't correspond // to an output stream if (theStrOrFile->pFile != NULL) outputLen = fputs(strToWrite, theStrOrFile->pFile); else if (theStrOrFile->theStrBuf != NULL) { if (sb_ConcatString(theStrOrFile->theStrBuf, strToWrite) == OK) outputLen = strlen(strToWrite); else outputLen = EOF; } return outputLen; } /******************************************************************** sf_closeFile() If the strOrFile container contains a string, degenerately returns OK. If the strOrFile container contains a FILE pointer: - if the FILE pointer is one of stdin, stdout, or stderr, calls fflush() on the stream and captures the errorCode - else, closes pFile and sets the internal pointer to NULL, then captures the errorCode from fclose() If the errorCode is less than 0, returns NOTOK, otherwise returns OK. ********************************************************************/ int sf_closeFile(strOrFileP theStrOrFile) { FILE *pFile = theStrOrFile->pFile; theStrOrFile->pFile = NULL; if (pFile != NULL) { int errorCode = 0; if (pFile == stdin || pFile == stdout || pFile == stderr) errorCode = fflush(pFile); else errorCode = fclose(pFile); if (errorCode < 0) return NOTOK; } sp_Free(&(theStrOrFile->ungetBuf)); return OK; } /******************************************************************** sf_Free() Receives a pointer-pointer to a string-or-file container. If the strOrFile contains a string which has not yet been "taken" using sf_takeTheStr() (i.e. we want inputStr to be freed, and in an error state we want to free pOutputStr), the string is freed, the internal pointer is set to NULL, and theStrPos is set to 0. If the strOrFile contains a FILE pointer, we call sf_closeFile() and set the internal pointer to NULL. Note that unless we are in an error state when sf_Free() is called, sf_closeFile should have already been called. Finally, we use the indirection operator to free the strOrFile container and set the pointer to NULL. ********************************************************************/ void sf_Free(strOrFileP *pStrOrFile) { if (pStrOrFile != NULL && (*pStrOrFile) != NULL) { if ((*pStrOrFile)->theStrBuf != NULL) { // TODO: (#56) If in an error state, just don't sb_TakeString() // before freeing it if ((*pStrOrFile)->pOutputStr != NULL) { (*((*pStrOrFile)->pOutputStr)) = sb_TakeString((*pStrOrFile)->theStrBuf); (*pStrOrFile)->pOutputStr = NULL; } sb_Free(&((*pStrOrFile)->theStrBuf)); } // TODO: (#56) if the strOrFile container's FILE pointer // corresponds to an output file, i.e. ioMode is 'w', // we should try to remove the file since the error state // means the contents are invalid if ((*pStrOrFile)->pFile != NULL) sf_closeFile((*pStrOrFile)); (*pStrOrFile)->pFile = NULL; if ((*pStrOrFile)->ungetBuf != NULL) { sp_Free(&((*pStrOrFile)->ungetBuf)); } (*pStrOrFile)->ungetBuf = NULL; free(*pStrOrFile); (*pStrOrFile) = NULL; } } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/io/strOrFile.h000066400000000000000000000031461522057144000257710ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #ifndef STR_OR_FILE_H #define STR_OR_FILE_H #ifdef __cplusplus extern "C" { #endif #include #include "../lowLevelUtils/stack.h" #include "strbuf.h" #define INPUT_CONTAINER 1 #define OUTPUT_CONTAINER 2 struct strOrFileStruct { char **pOutputStr; strBufP theStrBuf; FILE *pFile; int containerType; stackP ungetBuf; }; typedef struct strOrFileStruct strOrFileStruct; typedef strOrFileStruct *strOrFileP; strOrFileP sf_NewInputContainer(char const *const inputStr, char const *const fileName); strOrFileP sf_NewOutputContainer(char **pOutputStr, char const *const fileName); int sf_IsValidStrOrFile(strOrFileP theStrOrFile); char sf_getc(strOrFileP theStrOrFile); int sf_ReadSkipChar(strOrFileP theStrOrFile); int sf_ReadSkipWhitespace(strOrFileP theStrOrFile); int sf_ReadSingleDigit(int *digitToRead, strOrFileP theStrOrFile); int sf_ReadInteger(int *intToRead, strOrFileP theStrOrFile); int sf_ReadSkipInteger(strOrFileP theStrOrFile); int sf_ReadSkipLineRemainder(strOrFileP theStrOrFile); char sf_ungetc(char theChar, strOrFileP theStrOrFile); int sf_ungets(char *contentsToUnget, strOrFileP theStrOrFile); char *sf_fgets(char *str, int count, strOrFileP theStrOrFile); int sf_fputs(char const *strToWrite, strOrFileP theStrOrFile); int sf_closeFile(strOrFileP theStrOrFile); void sf_Free(strOrFileP *pStrOrFile); #ifdef __cplusplus } #endif #endif /* STR_OR_FILE_H */ graph-algorithms-planarity-08d7b51/planarity/c/graphLib/io/strbuf.c000066400000000000000000000165441522057144000253660ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "../lowLevelUtils/appconst.h" #include "strbuf.h" #include #include /******************************************************************** sb_New() Allocates a string buffer with space for capacity characters, plus one for a null terminator Returns the allocated string buffer, or NULL on error. ********************************************************************/ strBufP sb_New(int capacity) { strBufP theStrBuf; if (capacity < 0) return NULL; theStrBuf = (strBufP)malloc(sizeof(strBuf)); if (theStrBuf != NULL) { theStrBuf->buf = (char *)malloc((capacity + 1) * sizeof(char)); if (theStrBuf->buf == NULL) { free(theStrBuf); theStrBuf = NULL; } } if (theStrBuf != NULL) { theStrBuf->capacity = capacity; sb_ClearBuf(theStrBuf); } return theStrBuf; } /******************************************************************** sb_Free() Receives a pointer-pointer to a string buffer. Frees the memory of the string buffer structure and the string buffer it contains. Using the pointer-pointer, sets the pointer to NULL. ********************************************************************/ void sb_Free(strBufP *pStrBuf) { if (pStrBuf != NULL && *pStrBuf != NULL) { (*pStrBuf)->capacity = (*pStrBuf)->size = (*pStrBuf)->readPos = 0; if ((*pStrBuf)->buf != NULL) free((*pStrBuf)->buf); (*pStrBuf)->buf = NULL; free(*pStrBuf); *pStrBuf = NULL; } } /******************************************************************** sb_CleareBuf() The string buffer is changed, if not NULL, to hold an empty string, including setting the size and position to 0. The capacity is not changed. ********************************************************************/ void sb_ClearBuf(strBufP theStrBuf) { if (theStrBuf != NULL) { if (theStrBuf->buf != NULL) theStrBuf->buf[0] = '\0'; theStrBuf->size = theStrBuf->readPos = 0; } } /******************************************************************** sb_Copy() Receives strBuf pointers for a destination and source. Ensures that the destination has the capacity of the source. Copies the source string content into the destination, and sets the size correctly. Returns OK for success, NOTOK on param or memory allocation error. ********************************************************************/ int sb_Copy(strBufP strBufDst, strBufP strBufSrc) { char *tempBuf; strBufP newStrBuf = sb_Duplicate(strBufSrc); if (strBufDst == NULL || strBufSrc == NULL || newStrBuf == NULL) { sb_Free(&newStrBuf); return NOTOK; } tempBuf = strBufDst->buf; strBufDst->buf = newStrBuf->buf; newStrBuf->buf = tempBuf; sb_Free(&newStrBuf); strBufDst->size = strBufSrc->size; strBufDst->capacity = strBufSrc->capacity; return OK; } /******************************************************************** sb_Duplicate() Receives a strBuf pointer. Allocates a new strBuf structure with the same capacity, and initially clears it. If the received strBuf has a non-empty string, then it is copied into the duplicate, and the duplicates size is set correctly. Returns the duplicate, or NULL on memory allocation error. ********************************************************************/ strBufP sb_Duplicate(strBufP theStrBuf) { strBufP newStrBuf = sb_New(theStrBuf->capacity); if (newStrBuf == NULL) return NULL; if (theStrBuf->size > 0) { strcpy(newStrBuf->buf, theStrBuf->buf); newStrBuf->size = theStrBuf->size; } return newStrBuf; } /******************************************************************** sb_ReadSkipWhitespace() Advances the read position managed by the string buffer by skipping any number of whitespace characters, if present. ********************************************************************/ void sb_ReadSkipWhitespace(strBufP theStrBuf) { if (theStrBuf != NULL && theStrBuf->buf != NULL) { while (isspace(theStrBuf->buf[theStrBuf->readPos])) theStrBuf->readPos++; } } /******************************************************************** sb_ReadSkipInteger() Advances the read position managed by the string buffer by skipping an initial negative sign, if present, then skipping any number of numeric digits, if present. ********************************************************************/ void sb_ReadSkipInteger(strBufP theStrBuf) { if (theStrBuf != NULL && theStrBuf->buf != NULL) { if (theStrBuf->buf[theStrBuf->readPos] == '-') theStrBuf->readPos++; while (isdigit(theStrBuf->buf[theStrBuf->readPos])) theStrBuf->readPos++; } } /******************************************************************** sb_ConcatString() Appends the content of string s to the end of the content already in the string buffer. If the append would exceed the capacity of the buffer, then the buffer capacity is first increased. It is increased to one greater than the sum of the current capacity and the new string size or double the capacity (to ensure the memory space is big enough for both strings and linear time performance over many small concatenations). Returns OK on success, NOTOK on error ********************************************************************/ int sb_ConcatString(strBufP theStrBuf, char const *s) { int slen = s == NULL ? 0 : strlen(s); if (slen == 0) return OK; if (theStrBuf == NULL || theStrBuf->buf == NULL) return NOTOK; if (theStrBuf->size + slen > theStrBuf->capacity) { int newLen = theStrBuf->size + slen > 2 * theStrBuf->capacity ? theStrBuf->size + slen : 2 * theStrBuf->capacity; char *newBuf = (char *)malloc((newLen + 1) * sizeof(char)); if (newBuf == NULL) return NOTOK; strcpy(newBuf, theStrBuf->buf); free(theStrBuf->buf); theStrBuf->buf = newBuf; theStrBuf->capacity = newLen; } strcpy(theStrBuf->buf + theStrBuf->size, s); theStrBuf->size += slen; return OK; } /******************************************************************** sb_ConcatChar() Converts ch into a one-character string containing ch, then invokes sb_ConcatStr(). Returns Same as sb_ConcatStr() ********************************************************************/ int sb_ConcatChar(strBufP theStrBuf, char ch) { char s[2]; s[0] = ch; s[1] = '\0'; return sb_ConcatString(theStrBuf, s); } /******************************************************************** sb_TakeString() Extracts the buffer string from the received string buffer and returns it. The string buffer is changed to contain a zero length string, so that the buffer can be reused or freed with sb_Free(). Returns NULL on error or a string to be freed by the caller on success. ********************************************************************/ char *sb_TakeString(strBufP theStrBuf) { char *theBuf = NULL; if (theStrBuf == NULL) return NULL; theBuf = theStrBuf->buf; theStrBuf->buf = (char *)malloc(sizeof(char)); theStrBuf->buf[0] = '\0'; theStrBuf->size = theStrBuf->capacity = 0; return theBuf; } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/io/strbuf.h000066400000000000000000000033571522057144000253710ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #ifndef STRBUF_H #define STRBUF_H #ifdef __cplusplus extern "C" { #endif // includes mem functions like memcpy #include typedef struct { char *buf; int size, capacity, readPos; } strBuf; typedef strBuf *strBufP; strBufP sb_New(int); void sb_Free(strBufP *); void sb_ClearBuf(strBufP); int sb_Copy(strBufP, strBufP); strBufP sb_Duplicate(strBufP); #define sb_GetFullString(theStrBuf) (theStrBuf->buf) #define sb_GetSize(theStrBuf) (theStrBuf->size) #define sb_GetCapacity(theStrBuf) (theStrBuf->capacity) #define sb_GetUnreadCharCount(theStrBuf) (theStrBuf->size - theStrBuf->readPos) #define sb_GetReadString(theStrBuf) ((theStrBuf != NULL && theStrBuf->buf != NULL) ? (theStrBuf->buf + theStrBuf->readPos) : NULL) #define sb_GetReadPos(theStrBuf) (theStrBuf->readPos) #define sb_SetReadPos(theStrBuf, theReadPos) \ { \ theStrBuf->readPos = theReadPos; \ } void sb_ReadSkipWhitespace(strBufP); void sb_ReadSkipInteger(strBufP); #define sb_ReadSkipChar(theStrBuf) \ { \ theStrBuf->readPos++; \ } int sb_ConcatString(strBufP, char const *); int sb_ConcatChar(strBufP, char); char *sb_TakeString(strBufP); #ifndef SPEED_MACROS // Optimized SPEED_MACROS versions of larger methods are not used in this module #else // Optimized SPEED_MACROS versions of larger methods are not used in this module #endif #ifdef __cplusplus } #endif #endif /* STRBUF_H */ graph-algorithms-planarity-08d7b51/planarity/c/graphLib/lowLevelUtils/000077500000000000000000000000001522057144000261065ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/planarity/c/graphLib/lowLevelUtils/apiutils.c000066400000000000000000000124331522057144000301070ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include #include #include #include "appconst.h" #include "apiutils.h" #include "apiutils.private.h" // The graphLib gp_ErrorMessage() and gp_Message() calls are suppressed by // default, but an application can turn them on if desired. unsigned quietMode = QUIETMODE_ALL; unsigned gp_GetQuietMode(void) { return quietMode; } void gp_SetQuietMode(unsigned newQuietMode) { quietMode = newQuietMode; } void gp_Message(const char *message, ...) { if (!(gp_GetQuietMode() & QUIETMODE_MESSAGES)) { va_list args; va_start(args, message); vfprintf(stdout, message, args); va_end(args); fprintf(stdout, "\n"); fflush(stdout); } } void gp_MessagePrompt(const char *message, ...) { if (!(gp_GetQuietMode() & QUIETMODE_MESSAGES)) { va_list args; va_start(args, message); vfprintf(stdout, message, args); va_end(args); fprintf(stdout, " "); fflush(stdout); } } void gp_LogErrorMessage(int lineNum, const char *srcFileName, const char *message, ...) { if (!(gp_GetQuietMode() & QUIETMODE_ERRORS)) { va_list args; fprintf(stderr, "[ERROR] "); va_start(args, message); vfprintf(stderr, message, args); va_end(args); if (lineNum > 0 && srcFileName != NULL) fprintf(stderr, "\n\ton line %d of '%s'", lineNum, srcFileName); fprintf(stderr, "\n"); fflush(stderr); } } /******************************************************************** debugNOTOK() This function returns the literal value of NOTOK. In debug mode, NOTOK is redefined to first use printf() to emit information about where in the code a NOTOK has occurred. Then, this method is invoked so that the debug version of NOTOK still returns the NOTOK value. Rather than just returning 0 in the debug-mode NOTOK macro, we invoke this method because it gives the option (with recompilation) of having the program exit on the first NOTOK occurrence. That option is off by default, so we normally get a stack trace of the NOTOK occcurences, but on an exhaustive, long-run test, it can be handy to stop on the first error since otherwise the error message might not be seen. ********************************************************************/ #ifdef DEBUG int debugNOTOK(void) { // exit(-1); return 0; // NOTOK is normally defined to be zero } #endif // LOGGING is not defined in the standard compile configuration. // A graphLib developer can uncomment LOGGING in apiutils.private.h #ifdef LOGGING /******************************************************************** _Log() When the project is compiled with LOGGING enabled, this method writes a string to the file Edge_Addition_Planarity_Suite.LOG in the current working directory. On first write, the file is created or cleared. Call this method with NULL to close the log file. ********************************************************************/ void closeLogFileAtExit(void); void _Log(char const *Str) { static FILE *logfile = NULL; static int triedlogfile = FALSE; if (logfile == NULL && !triedlogfile) { triedlogfile = TRUE; if (atexit(closeLogFileAtExit) != 0) gp_ErrorMessage("Unable to set up atexit() to close Edge_Addition_Planarity_Suite log file on exit"); else { if ((logfile = fopen("Edge_Addition_Planarity_Suite.LOG", WRITETEXT)) == NULL) gp_ErrorMessage("Unable to open the Edge_Addition_Planarity_Suite log file"); } } if (logfile != NULL) { if (Str != NULL) { fprintf(logfile, "%s", Str); fflush(logfile); } else { fclose(logfile); logfile = NULL; } } } void _LogLine(char const *Str) { _Log(Str); _Log("\n"); } void closeLogFileAtExit(void) { _gp_Log(NULL); } static char LogStr[MAXLINE + 1]; char *_MakeLogStr1(const char *format, int one) { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" sprintf(LogStr, format, one); #pragma GCC diagnostic pop return LogStr; } char *_MakeLogStr2(const char *format, int one, int two) { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" sprintf(LogStr, format, one, two); #pragma GCC diagnostic pop return LogStr; } char *_MakeLogStr3(const char *format, int one, int two, int three) { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" sprintf(LogStr, format, one, two, three); #pragma GCC diagnostic pop return LogStr; } char *_MakeLogStr4(const char *format, int one, int two, int three, int four) { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" sprintf(LogStr, format, one, two, three, four); #pragma GCC diagnostic pop return LogStr; } char *_MakeLogStr5(const char *format, int one, int two, int three, int four, int five) { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-nonliteral" sprintf(LogStr, format, one, two, three, four, five); #pragma GCC diagnostic pop return LogStr; } #endif // LOGGING graph-algorithms-planarity-08d7b51/planarity/c/graphLib/lowLevelUtils/apiutils.h000066400000000000000000000034011522057144000301070ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #ifndef APIUTILS_H #define APIUTILS_H #ifdef __cplusplus extern "C" { #endif #include "stdio.h" #define MAXLINE 1024 // The string representation for an integer must account for: an optional '-', // then 10 digits (max signed 32-bit int), and a null-terminator #define MAXCHARSFOR32BITINT 11 #if defined(_MSC_VER) && !defined(__llvm__) && !defined(__INTEL_COMPILER) #define APPLY_FORMAT_ATTRIBUTE 0 #elif defined(__has_attribute) #define APPLY_FORMAT_ATTRIBUTE __has_attribute(format) #elif defined(__GNUC__) || defined(__clang__) #define APPLY_FORMAT_ATTRIBUTE 1 #else #define APPLY_FORMAT_ATTRIBUTE 0 #endif #if APPLY_FORMAT_ATTRIBUTE #if defined(__GNUC__) && !defined(__clang__) #define FORMAT_PRINTF(formatIndex, firstArg) __attribute__((format(gnu_printf, formatIndex, firstArg))) #else #define FORMAT_PRINTF(formatIndex, firstArg) __attribute__((format(printf, formatIndex, firstArg))) #endif #else #define FORMAT_PRINTF(formatIndex, firstArg) #endif // These methods control whether gp_ErrorMessage() and gp_Message() calls // emit output or skip producing output (the default) unsigned gp_GetQuietMode(void); void gp_SetQuietMode(unsigned newQuietMode); #define QUIETMODE_NONE 0 #define QUIETMODE_ERRORS 1 #define QUIETMODE_MESSAGES 2 #define QUIETMODE_ALL 0XFFFFFFFF void gp_Message(const char *message, ...) FORMAT_PRINTF(1, 2); void gp_MessagePrompt(const char *message, ...) FORMAT_PRINTF(1, 2); #define gp_ErrorMessage(...) (gp_LogErrorMessage(__LINE__, __FILE__, __VA_ARGS__)) void gp_LogErrorMessage(int lineNum, const char *srcFileName, const char *message, ...) FORMAT_PRINTF(3, 4); #ifdef __cplusplus } #endif #endif graph-algorithms-planarity-08d7b51/planarity/c/graphLib/lowLevelUtils/apiutils.private.h000066400000000000000000000030361522057144000315640ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #ifndef APIUTILS_PRIVATE_H #define APIUTILS_PRIVATE_H #ifdef __cplusplus extern "C" { #endif /* PRIVATE FUNCTIONS FOR ADDITIONAL INFORMATIONAL LOGGING. If LOGGING is defined by uncommenting it below, then log-related lines write to the log, and otherwise they no-op. By default, neither release nor DEBUG builds including LOGGING. Logging is used to see more details of how various algorithms handle a particular graph. */ // #define LOGGING #ifdef LOGGING #define _gp_LogLine _LogLine #define _gp_Log _Log void _LogLine(const char *Line); void _Log(const char *Line); #define _gp_MakeLogStr1 _MakeLogStr1 #define _gp_MakeLogStr2 _MakeLogStr2 #define _gp_MakeLogStr3 _MakeLogStr3 #define _gp_MakeLogStr4 _MakeLogStr4 #define _gp_MakeLogStr5 _MakeLogStr5 char *_MakeLogStr1(const char *format, int); char *_MakeLogStr2(const char *format, int, int); char *_MakeLogStr3(const char *format, int, int, int); char *_MakeLogStr4(const char *format, int, int, int, int); char *_MakeLogStr5(const char *format, int, int, int, int, int); #else #define _gp_LogLine(Line) #define _gp_Log(Line) #define _gp_MakeLogStr1(format, one) #define _gp_MakeLogStr2(format, one, two) #define _gp_MakeLogStr3(format, one, two, three) #define _gp_MakeLogStr4(format, one, two, three, four) #define _gp_MakeLogStr5(format, one, two, three, four, five) #endif #ifdef __cplusplus } #endif #endif graph-algorithms-planarity-08d7b51/planarity/c/graphLib/lowLevelUtils/appconst.h000066400000000000000000000041331522057144000301070ustar00rootroot00000000000000#ifndef APPCONST_H #define APPCONST_H /* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "apiutils.h" // NOTE: This is defined on 32- and 64-bit Windows systems; see // https://sourceforge.net/p/predef/wiki/OperatingSystems #if defined(WIN32) || defined(_WIN32) #define WINDOWS #endif /* Defines fopen strings for reading and writing text files on PC and UNIX */ #ifdef WINDOWS #define READTEXT "rt" #define WRITETEXT "wt" #define FILE_DELIMITER '\\' #else #define READTEXT "r" #define WRITETEXT "w" #define FILE_DELIMITER '/' #endif /* Define DEBUG to get additional debugging. The default is to define it when MSC does */ #ifdef _DEBUG #define DEBUG #endif /* Some low-level functions are replaced by faster macros, except when debugging */ #define SPEED_MACROS #ifdef DEBUG #undef SPEED_MACROS #endif /* Return status values; OK/NOTOK behave like Boolean true/false, not like program exit codes. */ #define OK 1 #define NOTOK 0 #ifdef DEBUG #undef NOTOK extern int debugNOTOK(void); #include #define NOTOK (printf("NOTOK on Line %d of %s\n", __LINE__, __FILE__), debugNOTOK()) #endif #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #ifndef NULL #define NULL ((void *)0) #endif // Define one of these to use 1-based arrays or the original 0-based arrays // It used to be true that the 1-based arrays were faster, but compiler // optimizations have come a long way in two decades. // // The main advantages of 1-based arrays are readability of the data, // that NIL is still an index within array bounds, that 1-based supports // 0-based files but not the reverse, and continuing the long-time default. #define USE_1BASEDARRAYS // #define USE_0BASEDARRAYS #ifdef USE_0BASEDARRAYS #undef USE_1BASEDARRAYS #endif /* Array indices are used as pointers, and NIL means bad pointer */ #ifdef USE_1BASEDARRAYS // This definition is used with 1-based array indexing #define NIL 0 #define NIL_CHAR 0x00 #else // This definition is used with 0-based array indexing #define NIL -1 #define NIL_CHAR 0xFF #endif #endif graph-algorithms-planarity-08d7b51/planarity/c/graphLib/lowLevelUtils/listcoll.c000066400000000000000000000223111522057144000300760ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #define _LISTCOLL_C #include "appconst.h" #include "listcoll.h" #include /***************************************************************************** The data structure defined by this module manages a set of N objects arranged as a collection of circular lists, each containing distinct elements from the set. On construction, LCNew() creates an array of N nodes, each containing a prev and next pointer. The identity of the node is given by its array index. Each node's prev and next pointers are set to NIL, indicating that the node is not currently part of a list. LCReset() can be called to reset all pointers to NIL. The function LCFree() deallocates the collection of lists and clears the pointer variable used to pass the collection. An empty list is indicated by NIL. To begin a list with node I, call LCPrepend() or LCAppend() with the NIL list and with I as the node. The prev and next pointers in node I are set to I and I is returned as the head of the list. Future calls to LCPrepend() add a node J as the new first element of the list, so the list given as input is pointed to by J's next, and J is returned as the head of the list. Future calls to LCAppend() add a node J as the new last element, so the prev pointer of the list given as input will indicate node J, and the input list is returned as the head of the list. LCInsertAfter() adds a node immediately after a given anchor node. LCInsertBefore() adds a node immediately before a given anchor node and has the same effect on a list as LCPrepend(). The function LCDelete() removes a node I from a list L. If node I is in the list alone, then its pointers are set to NIL, and NIL is returned as the list. If node I is not alone in the list, but it is the head of the list (in other words, I is equal to L), then L's successor is returned as the new head of the list. Whether or not I equals L, node I is deleted by joining its predecessor and successor nodes. LCCopy() copies the contents of one collection to another if both are of equal size. LCGetNext() is used for forward iteration through a list in the collection. The expected iteration pattern is first to process the node one has, then call LCGetNext() to get the next node, so if the result of LCGetNext() would be the head of the list, then NIL is returned instead. This simplifies most coding operations involving LCGetNext(). LCGetPrev() is used for backward iteration through a list in the collection. The expected iteration pattern is that the last list element will be obtained by an initial call to LCGetPrev() with theNode equal to NIL. This call should appear outside of the iteration loop. The iteration loop then proceeds while the current node is not NIL. The loop body processes the current node, then LCGetPrev() is called with theNode equal to the current node. LCGetPrev() returns NIL if theNode is equal to theList. Otherwise, the predecessor of theNode is returned. *****************************************************************************/ /***************************************************************************** LCNew() *****************************************************************************/ listCollectionP LCNew(int N) { listCollectionP theListColl = NULL; if (N <= 0) return theListColl; theListColl = (listCollectionP)malloc(sizeof(listCollectionStruct)); if (theListColl != NULL) { theListColl->List = (lcnode *)malloc(N * sizeof(lcnode)); if (theListColl->List == NULL) { free(theListColl); theListColl = NULL; } else { theListColl->N = N; LCReset(theListColl); } } return theListColl; } /***************************************************************************** LCFree() *****************************************************************************/ void LCFree(listCollectionP *pListColl) { if (pListColl == NULL || *pListColl == NULL) return; if ((*pListColl)->List != NULL) free((*pListColl)->List); free(*pListColl); *pListColl = NULL; } /***************************************************************************** LCInsertAfter() *****************************************************************************/ void LCInsertAfter(listCollectionP listColl, int theAnchor, int theNewNode) { listColl->List[theNewNode].prev = theAnchor; listColl->List[theNewNode].next = listColl->List[theAnchor].next; listColl->List[listColl->List[theAnchor].next].prev = theNewNode; listColl->List[theAnchor].next = theNewNode; } /***************************************************************************** LCInsertBefore() *****************************************************************************/ void LCInsertBefore(listCollectionP listColl, int theAnchor, int theNewNode) { LCPrepend(listColl, theAnchor, theNewNode); } #ifndef SPEED_MACROS /***************************************************************************** LCReset() *****************************************************************************/ void LCReset(listCollectionP listColl) { int K; for (K = 0; K < listColl->N; K++) listColl->List[K].prev = listColl->List[K].next = NIL; } /***************************************************************************** LCCopy() *****************************************************************************/ void LCCopy(listCollectionP dst, listCollectionP src) { int K; if (dst == NULL || src == NULL || dst->N != src->N) return; for (K = 0; K < dst->N; K++) dst->List[K] = src->List[K]; } /***************************************************************************** LCGetNext() *****************************************************************************/ int LCGetNext(listCollectionP listColl, int theList, int theNode) { int next; if (listColl == NULL || theList == NIL || theNode == NIL) return NIL; next = listColl->List[theNode].next; return next == theList ? NIL : next; } /***************************************************************************** LCGetPrev() *****************************************************************************/ int LCGetPrev(listCollectionP listColl, int theList, int theNode) { if (listColl == NULL || theList == NIL) return NIL; if (theNode == NIL) return listColl->List[theList].prev; if (theNode == theList) return NIL; return listColl->List[theNode].prev; } /***************************************************************************** LCPrepend() *****************************************************************************/ int LCPrepend(listCollectionP listColl, int theList, int theNode) { /* If the append worked, then theNode is last, which in a circular list is the direct predecessor of the list head node, so we just back up one. For singletons, the result is unchanged. */ return listColl->List[LCAppend(listColl, theList, theNode)].prev; } /***************************************************************************** LCAppend() *****************************************************************************/ int LCAppend(listCollectionP listColl, int theList, int theNode) { /* If the given list is empty, then the given node becomes the singleton list output */ if (theList == NIL) { listColl->List[theNode].prev = listColl->List[theNode].next = theNode; theList = theNode; } /* Otherwise, make theNode the predecessor of head node of theList, which is where the last node goes in a circular list. */ else { int pred = listColl->List[theList].prev; listColl->List[theList].prev = theNode; listColl->List[theNode].next = theList; listColl->List[theNode].prev = pred; listColl->List[pred].next = theNode; } /* Return the list (only really important if it was NIL) */ return theList; } /***************************************************************************** LCDelete() *****************************************************************************/ int LCDelete(listCollectionP listColl, int theList, int theNode) { /* If the list is a singleton, then NIL its pointers and return NIL for theList*/ if (listColl->List[theList].next == theList) { listColl->List[theList].prev = listColl->List[theList].next = NIL; theList = NIL; } /* Join predecessor and successor, dropping theNode from the list. If theNode is the head of the list, then return the successor as the new head node. */ else { int pred = listColl->List[theNode].prev, succ = listColl->List[theNode].next; listColl->List[pred].next = succ; listColl->List[succ].prev = pred; listColl->List[theNode].prev = listColl->List[theNode].next = NIL; if (theList == theNode) theList = succ; } return theList; } #endif // SPEED_MACROS graph-algorithms-planarity-08d7b51/planarity/c/graphLib/lowLevelUtils/listcoll.h000066400000000000000000000125611522057144000301110ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #ifndef _LISTCOLL_H #define _LISTCOLL_H #ifdef __cplusplus extern "C" { #endif /* This include is needed for memset and memcpy */ #include typedef struct { int prev, next; } lcnode; struct listCollectionStruct { int N; lcnode *List; }; typedef struct listCollectionStruct listCollectionStruct; typedef listCollectionStruct *listCollectionP; listCollectionP LCNew(int N); void LCFree(listCollectionP *pListColl); void LCInsertAfter(listCollectionP listColl, int theAnchor, int theNewNode); void LCInsertBefore(listCollectionP listColl, int theAnchor, int theNewNode); #ifndef SPEED_MACROS void LCReset(listCollectionP listColl); void LCCopy(listCollectionP dst, listCollectionP src); int LCGetNext(listCollectionP listColl, int theList, int theNode); int LCGetPrev(listCollectionP listColl, int theList, int theNode); int LCPrepend(listCollectionP listColl, int theList, int theNode); int LCAppend(listCollectionP listColl, int theList, int theNode); int LCDelete(listCollectionP listColl, int theList, int theNode); #else /* void LCReset(listCollectionP listColl); */ #define LCReset(listColl) memset(listColl->List, NIL_CHAR, listColl->N * sizeof(lcnode)) /* void LCCopy(listCollectionP dst, listCollectionP src) */ #define LCCopy(dst, src) memcpy(dst->List, src->List, src->N * sizeof(lcnode)) /* int LCGetNext(listCollectionP listColl, int theList, int theNode); Return theNode's successor, unless it is theList head pointer */ #define LCGetNext(listColl, theList, theNode) listColl->List[theNode].next == theList ? NIL : listColl->List[theNode].next /* int LCGetPrev(listCollectionP listColl, int theList, int theNode); Return theNode's predecessor unless theNode is theList head. To start going backwards, use NIL for theNode, which returns theList head's predecessor Usage: Obtain last node, loop while NIL not returned, process node then get predecessor. After theList head processed, get predecessor returns NIL because we started with theList head's predecessor. */ #define LCGetPrev(listColl, theList, theNode) \ (theNode == NIL \ ? listColl->List[theList].prev \ : theNode == theList ? NIL \ : listColl->List[theNode].prev) /* int LCPrepend(listCollectionP listColl, int theList, int theNode); If theList is empty, then theNode becomes its only member and is returned. Otherwise, theNode is placed before theList head, and theNode is returned as the new head. */ #define LCPrepend(listColl, theList, theNode) \ (theList == NIL \ ? (listColl->List[theNode].prev = listColl->List[theNode].next = theNode) \ : (listColl->List[theNode].next = theList, \ listColl->List[theNode].prev = listColl->List[theList].prev, \ listColl->List[listColl->List[theNode].prev].next = theNode, \ listColl->List[theList].prev = theNode, \ listColl->List[theList].prev)) /* int LCAppend(listCollectionP listColl, int theList, int theNode); If theList is empty, then theNode becomes its only member and is returned. Otherwise, theNode is placed before theList head, and then theList head is returned. */ #define LCAppend(listColl, theList, theNode) \ (theList == NIL \ ? (listColl->List[theNode].prev = listColl->List[theNode].next = theNode) \ : (listColl->List[theNode].next = theList, \ listColl->List[theNode].prev = listColl->List[theList].prev, \ listColl->List[listColl->List[theNode].prev].next = theNode, \ listColl->List[theList].prev = theNode, \ theList)) /* int LCDelete(listCollectionP listColl, int theList, int theNode); If theList contains only one node, then NIL it out and return NIL meaning empty list Otherwise, join the predecessor and successor, then return either the list head or its successor if the deleted node is the list head (in that case, the caller makes the successor become the new list head).*/ #define LCDelete(listColl, theList, theNode) \ listColl->List[theList].next == theList \ ? (listColl->List[theList].prev = listColl->List[theList].next = NIL) \ : (listColl->List[listColl->List[theNode].prev].next = listColl->List[theNode].next, \ listColl->List[listColl->List[theNode].next].prev = listColl->List[theNode].prev, \ (theList == theNode ? listColl->List[theNode].next : theList)) #endif #ifdef __cplusplus } #endif #endif graph-algorithms-planarity-08d7b51/planarity/c/graphLib/lowLevelUtils/stack.c000066400000000000000000000102671522057144000273650ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "appconst.h" #include "stack.h" #include stackP sp_New(int capacity) { stackP theStack; theStack = (stackP)malloc(sizeof(stackStruct)); if (theStack != NULL) { theStack->S = (int *)malloc(capacity * sizeof(int)); if (theStack->S == NULL) { free(theStack); theStack = NULL; } } if (theStack != NULL) { theStack->capacity = capacity; sp_ClearStack(theStack); } return theStack; } void sp_Free(stackP *pStack) { if (pStack == NULL || *pStack == NULL) return; (*pStack)->capacity = (*pStack)->size = 0; if ((*pStack)->S != NULL) free((*pStack)->S); (*pStack)->S = NULL; free(*pStack); *pStack = NULL; } int sp_CopyContent(stackP stackDst, stackP stackSrc) { if (stackDst->capacity < stackSrc->size) return NOTOK; if (stackSrc->size > 0) memcpy(stackDst->S, stackSrc->S, stackSrc->size * sizeof(int)); stackDst->size = stackSrc->size; return OK; } stackP sp_Duplicate(stackP theStack) { stackP newStack = sp_New(theStack->capacity); if (newStack == NULL) return NULL; if (theStack->size > 0) { memcpy(newStack->S, theStack->S, theStack->size * sizeof(int)); newStack->size = theStack->size; } return newStack; } int sp_Copy(stackP stackDst, stackP stackSrc) { if (sp_CopyContent(stackDst, stackSrc) != OK) { stackP newStack = sp_Duplicate(stackSrc); int *p; if (newStack == NULL) return NOTOK; p = stackDst->S; stackDst->S = newStack->S; newStack->S = p; newStack->capacity = stackDst->capacity; sp_Free(&newStack); stackDst->size = stackSrc->size; stackDst->capacity = stackSrc->capacity; } return OK; } #ifndef SPEED_MACROS int sp_ClearStack(stackP theStack) { theStack->size = 0; return OK; } int sp_GetCurrentSize(stackP theStack) { return theStack->size; } int sp_SetCurrentSize(stackP theStack, int size) { return size > theStack->capacity ? NOTOK : (theStack->size = size, OK); } int sp_IsEmpty(stackP theStack) { return !theStack->size; } int sp_NonEmpty(stackP theStack) { return theStack->size; } int sp__Push(stackP theStack, int a) { if (theStack->size >= theStack->capacity) return NOTOK; theStack->S[theStack->size++] = a; return OK; } int sp__Push2(stackP theStack, int a, int b) { if (theStack->size + 1 >= theStack->capacity) return NOTOK; theStack->S[theStack->size++] = a; theStack->S[theStack->size++] = b; return OK; } int sp__Pop(stackP theStack, int *pA) { if (theStack->size <= 0) return NOTOK; *pA = theStack->S[--theStack->size]; return OK; } int sp__Pop_Discard(stackP theStack) { if (theStack->size <= 0) return NOTOK; --theStack->size; return OK; } int sp__Pop2(stackP theStack, int *pA, int *pB) { if (theStack->size <= 1) return NOTOK; *pB = theStack->S[--theStack->size]; *pA = theStack->S[--theStack->size]; return OK; } int sp__Pop2_Discard1(stackP theStack, int *pA) { if (theStack->size <= 1) return NOTOK; // When a pair of the form (main, secondary) are pushed in order, // it is sometimes necessary to pop the secondary and discard, // then pop and store the main datum. --theStack->size; *pA = theStack->S[--theStack->size]; return OK; } int sp__Pop2_Discard(stackP theStack) { if (theStack->size <= 1) return NOTOK; --theStack->size; --theStack->size; return OK; } int sp_Top(stackP theStack) { return theStack->size ? theStack->S[theStack->size - 1] : NIL; } int sp_Get(stackP theStack, int pos) { if (theStack == NULL || pos < 0 || pos >= theStack->size) return NOTOK; return (theStack->S[pos]); } int sp_Set(stackP theStack, int pos, int val) { if (theStack == NULL || pos < 0 || pos >= theStack->size) return NOTOK; return (theStack->S[pos] = val); } #endif // not defined SPEED_MACROS graph-algorithms-planarity-08d7b51/planarity/c/graphLib/lowLevelUtils/stack.h000066400000000000000000000105451522057144000273710ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #ifndef STACK_H #define STACK_H #ifdef __cplusplus extern "C" { #endif // includes mem functions like memcpy #include struct stackStruct { int *S; int size, capacity; }; typedef struct stackStruct stackStruct; typedef stackStruct *stackP; stackP sp_New(int); void sp_Free(stackP *); int sp_Copy(stackP, stackP); int sp_CopyContent(stackP stackDst, stackP stackSrc); stackP sp_Duplicate(stackP theStack); #define sp_GetCapacity(theStack) (theStack->capacity) #ifndef SPEED_MACROS int sp_ClearStack(stackP); int sp_GetCurrentSize(stackP theStack); int sp_SetCurrentSize(stackP theStack, int top); int sp_IsEmpty(stackP); int sp_NonEmpty(stackP); #define sp_Push(theStack, a) \ { \ if (sp__Push(theStack, (a)) != OK) \ return NOTOK; \ } #define sp_Push2(theStack, a, b) \ { \ if (sp__Push2(theStack, (a), (b)) != OK) \ return NOTOK; \ } int sp__Push(stackP, int); int sp__Push2(stackP, int, int); #define sp_Pop(theStack, a) \ { \ if (sp__Pop(theStack, &(a)) != OK) \ return NOTOK; \ } #define sp_Pop_Discard(theStack) \ { \ if (sp__Pop_Discard(theStack) != OK) \ return NOTOK; \ } #define sp_Pop2(theStack, a, b) \ { \ if (sp__Pop2(theStack, &(a), &(b)) != OK) \ return NOTOK; \ } #define sp_Pop2_Discard1(theStack, a) \ { \ if (sp__Pop2_Discard1(theStack, &(a)) != OK) \ return NOTOK; \ } #define sp_Pop2_Discard(theStack) \ { \ if (sp__Pop2_Discard(theStack) != OK) \ return NOTOK; \ } int sp__Pop(stackP, int *); int sp__Pop_Discard(stackP theStack); int sp__Pop2(stackP, int *, int *); int sp__Pop2_Discard1(stackP theStack, int *pA); int sp__Pop2_Discard(stackP theStack); int sp_Top(stackP); int sp_Get(stackP, int); int sp_Set(stackP, int, int); #else #define sp_ClearStack(theStack) theStack->size = 0 #define sp_GetCurrentSize(theStack) (theStack->size) #define sp_SetCurrentSize(theStack, Size) ((Size) > theStack->capacity ? NOTOK : (theStack->size = (Size), OK)) #define sp_IsEmpty(theStack) !theStack->size #define sp_NonEmpty(theStack) theStack->size #define sp_Push(theStack, a) theStack->S[theStack->size++] = a #define sp_Push2(theStack, a, b) \ { \ sp_Push(theStack, a); \ sp_Push(theStack, b); \ } #define sp_Pop(theStack, a) a = theStack->S[--theStack->size] #define sp_Pop_Discard(theStack) --theStack->size #define sp_Pop2(theStack, a, b) \ { \ sp_Pop(theStack, b); \ sp_Pop(theStack, a); \ } #define sp_Pop2_Discard1(theStack, a) \ { \ sp_Pop_Discard(theStack); \ sp_Pop(theStack, a); \ } #define sp_Pop2_Discard(theStack) \ { \ sp_Pop_Discard(theStack); \ sp_Pop_Discard(theStack); \ } #define sp_Top(theStack) (theStack->size ? theStack->S[theStack->size - 1] : NIL) #define sp_Get(theStack, pos) (theStack->S[pos]) #define sp_Set(theStack, pos, val) (theStack->S[pos] = val) #endif #ifdef __cplusplus } #endif #endif graph-algorithms-planarity-08d7b51/planarity/c/graphLib/planarityRelated/000077500000000000000000000000001522057144000266005ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/planarity/c/graphLib/planarityRelated/graphDrawPlanar.c000066400000000000000000001357331522057144000320350ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "graphDrawPlanar.h" #include "graphDrawPlanar.private.h" // For definition of zero-based IO flag #include "../io/graphIO.h" // For LOGGING-related declarations #include "../lowLevelUtils/apiutils.private.h" #include #include #include extern void _ClearAllVisitedFlagsInGraph(graphP theGraph); /* Private functions exported to system */ void _CollectDrawingData(DrawPlanarContext *context, int RootVertex, int W, int WPrevLink); int _BreakTie(DrawPlanarContext *context, int BicompRoot, int W, int WPrevLink); int _ComputeVisibilityRepresentation(DrawPlanarContext *context); int _CheckVisibilityRepresentationIntegrity(DrawPlanarContext *context); /* Private functions */ int _ComputeVertexPositions(DrawPlanarContext *context); int _ComputeVertexPositionsInComponent(DrawPlanarContext *context, int root, int *pIndex); int _ComputeEdgePositions(DrawPlanarContext *context); int _ComputeVertexRanges(DrawPlanarContext *context); int _ComputeEdgeRanges(DrawPlanarContext *context); int _GetNextExternalFaceVertex(graphP theGraph, int curVertex, int *pPrevLink); char *_RenderToString(graphP theEmbedding); #ifdef LOGGING void _LogEdgeList(graphP theEmbedding, listCollectionP edgeList, int edgeListHead); #endif /******************************************************************** _ComputeVisibilityRepresentation() Compute vertex positions Compute edge positions Assign horizontal ranges of vertices Assign vertical ranges of edges ********************************************************************/ int _ComputeVisibilityRepresentation(DrawPlanarContext *context) { if (sp_NonEmpty(context->theGraph->edgeHoles)) return NOTOK; if (_ComputeVertexPositions(context) != OK) return NOTOK; if (_ComputeEdgePositions(context) != OK) return NOTOK; if (_ComputeVertexRanges(context) != OK) return NOTOK; if (_ComputeEdgeRanges(context) != OK) return NOTOK; return OK; } /******************************************************************** _ComputeVertexPositions() Computes the vertex positions in the graph. This method accounts for disconnected graphs by finding the DFS tree roots and then, for each, invoking _ComputeVertexPositionsInComponent(). The index variable for the positioning is maintained by this method so that the vertices in separate components still get distinct vertex positions. ********************************************************************/ int _ComputeVertexPositions(DrawPlanarContext *context) { graphP theEmbedding = context->theGraph; int v, vertpos; vertpos = 0; for (v = gp_LowerBoundVertices(theEmbedding); v < gp_UpperBoundVertices(theEmbedding); ++v) { // For each DFS tree root in the embedding, we // compute the vertex positions if (gp_IsDFSTreeRoot(theEmbedding, v)) { if (_ComputeVertexPositionsInComponent(context, v, &vertpos) != OK) return NOTOK; } } return OK; } /******************************************************************** _ComputeVertexPositionsInComponent() The vertical positions of the vertices are computed based in part on the information compiled during the planar embedding. Each vertex is marked as being between its parent and some ancestor or beyond the parent relative to the ancestor. The localized, intuitive notion is that the vertex is either below the parent or above the parent, but the bicomp containing the vertex, its parent and the ancestor may be turned upside-down as the result of a global sequence of operations, resulting in a between or beyond generalization. As the core planarity algorithm constructs successively larger bicomps out of smaller ones, the bicomp root and its DFS child are marked as 'tied' in vertex position using markers along the external face. The marking of the DFS child may be indirect. Since the child may not be on the external face, its descendant that is next along the external face is marked instead. Later (possibly in the same step or possibly many vertices later), the Walkdown proceeds around the bicomp and returns to each merge point, and the tie is broken based on the direction of approach. As the Walkdown passes a vertex to its successor, the external face is short-circuited to remove the vertex from it. Immediately before this occurs, the new drawing method resolves the tie. Since the vertex is going to the internal face, its vertex position should be 'between' its successor and the current vertex being processed by the Walkdown. If the vertex is a child of its external face successor, then it is simply marked as being 'between' that successor and the current vertex being processed by the planarity method. But if the vertex is the parent of its external face successor, then the successor is placed 'beyond' the vertex. Recall that the successor is either the DFS child of the vertex or a descendant of that DFS child that was specially marked because it, not the DFS child, was on the external face. This explains the information that has been collected by the planarity embedder, which will now be turned into a vertex ordering system. The idea is to proceed with a pre-order traversal of the DFS tree, determining the relative orders of the ancestors of a vertex by the time we get to a vertex. This will allow us to convert between/beyond into above/below based on the known relative order of the parent and some given ancestor of the vertex. A vertex would then be added immediately above or below its parent in the total ordering, and then the algorithm proceeds to the descendants. Consider a depth-first pre-order visitation of vertices. If the full order of all vertices visited so far is dynamically maintained, then it is easy to decide whether a vertex goes above or below its parent based on the between/beyond indicator and the relative positions in the order of the parent and given ancestor of the vertex. If the ancestor is above the parent, then 'between' means put the vertex immediately above its parent and 'beyond' means put the vertex immediately below its parent in the order. And if the ancestor is below the parent, then the meaning of between and beyond are simply reversed. Once a vertex is known to be above or below its parent, the drawing flag is changed from between/beyond to above/below, and processing proceeds to the next vertex in pre-order depth first search. The difficulty lies in keeping an up-to-date topological ordering that can be queried in constant time to find the relative positions of two vertices. By itself, this is an instance of "online" or dynamic topological sorting and has been proven not to be achievable in linear total time. But this is a special case of the problem and is therefore solvable through the collection and maintenance of some additional information. Recall that the ancestor V of a vertex is recorded when the setting for between/beyond is made for a vertex. However, the Walkdown is invoked on the bicomp rooted by edge (V', C), so the child C of V that roots the subtree containing the vertex being marked is known. Note that when a DFS child is placed above its parent, the entire DFS subtree of vertices is placed above the parent. Hence, to determine whether the parent P of a vertex W is above the ancestor V, where W is marked either between or beyond P and V, we need only determine the relationship between V and C, which has already been directly determined due to previous steps of the algorithm (because V and C are ancestors of P and W). If C is above/below V then so is P. As mentioned above, once the position of P is known relative to V, it is a simple matter to decide whether to put W above or below P based on the between/beyond indicator stored in W during embedding. ********************************************************************/ int _ComputeVertexPositionsInComponent(DrawPlanarContext *context, int root, int *pVertpos) { graphP theEmbedding = context->theGraph; listCollectionP theOrder = LCNew(gp_UpperBoundVertices(theEmbedding)); int W, P, C, V, e; if (theOrder == NULL) return NOTOK; // Determine the vertex order using a depth first search with // pre-order visitation. sp_ClearStack(theEmbedding->theStack); sp_Push(theEmbedding->theStack, root); while (!sp_IsEmpty(theEmbedding->theStack)) { sp_Pop(theEmbedding->theStack, W); P = gp_GetVertexParent(theEmbedding, W); V = context->VI[W].ancestor; C = context->VI[W].ancestorChild; // For the special case that we just popped the DFS tree root, // we simply add the root to its own position. if (gp_IsNotVertex(theEmbedding, P)) { // Put the DFS root in the list by itself LCAppend(theOrder, NIL, W); // The children of the DFS root have the root as their // ancestorChild and 'beyond' as the drawingFlag, so this // causes the root's children to be placed below the root context->VI[W].drawingFlag = DRAWINGFLAG_BELOW; } // Determine vertex W position relative to P else { // An unresolved tie is an error if (context->VI[W].drawingFlag == DRAWINGFLAG_TIE) return NOTOK; // If W is the child of a DFS root, then there is no vertex C // between it and some ancestor V. Both V and C are not a vertex, // and W will simply take the default of being below its parent. // If C is a vertex, then it has already been absolutely positioned // and can be used to help position W relative to its parent P, // which is equal to or descendant to C. If C below V, then P below V, // so interpret 'W between P and V' as 'W above P', and interpret // 'W beyond P relative to V' as 'W below P'. if (gp_IsNotVertex(theEmbedding, C) || context->VI[C].drawingFlag == DRAWINGFLAG_BELOW) { if (context->VI[W].drawingFlag == DRAWINGFLAG_BETWEEN) context->VI[W].drawingFlag = DRAWINGFLAG_ABOVE; else context->VI[W].drawingFlag = DRAWINGFLAG_BELOW; } // If C above V, then P above V, so interpret W between // P and V as W below P, and interpret W beyond P relative // to V as W above P. else { if (context->VI[W].drawingFlag == DRAWINGFLAG_BETWEEN) context->VI[W].drawingFlag = DRAWINGFLAG_BELOW; else context->VI[W].drawingFlag = DRAWINGFLAG_ABOVE; } if (context->VI[W].drawingFlag == DRAWINGFLAG_BELOW) LCInsertAfter(theOrder, P, W); else LCInsertBefore(theOrder, P, W); } // Push DFS children e = gp_GetFirstEdge(theEmbedding, W); while (gp_IsEdge(theEmbedding, e)) { if (gp_GetEdgeType(theEmbedding, e) == EDGE_TYPE_CHILD) sp_Push(theEmbedding->theStack, gp_GetNeighbor(theEmbedding, e)); e = gp_GetNextEdge(theEmbedding, e); } } // Use the order to assign vertical positions V = root; while (gp_IsVertex(theEmbedding, V)) { context->VI[V].pos = *pVertpos; (*pVertpos)++; V = LCGetNext(theOrder, root, V); } // Clean up and return LCFree(&theOrder); return OK; } #ifdef LOGGING /******************************************************************** _LogEdgeList() Used to show the progressive calculation of the edge position list. ********************************************************************/ void _LogEdgeList(graphP theEmbedding, listCollectionP edgeList, int edgeListHead) { int eIndex = edgeListHead, e, eTwin; _gp_Log("EdgeList: [ "); while (gp_IsEdge(theEmbedding, eIndex)) { e = (eIndex << 1); eTwin = gp_GetTwin(theEmbedding, e); _gp_Log(_gp_MakeLogStr2("(%d, %d) ", gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, e)), gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, eTwin)))); eIndex = LCGetNext(edgeList, edgeListHead, eIndex); } _gp_LogLine("]"); } #endif /******************************************************************** _ComputeEdgePositions() Performs a vertical sweep of the combinatorial planar embedding, developing the edge order in the horizontal sweep line as it advances through the vertices according to their assigned vertical positions. The 'visitedInfo' member of each vertex is used to indicate the location in the edge order list of the generator edge for the vertex. The generator edge is the first edge used to visit the vertex from a higher vertex in the drawing (i.e. a vertex with an earlier, or lower, position number). All edges added from this vertex to the neighbors below it are added immediately after the generator edge for the vertex. ********************************************************************/ int _ComputeEdgePositions(DrawPlanarContext *context) { graphP theEmbedding = context->theGraph; int *vertexOrder = NULL; listCollectionP edgeList = NULL; int edgeListHead, edgeListInsertPoint; int e, eTwin, eCur, v, vpos, epos, eIndex; _gp_LogLine("\ngraphDrawPlanar.c/_ComputeEdgePositions() start"); // Sort the vertices by vertical position (in linear time) if ((vertexOrder = (int *)malloc(gp_GetN(theEmbedding) * sizeof(int))) == NULL) { return NOTOK; } for (v = gp_LowerBoundVertices(theEmbedding); v < gp_UpperBoundVertices(theEmbedding); ++v) vertexOrder[context->VI[v].pos] = v; // Allocate the edge list of size M. // This is an array of (prev, next) pointers. // An edge at position X corresponds to the edge // at position X in the graph structure, which is // represented by a pair of adjacent edge records // at index 2X. if (gp_GetM(theEmbedding) > 0 && (edgeList = LCNew(gp_LowerBoundEdges(theEmbedding) / 2 + gp_GetM(theEmbedding))) == NULL) { free(vertexOrder); vertexOrder = NULL; return NOTOK; } edgeListHead = NIL; // Each vertex starts out with a NIL generator edge. for (v = gp_LowerBoundVertices(theEmbedding); v < gp_UpperBoundVertices(theEmbedding); ++v) gp_SetVertexVisitedInfo(theEmbedding, v, NIL); // Perform the vertical sweep of the combinatorial embedding, using // the vertex ordering to guide the sweep. // For each vertex, each edge leading to a vertex with a higher number in // the vertex order is recorded as the "generator edge", or the edge of // first discovery of that higher numbered vertex, unless the vertex already has // a recorded generator edge for (vpos = 0; vpos < gp_GetN(theEmbedding); vpos++) { // Get the vertex associated with the position v = vertexOrder[vpos]; _gp_LogLine(_gp_MakeLogStr3("Processing vertex %d with DFI=%d at position=%d", gp_GetIndex(theEmbedding, v), v, vpos)); // The DFS tree root of a connected component is always the least // number vertex in the vertex ordering. We have to give it a // false generator edge so that it is still "visited" and then // all of its edges are generators for its neighbor vertices because // they all have greater numbers in the vertex order. if (gp_IsDFSTreeRoot(theEmbedding, v)) { // Set a false generator edge, so the vertex is distinguishable from // a vertex with no generator edge when its neighbors are visited // This way, an edge from a neighbor won't get recorded as the // generator edge of the DFS tree root. gp_SetVertexVisitedInfo(theEmbedding, v, NIL - 1); // Now we traverse the adjacency list of the DFS tree root and // record each edge as the generator edge of the neighbors e = gp_GetFirstEdge(theEmbedding, v); while (gp_IsEdge(theEmbedding, e)) { eIndex = (e >> 1); // div by 2 since each edge is a pair of edge records edgeListHead = LCAppend(edgeList, edgeListHead, eIndex); _gp_LogLine(_gp_MakeLogStr2("Append generator edge (%d, %d) to edgeList", gp_GetIndex(theEmbedding, v), gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, e)))); // Set the generator edge for the root's neighbor gp_SetVertexVisitedInfo(theEmbedding, gp_GetNeighbor(theEmbedding, e), e); // Go to the next node of the root's adj list e = gp_GetNextEdge(theEmbedding, e); } } // Else, if we are not on a DFS tree root... else { // Get the generator edge of the vertex // Note that this never gets the false generator edge of a DFS tree root eTwin = gp_GetVertexVisitedInfo(theEmbedding, v); if (gp_IsNotEdge(theEmbedding, eTwin)) return NOTOK; e = gp_GetTwin(theEmbedding, eTwin); // Traverse the edges of the vertex, starting // from the generator edge and going counterclockwise... eIndex = (e >> 1); edgeListInsertPoint = eIndex; eCur = gp_GetNextEdgeCircular(theEmbedding, e); while (eCur != e) { // If the neighboring vertex's position is greater // than the current vertex (meaning it is lower in the // diagram), then add that edge to the edge order. if (context->VI[gp_GetNeighbor(theEmbedding, eCur)].pos > vpos) { eIndex = eCur >> 1; LCInsertAfter(edgeList, edgeListInsertPoint, eIndex); _gp_LogLine(_gp_MakeLogStr4("Insert (%d, %d) after (%d, %d)", gp_GetIndex(theEmbedding, v), gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, eCur)), gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, gp_GetTwin(theEmbedding, e))), gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, e)))); edgeListInsertPoint = eIndex; // If the vertex does not yet have a generator edge, then set it. // Note that a DFS tree root has a false generator edge, so this if // test avoids setting a generator edge for a DFS tree root if (gp_IsNotEdge(theEmbedding, gp_GetVertexVisitedInfo(theEmbedding, gp_GetNeighbor(theEmbedding, eCur)))) { gp_SetVertexVisitedInfo(theEmbedding, gp_GetNeighbor(theEmbedding, eCur), eCur); _gp_LogLine(_gp_MakeLogStr2("Generator edge (%d, %d)", gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, gp_GetTwin(theEmbedding, e))), gp_GetIndex(theEmbedding, gp_GetNeighbor(theEmbedding, eCur)))); } } // Go to the next node in v's adjacency list eCur = gp_GetNextEdgeCircular(theEmbedding, eCur); } } #ifdef LOGGING _LogEdgeList(theEmbedding, edgeList, edgeListHead); #endif } // Now iterate through the edgeList and assign positions to the edges. epos = 0; eIndex = edgeListHead; e = eIndex == NIL ? NIL : (eIndex << 1); while (gp_IsEdge(theEmbedding, e)) { eTwin = gp_GetTwin(theEmbedding, e); context->E[e].pos = context->E[eTwin].pos = epos; epos++; eIndex = LCGetNext(edgeList, edgeListHead, eIndex); e = eIndex == NIL ? NIL : (eIndex << 1); } // Clean up and return LCFree(&edgeList); free(vertexOrder); vertexOrder = NULL; _gp_LogLine("graphDrawPlanar.c/_ComputeEdgePositions() end\n"); return OK; } /******************************************************************** _ComputeVertexRanges() Assumes edge positions are known (see _ComputeEdgePositions()). A vertex spans horizontally the positions of the edges incident to it. ********************************************************************/ int _ComputeVertexRanges(DrawPlanarContext *context) { graphP theEmbedding = context->theGraph; int v = NIL, e = NIL, min = NIL, max = NIL; for (v = gp_LowerBoundVertices(theEmbedding); v < gp_UpperBoundVertices(theEmbedding); ++v) { min = gp_GetM(theEmbedding) + 1; max = NIL; // Iterate the edges, except in the isolated vertex case we just // set the min and max to 1 since there no edges controlling where // it gets drawn. e = gp_GetFirstEdge(theEmbedding, v); if (gp_IsNotEdge(theEmbedding, e)) { min = max = 0; } else { while (gp_IsEdge(theEmbedding, e)) { if (min > context->E[e].pos) min = context->E[e].pos; if (max < context->E[e].pos) max = context->E[e].pos; e = gp_GetNextEdge(theEmbedding, e); } } context->VI[v].start = min; context->VI[v].end = max; } return OK; } /******************************************************************** _ComputeEdgeRanges() Assumes vertex positions are known (see _ComputeVertexPositions()). An edges spans the vertical range of its endpoints. ********************************************************************/ int _ComputeEdgeRanges(DrawPlanarContext *context) { graphP theEmbedding = context->theGraph; int e, eTwin, v1, v2, pos1, pos2; // Deleted edges are not supported, nor should they be in the embedding, so // this is just a reality check that avoids an in-use test inside the loop if (sp_NonEmpty(theEmbedding->edgeHoles)) return NOTOK; for (e = gp_LowerBoundEdges(theEmbedding); e < gp_UpperBoundEdges(theEmbedding); e += 2) { eTwin = gp_GetTwin(theEmbedding, e); v1 = gp_GetNeighbor(theEmbedding, e); v2 = gp_GetNeighbor(theEmbedding, eTwin); pos1 = context->VI[v1].pos; pos2 = context->VI[v2].pos; if (pos1 < pos2) { context->E[e].start = pos1; context->E[e].end = pos2; } else { context->E[e].start = pos2; context->E[e].end = pos1; } context->E[eTwin].start = context->E[e].start; context->E[eTwin].end = context->E[e].end; } return OK; } /******************************************************************** _GetNextExternalFaceVertex() Uses the extFace links to traverse to the next vertex on the external face given a current vertex and the link that points to its predecessor. ********************************************************************/ int _GetNextExternalFaceVertex(graphP theGraph, int curVertex, int *pPrevLink) { int nextVertex = gp_GetExtFaceVertex(theGraph, curVertex, 1 ^ *pPrevLink); // If the two links in the new vertex are not equal, then only one points // back to the current vertex, and it is the new prev link. // Otherwise, the vertex is in a consistently oriented single-edge bicomp, so // no adjustment of the prev link is needed (due to the consistent orientation). if (gp_GetExtFaceVertex(theGraph, nextVertex, 0) != gp_GetExtFaceVertex(theGraph, nextVertex, 1)) { *pPrevLink = gp_GetExtFaceVertex(theGraph, nextVertex, 0) == curVertex ? 0 : 1; } return nextVertex; } /******************************************************************** _CollectDrawingData() To be called by core planarity Walkdown immediately before merging bicomps and embedding a new back edge. Each bicomp is rooted by a DFS tree edge. The parent vertex in that edge is the bicomp root, and the bicomp contains one DFS child of the vertex, which is on the child end of the 'root edge'. Here we decide whether the DFS child is to be embedded between or beyond its parent relative to vertex v, the one currently being processed (and the ancestor endpoint of a back edge being embedded, where the descendant endpoint is also an endpoint of the bicomp root being merged). ********************************************************************/ void _CollectDrawingData(DrawPlanarContext *context, int RootVertex, int W, int WPrevLink) { graphP theEmbedding = context->theGraph; int K, Parent, BicompRoot, DFSChild, direction, descendant; _gp_LogLine("\ngraphDrawPlanar.c/_CollectDrawingData() start"); _gp_LogLine(_gp_MakeLogStr3("_CollectDrawingData(RootVertex=%d, W=%d, W_in=%d)", RootVertex, W, WPrevLink)); /* Process all of the merge points to set their drawing flags. */ for (K = 0; K < sp_GetCurrentSize(theEmbedding->theStack); K += 4) { /* Get the parent and child that are about to be merged from the 4-tuple in the merge stack */ Parent = theEmbedding->theStack->S[K]; BicompRoot = theEmbedding->theStack->S[K + 2]; DFSChild = gp_GetDFSChildFromBicompRoot(theEmbedding, BicompRoot); /* We get the active descendant vertex in the child bicomp that will be adjacent to the parent along the external face. This vertex is guaranteed to be found in one step due to external face 'short-circuiting' that was done in step 'Parent' of the planarity algorithm. */ direction = theEmbedding->theStack->S[K + 3]; descendant = _GetNextExternalFaceVertex(theEmbedding, BicompRoot, &direction); /* Now we set the tie flag in the DFS child, and mark the descendant and parent with non-NIL pointers to the child whose tie flag is to be resolved as soon as one of the two is connected to by an edge or child bicomp merge. */ context->VI[DFSChild].drawingFlag = DRAWINGFLAG_TIE; context->VI[descendant].tie[direction] = DFSChild; direction = theEmbedding->theStack->S[K + 1]; context->VI[Parent].tie[direction] = DFSChild; _gp_LogLine(_gp_MakeLogStr5("V[Parent=%d]=.tie[%d] = V[descendant=%d].tie[%d] = (child=%d)", Parent, direction, descendant, theEmbedding->theStack->S[K + 3], DFSChild)); } _gp_LogLine("graphDrawPlanar.c/_CollectDrawingData() end\n"); } /******************************************************************** _BreakTie() The given vertex W has just been arrived at by the core planarity algorithm. Using WPrevLink, we seek its predecessor WPred on the external face and test whether the two are involved in a tie that can be resolved. Since the planarity algorithm has just passed by WPred, it is safe to conclude that WPred can go between W and the current vertex. Of course, if W was the parent to some DFS child whose subtree contains WPred, then the DFS child is marked 'between', placing the whole subtree including WPred between W and the current vertex. On the other hand, if WPred was the parent of some DFS child whose subtree contained W, then we achieve the same effect of putting WPred 'between' W and the current vertex by marking the DFS child 'beyond'. Since the DFS child and hence W are beyond W relative to the current vertex, WPred is also between W and the current vertex. Thus the certain positional relationship between W and WPred relative to a specific ancestor, the current vertex, is used to indirectly break the positional tie between MIN(W, WPred) and the DFS child of MIN(W, WPred) whose subtree contains MAX(W, WPred). The ancestorChild is the DFS child of the current vertex whose DFS subtree contains W and WPred, and it is recorded here in order to optimize the post-processing calculation of vertex positions. ********************************************************************/ int _BreakTie(DrawPlanarContext *context, int BicompRoot, int W, int WPrevLink) { graphP theEmbedding = context->theGraph; /* First we get the predecessor of W. */ int WPredNextLink = 1 ^ WPrevLink, WPred = _GetNextExternalFaceVertex(theEmbedding, W, &WPredNextLink); _gp_LogLine("\ngraphDrawPlanar.c/::_BreakTie() start"); _gp_LogLine(_gp_MakeLogStr4("_BreakTie(BicompRoot=%d, W=%d, W_in=%d) WPred=%d", BicompRoot, W, WPrevLink, WPred)); /* Ties happen only within a bicomp (i.e. between two non-root vertices) */ if (gp_IsVirtualVertex(theEmbedding, W) || gp_IsVirtualVertex(theEmbedding, WPred)) { _gp_LogLine("graphDrawPlanar.c/_BreakTie() end\n"); return OK; } /* The two vertices are either tied or not; having one tied and the other not is an error */ if (context->VI[W].tie[WPrevLink] != context->VI[WPred].tie[WPredNextLink]) return NOTOK; /* If there is a tie, it can now be resolved. */ if (gp_IsVertex(theEmbedding, context->VI[W].tie[WPrevLink])) { int DFSChild = context->VI[W].tie[WPrevLink]; /* Set the two ancestor variables that contextualize putting W 'between' or 'beyond' its parent relative to what. */ context->VI[DFSChild].ancestorChild = gp_GetDFSChildFromBicompRoot(theEmbedding, BicompRoot); context->VI[DFSChild].ancestor = gp_GetVertexFromBicompRoot(theEmbedding, BicompRoot); _gp_LogLine(_gp_MakeLogStr4("V[child=%d]=.ancestorChild = %d, V[child=%d]=.ancestor = %d", DFSChild, context->VI[DFSChild].ancestorChild, DFSChild, context->VI[DFSChild].ancestor)); /* If W is the ancestor of WPred, then the DFSChild subtree contains WPred, and so must go between W and some ancestor. */ if (W < WPred) { context->VI[DFSChild].drawingFlag = DRAWINGFLAG_BETWEEN; _gp_LogLine(_gp_MakeLogStr3("Child=%d is 'between' ancestorChild=%d and ancestor=%d", DFSChild, context->VI[DFSChild].ancestorChild, context->VI[DFSChild].ancestor)); } /* If W is the descendant, so we achieve the effect of putting WPred between DFSChild and ancestor by putting the DFSChild 'beyond' WPred. */ else { context->VI[DFSChild].drawingFlag = DRAWINGFLAG_BEYOND; _gp_LogLine(_gp_MakeLogStr3("Child=%d is 'beyond' ancestorChild=%d relative to ancestor=%d", DFSChild, context->VI[DFSChild].ancestorChild, context->VI[DFSChild].ancestor)); } /* The tie is resolved so clear the flags*/ context->VI[W].tie[WPrevLink] = NIL; context->VI[WPred].tie[WPredNextLink] = NIL; } _gp_LogLine("graphDrawPlanar.c/_BreakTie() end\n"); return OK; } /******************************************************************** _RenderToString() Draws the previously calculated visibility representation in a string of size (M+1)*2N + 1 characters, which should be deallocated with free(). Returns NULL on failure, or the string containing the visibility representation otherwise. The string can be printed using %s, ********************************************************************/ char *_RenderToString(graphP theEmbedding) { DrawPlanarContext *context = NULL; gp_FindExtension(theEmbedding, DRAWPLANAR_ID, (void *)&context); if (context != NULL) { int N = gp_GetN(theEmbedding); int M = gp_GetM(theEmbedding); int zeroBasedVertexOffset = 0; int n, m, v, vRange, eRange, Mid, Pos; int e; char *visRep = (char *)malloc(sizeof(char) * ((M + 1) * 2 * N + 1)); char numBuffer[32]; if (visRep == NULL) return NULL; // If edges were deleted from the embedding, then the visibility representation is // no longer valid. (This is a necessary condition but not sufficient to guarantee // no embedding mutations, because adding edges uses the holes, and other APIs // allow edge changes). if (sp_NonEmpty(theEmbedding->edgeHoles)) { free(visRep); visRep = NULL; return NULL; } // If we are supposed to write 0-based output, then we have to set this variable to indicate // how much to subtract from each vertex index based on whether this library has been // compiled with 0-based or 1-based array indexing for the in-memory data structure (i.e., // compiled with USE_1BASEDARRAYS versus USE_0BASEDARRAYS). // The macro invoked is responsive to the compile-time difference. if (gp_GetGraphFlags(theEmbedding) & GRAPHFLAGS_ZEROBASEDIO) zeroBasedVertexOffset = gp_LowerBoundVertexStorage(theEmbedding); // Clear the space for (n = 0; n < N; n++) { for (m = 0; m < M; m++) { visRep[(2 * n) * (M + 1) + m] = ' '; visRep[(2 * n + 1) * (M + 1) + m] = ' '; } visRep[(2 * n) * (M + 1) + M] = '\n'; visRep[(2 * n + 1) * (M + 1) + M] = '\n'; } // Draw the vertices for (v = gp_LowerBoundVertices(theEmbedding); v < gp_UpperBoundVertices(theEmbedding); ++v) { Pos = context->VI[v].pos; for (vRange = context->VI[v].start; vRange <= context->VI[v].end; vRange++) visRep[(2 * Pos) * (M + 1) + vRange] = '-'; // Draw vertex label Mid = (context->VI[v].start + context->VI[v].end) / 2; sprintf(numBuffer, "%d", v - zeroBasedVertexOffset); if ((unsigned)(context->VI[v].end - context->VI[v].start + 1) >= strlen(numBuffer)) { memcpy((char *)visRep + (2 * Pos) * (M + 1) + Mid, (char *)numBuffer, strlen(numBuffer)); } // If the vertex width is less than the label width, then fail gracefully else { if (strlen(numBuffer) == 2) visRep[(2 * Pos) * (M + 1) + Mid] = numBuffer[0]; else visRep[(2 * Pos) * (M + 1) + Mid] = '*'; visRep[(2 * Pos + 1) * (M + 1) + Mid] = numBuffer[strlen(numBuffer) - 1]; } } // Draw the edges for (e = gp_LowerBoundEdges(theEmbedding); e < gp_UpperBoundEdges(theEmbedding); e += 2) { Pos = context->E[e].pos; for (eRange = context->E[e].start; eRange < context->E[e].end; eRange++) { if (eRange > context->E[e].start) visRep[(2 * eRange) * (M + 1) + Pos] = '|'; visRep[(2 * eRange + 1) * (M + 1) + Pos] = '|'; } } // Null terminate string and return it visRep[(M + 1) * 2 * N] = '\0'; return visRep; } return NULL; } /******************************************************************** gp_DrawPlanar_RenderToString() Creates a rendition of the planar graph visibility representation as a string, and return it via the pRenditionString parameter. The caller can use free() to get rid of the returned string after use. Returns NOTOK for any error, OK otherwise. ********************************************************************/ int gp_DrawPlanar_RenderToString(graphP theEmbedding, char **pRenditionString) { if (theEmbedding != NULL && sp_IsEmpty(theEmbedding->edgeHoles) && pRenditionString != NULL) { *pRenditionString = _RenderToString(theEmbedding); return *pRenditionString != NULL ? OK : NOTOK; } return NOTOK; } /******************************************************************** gp_DrawPlanar_RenderToFile() Creates a rendition of the planar graph visibility representation as a string, then dumps the string to the file. theFileName - can be "stdout", "stderr" or a file system file name Returns NOTOK for any error, OK otherwise. ********************************************************************/ int gp_DrawPlanar_RenderToFile(graphP theEmbedding, char *theFileName) { int Result = OK; if (theEmbedding != NULL && sp_IsEmpty(theEmbedding->edgeHoles)) { FILE *outfile; char *theRendition; if (strcmp(theFileName, "stdout") == 0) outfile = stdout; else if (strcmp(theFileName, "stderr") == 0) outfile = stderr; else outfile = fopen(theFileName, WRITETEXT); if (outfile == NULL) return NOTOK; theRendition = _RenderToString(theEmbedding); Result = theRendition ? OK : NOTOK; if (theRendition != NULL) { fprintf(outfile, "%s", theRendition); free(theRendition); theRendition = NULL; } if (strcmp(theFileName, "stdout") == 0 || strcmp(theFileName, "stderr") == 0) fflush(outfile); else if (fclose(outfile) != 0) return NOTOK; return Result; } return NOTOK; } /******************************************************************** _CheckVisibilityRepresentationIntegrity() ********************************************************************/ int _CheckVisibilityRepresentationIntegrity(DrawPlanarContext *context) { graphP theEmbedding = context->theGraph; int v, e, eTwin, epos, eposIndex; if (sp_NonEmpty(context->theGraph->edgeHoles)) return NOTOK; _ClearAllVisitedFlagsInGraph(theEmbedding); /* Test whether the vertex values make sense and whether the vertex positions are unique. */ for (v = gp_LowerBoundVertices(theEmbedding); v < gp_UpperBoundVertices(theEmbedding); ++v) { if (gp_GetM(theEmbedding) > 0) { if (context->VI[v].pos < 0 || context->VI[v].pos >= gp_GetN(theEmbedding) || context->VI[v].start < 0 || context->VI[v].start > context->VI[v].end || context->VI[v].end >= gp_GetM(theEmbedding)) return NOTOK; } // Has the vertex position been used by a vertex before vertex v? if (gp_GetVisited(theEmbedding, context->VI[v].pos + gp_LowerBoundVertexStorage(theEmbedding))) return NOTOK; // Mark the vertex position as used by vertex v. // Note that this marking is made on some other vertex unrelated to v // We're just reusing the vertex visited array as cheap storage for a // detector of reusing vertex position integers. gp_SetVisited(theEmbedding, context->VI[v].pos + gp_LowerBoundVertexStorage(theEmbedding)); } /* Test whether the edge values make sense and whether the edge positions are unique */ for (e = gp_LowerBoundEdges(theEmbedding); e < gp_UpperBoundEdges(theEmbedding); e += 2) { /* Each edge has two index locations in the edge information array */ eTwin = gp_GetTwin(theEmbedding, e); if (context->E[e].pos != context->E[eTwin].pos || context->E[e].start != context->E[eTwin].start || context->E[e].end != context->E[eTwin].end || context->E[e].pos < 0 || context->E[e].pos >= gp_GetM(theEmbedding) || context->E[e].start < 0 || context->E[e].start > context->E[e].end || context->E[e].end >= gp_GetN(theEmbedding)) return NOTOK; /* Get the recorded horizontal position of that edge, a number between 0 and M-1 */ epos = context->E[e].pos; /* Convert that to an index in the graph structure so we can use the visited flags in the graph's edges to tell us whether the positions are being reused. */ eposIndex = (epos << 1) + gp_LowerBoundEdgeStorage(theEmbedding); eTwin = gp_GetTwin(theEmbedding, eposIndex); if (gp_GetEdgeVisited(theEmbedding, eposIndex) || gp_GetEdgeVisited(theEmbedding, eTwin)) return NOTOK; gp_SetEdgeVisited(theEmbedding, eposIndex); gp_SetEdgeVisited(theEmbedding, eTwin); } /* Test whether any edge intersects any vertex position for a vertex that is not an endpoint of the edge. */ for (e = gp_LowerBoundEdges(theEmbedding); e < gp_UpperBoundEdges(theEmbedding); e += 2) { eTwin = gp_GetTwin(theEmbedding, e); for (v = gp_LowerBoundVertices(theEmbedding); v < gp_UpperBoundVertices(theEmbedding); ++v) { /* If the vertex is an endpoint of the edge, then... */ if (gp_GetNeighbor(theEmbedding, e) == v || gp_GetNeighbor(theEmbedding, eTwin) == v) { /* The vertical position of the vertex must be at the top or bottom of the edge, */ if (context->E[e].start != context->VI[v].pos && context->E[e].end != context->VI[v].pos) return NOTOK; /* The horizontal edge position must be in the range of the vertex */ if (context->E[e].pos < context->VI[v].start || context->E[e].pos > context->VI[v].end) return NOTOK; } /* If the vertex is not an endpoint of the edge... */ else // if (gp_GetNeighbor(theEmbedding, e) != v && gp_GetNeighbor(theEmbedding, eTwin) != v) { /* If the vertical position of the vertex is in the vertical range of the edge ... */ if (context->E[e].start <= context->VI[v].pos && context->E[e].end >= context->VI[v].pos) { /* And if the horizontal position of the edge is in the horizontal range of the vertex, then return an error. */ if (context->VI[v].start <= context->E[e].pos && context->VI[v].end >= context->E[e].pos) return NOTOK; } } } } /* All tests passed */ return OK; } /******************************************************************** gp_DrawPlanar_GetVertexPosition() Gets the vertical position of the horizontal bar that represents vertex v in the visibility representation. Returns the vertex's vertical position or -1 on error ********************************************************************/ int gp_DrawPlanar_GetVertexPosition(graphP theEmbedding, int v) { DrawPlanarContext *context = NULL; gp_FindExtension(theEmbedding, DRAWPLANAR_ID, (void *)&context); if (theEmbedding == NULL || context == NULL || context->VI == NULL || v < gp_LowerBoundVertices(theEmbedding) || v >= gp_UpperBoundVertices(theEmbedding)) { gp_ErrorMessage("Invalid parameters"); return -1; } return context->VI[v].pos; } /******************************************************************** gp_DrawPlanar_GetVertexStart() Gets the horizontal start position of the horizontal bar representing vertex v in the visibility representation. Returns the vertex's horizontal start position or -1 on error ********************************************************************/ int gp_DrawPlanar_GetVertexStart(graphP theEmbedding, int v) { DrawPlanarContext *context = NULL; gp_FindExtension(theEmbedding, DRAWPLANAR_ID, (void *)&context); if (theEmbedding == NULL || context == NULL || context->VI == NULL || v < gp_LowerBoundVertices(theEmbedding) || v >= gp_UpperBoundVertices(theEmbedding)) { gp_ErrorMessage("Invalid parameters"); return -1; } return context->VI[v].start; } /******************************************************************** gp_DrawPlanar_GetVertexEnd() Gets the horizontal end position of the horizontal bar representing vertex v in the visibility representation. Returns the vertex's horizontal end position or -1 on error ********************************************************************/ int gp_DrawPlanar_GetVertexEnd(graphP theEmbedding, int v) { DrawPlanarContext *context = NULL; gp_FindExtension(theEmbedding, DRAWPLANAR_ID, (void *)&context); if (theEmbedding == NULL || context == NULL || context->VI == NULL || v < gp_LowerBoundVertices(theEmbedding) || v >= gp_UpperBoundVertices(theEmbedding)) { gp_ErrorMessage("Invalid parameters"); return -1; } return context->VI[v].end; } /******************************************************************** gp_DrawPlanar_GetEdgePosition() Gets the horizontal position of the vertical bar that represents edge e in the visibility representation. Returns the edge's horizontal position or -1 on error ********************************************************************/ int gp_DrawPlanar_GetEdgePosition(graphP theEmbedding, int e) { DrawPlanarContext *context = NULL; gp_FindExtension(theEmbedding, DRAWPLANAR_ID, (void *)&context); if (theEmbedding == NULL || context == NULL || context->E == NULL || e < gp_LowerBoundEdges(theEmbedding) || e >= gp_UpperBoundEdges(theEmbedding)) { gp_ErrorMessage("Invalid parameters"); return -1; } return context->E[e].pos; } /******************************************************************** gp_DrawPlanar_GetEdgeStart() Gets the vertical start position of the vertical bar representing edge e in the visibility representation. Returns the edge's vertical start position or -1 on error ********************************************************************/ int gp_DrawPlanar_GetEdgeStart(graphP theEmbedding, int e) { DrawPlanarContext *context = NULL; gp_FindExtension(theEmbedding, DRAWPLANAR_ID, (void *)&context); if (theEmbedding == NULL || context == NULL || context->E == NULL || e < gp_LowerBoundEdges(theEmbedding) || e >= gp_UpperBoundEdges(theEmbedding)) { gp_ErrorMessage("Invalid parameters"); return -1; } return context->E[e].start; } /******************************************************************** gp_DrawPlanar_GetEdgeEnd() Gets the vertical end position of the vertical bar representing edge e in the visibility representation. Returns the edge's vertical end position or -1 on error ********************************************************************/ int gp_DrawPlanar_GetEdgeEnd(graphP theEmbedding, int e) { DrawPlanarContext *context = NULL; gp_FindExtension(theEmbedding, DRAWPLANAR_ID, (void *)&context); if (theEmbedding == NULL || context == NULL || context->E == NULL || e < gp_LowerBoundEdges(theEmbedding) || e >= gp_UpperBoundEdges(theEmbedding)) { gp_ErrorMessage("Invalid parameters"); return -1; } return context->E[e].end; } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/planarityRelated/graphDrawPlanar.h000066400000000000000000000017171522057144000320340ustar00rootroot00000000000000#ifndef GRAPH_DRAWPLANAR_H #define GRAPH_DRAWPLANAR_H /* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "graphPlanarity.h" #ifdef __cplusplus extern "C" { #endif #define DRAWPLANAR_NAME "DrawPlanar" int gp_ExtendWith_DrawPlanar(graphP theGraph); int gp_Detach_DrawPlanar(graphP theGraph); int gp_DrawPlanar_RenderToFile(graphP theEmbedding, char *theFileName); int gp_DrawPlanar_RenderToString(graphP theEmbedding, char **pRenditionString); int gp_DrawPlanar_GetVertexPosition(graphP theEmbedding, int v); int gp_DrawPlanar_GetVertexStart(graphP theEmbedding, int v); int gp_DrawPlanar_GetVertexEnd(graphP theEmbedding, int v); int gp_DrawPlanar_GetEdgePosition(graphP theEmbedding, int e); int gp_DrawPlanar_GetEdgeStart(graphP theEmbedding, int e); int gp_DrawPlanar_GetEdgeEnd(graphP theEmbedding, int e); #ifdef __cplusplus } #endif #endif graph-algorithms-planarity-08d7b51/planarity/c/graphLib/planarityRelated/graphDrawPlanar.private.h000066400000000000000000000066571522057144000335150ustar00rootroot00000000000000#ifndef GRAPH_DRAWPLANAR_PRIVATE_H #define GRAPH_DRAWPLANAR_PRIVATE_H /* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "../planarityRelated/graphPlanarity.private.h" #ifdef __cplusplus extern "C" { #endif // Additional equipment for each edge /* pos, start, end: used to store a visibility representation, or horvert diagram of a planar graph. For edges, horizontal position, vertical range */ typedef struct { int pos, start, end; } DrawPlanar_EdgeRec; typedef DrawPlanar_EdgeRec *DrawPlanar_EdgeRecP; // Additional equipment for each vertex /* pos, start, end: used to store a visibility representation, or horvert diagram, of a planar graph. For vertices, vertical position, horizontal range drawingFlag, ancestor, ancestorChild: used to collect information needed to help 'draw' a visibility representation. During planar embedding, a vertex is determined to be between its DFS parent and a given ancestor (the vertex being processed) or beyond the parent relative to the ancestor. In post processing, the relative orientation of the parent and ancestor are determined, then the notion of between/beyond resolves to above/below or below/above depending on whether the ancestor is above or below, respectively, the parent. The ancestorChild are used to help r esolve this latter question. tie[2] stores information along the external face during embedding that is pertinent to helping break ties in the decisions about vertical vertex positioning. When vertices are first merged together into a bicomp, we cannot always decide right away which vertices will be above or below others. But as we traverse the external face removing inactive vertices, these positional ties can be resolved. */ typedef struct { int pos, start, end; int drawingFlag, ancestor, ancestorChild; int tie[2]; } DrawPlanar_VertexInfo; typedef DrawPlanar_VertexInfo *DrawPlanar_VertexInfoP; #define DRAWINGFLAG_BEYOND 0 #define DRAWINGFLAG_TIE 1 #define DRAWINGFLAG_BETWEEN 2 #define DRAWINGFLAG_BELOW 3 #define DRAWINGFLAG_ABOVE 4 typedef struct { // Helps distinguish initialize from re-initialize int initialized; // The graph that this context augments graphP theGraph; // Parallel array for additional edge level equipment DrawPlanar_EdgeRecP E; // Parallel array for additional vertex level equipment DrawPlanar_VertexInfoP VI; // Overloaded function pointers graphFunctionTableStruct functions; } DrawPlanarContext; extern int DRAWPLANAR_ID; int gp_GetDrawPlanarExtensionIdentifier(void); #ifdef __cplusplus } #endif #endif graphDrawPlanar_Extensions.c000066400000000000000000000676721522057144000342030ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/planarity/c/graphLib/planarityRelated/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "graphDrawPlanar.h" #include "graphDrawPlanar.private.h" // Need to save and restore a graph flag related to IO #include "../io/graphIO.h" #include extern void _ClearVertexVisitedFlags(graphP theGraph, int); extern void _CollectDrawingData(DrawPlanarContext *context, int RootVertex, int W, int WPrevLink); extern int _BreakTie(DrawPlanarContext *context, int BicompRoot, int W, int WPrevLink); extern int _ComputeVisibilityRepresentation(DrawPlanarContext *context); extern int _CheckVisibilityRepresentationIntegrity(DrawPlanarContext *context); /* Forward declarations of local functions */ void _DrawPlanar_ClearStructures(DrawPlanarContext *context); int _DrawPlanar_CreateStructures(DrawPlanarContext *context); int _DrawPlanar_InitStructures(DrawPlanarContext *context); void _DrawPlanar_InitEdgeRec(DrawPlanarContext *context, int v); void _DrawPlanar_InitVertexInfo(DrawPlanarContext *context, int v); /* Forward declarations of overloading functions */ int _DrawPlanar_MergeBicomps(graphP theGraph, int v, int RootVertex, int W, int WPrevLink); int _DrawPlanar_HandleInactiveVertex(graphP theGraph, int BicompRoot, int *pW, int *pWPrevLink); int _DrawPlanar_EmbedPostprocess(graphP theGraph, int v, int edgeEmbeddingResult); int _DrawPlanar_CheckEmbeddingIntegrity(graphP theGraph, graphP origGraph); int _DrawPlanar_CheckObstructionIntegrity(graphP theGraph, graphP origGraph); int _DrawPlanar_EnsureVertexCapacity(graphP theGraph, int N); void _DrawPlanar_ResetGraphStorage(graphP theGraph); int _DrawPlanar_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity); int _DrawPlanar_SortVertices(graphP theGraph); int _DrawPlanar_ReadPostprocess(graphP theGraph, char *extraData); int _DrawPlanar_WritePostprocess(graphP theGraph, char **pExtraData); /* Forward declarations of functions used by the extension system */ void *_DrawPlanar_DupContext(void *pContext, void *theGraph); int _DrawPlanar_CopyData(void *dstContext, void *srcContext); void _DrawPlanar_FreeContext(void *); /**************************************************************************** * DRAWPLANAR_ID - the variable used to hold the integer identifier for this * extension, enabling this feature's extension context to be distinguished * from other features' extension contexts that may be attached to a graph. ****************************************************************************/ int DRAWPLANAR_ID = 0; /**************************************************************************** gp_ExtendWith_DrawPlanar() This function adjusts the graph data structure to attach the planar graph drawing feature. To activate this feature during gp_Embed(), use EMBEDFLAGS_DRAWPLANAR. This method may be called immediately after gp_New() in the case of invoking gp_Read(). For generating graphs, gp_EnsureVertexCapacity() can be invoked before or after this enabling method. This method detects if the vertex capacity has already been set, and if so, it will also create the additional data structures specific to planar graph drawing. This makes it possible to invoke gp_New() and gp_EnsureVertexCapacity() together, and then attach this feature only if it is requested at run-time. Returns OK for success, NOTOK for failure. ****************************************************************************/ int gp_ExtendWith_DrawPlanar(graphP theGraph) { DrawPlanarContext *context = NULL; if (theGraph == NULL || gp_GetN(theGraph) <= 0) return NOTOK; // If the drawing feature has already been attached to the graph, // then there is no need to attach it again gp_FindExtension(theGraph, DRAWPLANAR_ID, (void *)&context); if (context != NULL) { return OK; } // Ensure theGraph is a Planarity Graph if (gp_ExtendWith_Planarity(theGraph) != OK) return NOTOK; // Allocate a new extension context context = (DrawPlanarContext *)malloc(sizeof(DrawPlanarContext)); if (context == NULL) { return NOTOK; } // First, tell the context that it is not initialized context->initialized = 0; // Save a pointer to theGraph in the context context->theGraph = theGraph; // Put the overload functions into the context function table. // gp_AddExtension will overload the graph's functions with these, and // return the base function pointers in the context function table memset(&context->functions, 0, sizeof(graphFunctionTableStruct)); context->functions.fpMergeBicomps = _DrawPlanar_MergeBicomps; context->functions.fpHandleInactiveVertex = _DrawPlanar_HandleInactiveVertex; context->functions.fpEmbedPostprocess = _DrawPlanar_EmbedPostprocess; context->functions.fpCheckEmbeddingIntegrity = _DrawPlanar_CheckEmbeddingIntegrity; context->functions.fpCheckObstructionIntegrity = _DrawPlanar_CheckObstructionIntegrity; context->functions.fpEnsureVertexCapacity = _DrawPlanar_EnsureVertexCapacity; context->functions.fpResetGraphStorage = _DrawPlanar_ResetGraphStorage; context->functions.fpEnsureEdgeCapacity = _DrawPlanar_EnsureEdgeCapacity; context->functions.fpSortVertices = _DrawPlanar_SortVertices; context->functions.fpReadPostprocess = _DrawPlanar_ReadPostprocess; context->functions.fpWritePostprocess = _DrawPlanar_WritePostprocess; _DrawPlanar_ClearStructures(context); // Store the Draw context, including the data structure and the // function pointers, as an extension of the graph if (gp_AddExtension(theGraph, &DRAWPLANAR_ID, (void *)context, _DrawPlanar_DupContext, _DrawPlanar_CopyData, _DrawPlanar_FreeContext, &context->functions) != OK) { _DrawPlanar_FreeContext(context); return NOTOK; } // Create the Draw-specific structures if the size of the graph is known // Attach functions are typically invoked after gp_New(), but if a graph // extension must be attached before gp_Read(), then the attachment // also happens before gp_EnsureVertexCapacity(), which means N==0. // However, a feature can be attached after gp_EnsureVertexCapacity(), // in which case there is extra work to do when N > 0. if (gp_GetN(theGraph) > 0) { if (_DrawPlanar_CreateStructures(context) != OK || _DrawPlanar_InitStructures(context) != OK) { _DrawPlanar_FreeContext(context); return NOTOK; } } return OK; } /******************************************************************** gp_Detach_DrawPlanar() ********************************************************************/ int gp_Detach_DrawPlanar(graphP theGraph) { return gp_RemoveExtension(theGraph, DRAWPLANAR_ID); } /******************************************************************** gp_GetDrawPlanarExtensionIdentifier() A private function that returns the DRAWPLANAR_ID. ********************************************************************/ int gp_GetDrawPlanarExtensionIdentifier(void) { return DRAWPLANAR_ID; } /******************************************************************** _DrawPlanar_ClearStructures() ********************************************************************/ void _DrawPlanar_ClearStructures(DrawPlanarContext *context) { if (!context->initialized) { // Before initialization, the pointers are stray, not NULL // Once NULL or allocated, free() or LCFree() can do the job context->E = NULL; context->VI = NULL; context->initialized = 1; } else { if (context->E != NULL) { free(context->E); context->E = NULL; } if (context->VI != NULL) { free(context->VI); context->VI = NULL; } } } /******************************************************************** _DrawPlanar_CreateStructures() Create uninitialized structures for the vertex and edge levels, and initialized structures for the graph level ********************************************************************/ int _DrawPlanar_CreateStructures(DrawPlanarContext *context) { graphP theGraph = context->theGraph; int VIsize = gp_UpperBoundVertices(theGraph); int Esize = gp_UpperBoundEdgeStorage(theGraph); if (gp_GetN(theGraph) <= 0) return NOTOK; if ((context->E = (DrawPlanar_EdgeRecP)malloc(Esize * sizeof(DrawPlanar_EdgeRec))) == NULL || (context->VI = (DrawPlanar_VertexInfoP)malloc(VIsize * sizeof(DrawPlanar_VertexInfo))) == NULL) { return NOTOK; } return OK; } /******************************************************************** _DrawPlanar_InitStructures() Intended to be called when N>0. Initializes vertex and edge levels only. Graph level is already initialized in _CreateStructures() ********************************************************************/ int _DrawPlanar_InitStructures(DrawPlanarContext *context) { #ifdef USE_1BASEDARRAYS memset(context->VI, NIL_CHAR, gp_UpperBoundVertices(context->theGraph) * sizeof(DrawPlanar_VertexInfo)); #else graphP theGraph = context->theGraph; if (gp_GetN(theGraph) <= 0) return NOTOK; for (int v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) _DrawPlanar_InitVertexInfo(context, v); #endif memset(context->E, 0, gp_UpperBoundEdgeStorage(context->theGraph) * sizeof(DrawPlanar_EdgeRec)); return OK; } /******************************************************************** _DrawPlanar_DupContext() ********************************************************************/ void *_DrawPlanar_DupContext(void *pContext, void *theGraph) { DrawPlanarContext *context = (DrawPlanarContext *)pContext; DrawPlanarContext *newContext = (DrawPlanarContext *)malloc(sizeof(DrawPlanarContext)); if (newContext != NULL) { int VIsize = gp_UpperBoundVertices((graphP)theGraph); int Esize = gp_UpperBoundEdgeStorage((graphP)theGraph); *newContext = *context; newContext->theGraph = (graphP)theGraph; newContext->initialized = 0; _DrawPlanar_ClearStructures(newContext); if (((graphP)theGraph)->N > 0) { if (_DrawPlanar_CreateStructures(newContext) != OK) { _DrawPlanar_FreeContext(newContext); return NULL; } // Initialize custom data structures by copying memcpy(newContext->E, context->E, Esize * sizeof(DrawPlanar_EdgeRec)); memcpy(newContext->VI, context->VI, VIsize * sizeof(DrawPlanar_VertexInfo)); } } return newContext; } /******************************************************************** _DrawPlanar_CopyData() ********************************************************************/ int _DrawPlanar_CopyData(void *dstContext, void *srcContext) { DrawPlanarContext *dstDrawPlanarContext = (DrawPlanarContext *)dstContext; DrawPlanarContext *srcDrawPlanarContext = (DrawPlanarContext *)srcContext; int dstEdgeStorage, srcEdgeStorage; if (dstContext == NULL) return NOTOK; // If the srcContext is NULL, then the caller wants the data // structures in the dstContext to be reset/reinitialized if (srcContext == NULL) return _DrawPlanar_InitStructures(dstDrawPlanarContext); // ELSE: If there is also a srcContext, then we copy data from it dstEdgeStorage = gp_UpperBoundEdgeStorage(dstDrawPlanarContext->theGraph); srcEdgeStorage = gp_UpperBoundEdgeStorage(srcDrawPlanarContext->theGraph); // The caller (ultimately gp_CopyGraph()) is responsible for making sure that the // destination graph has enough edge capacity to receive the source graph content if (dstEdgeStorage < srcEdgeStorage) return NOTOK; // If the destination graph has more edge capacity, then we make sure that the // extra edge capacity is reinitialized if (dstEdgeStorage > srcEdgeStorage) { memset(dstDrawPlanarContext->E, NIL_CHAR, gp_UpperBoundEdgeStorage(dstDrawPlanarContext->theGraph) * sizeof(DrawPlanar_EdgeRec)); } memcpy(dstDrawPlanarContext->E, srcDrawPlanarContext->E, gp_UpperBoundEdgeStorage(dstDrawPlanarContext->theGraph) * sizeof(DrawPlanar_EdgeRec)); memcpy(dstDrawPlanarContext->VI, srcDrawPlanarContext->VI, gp_UpperBoundVertices(dstDrawPlanarContext->theGraph) * sizeof(DrawPlanar_VertexInfo)); return OK; } /******************************************************************** _DrawPlanar_FreeContext() ********************************************************************/ void _DrawPlanar_FreeContext(void *pContext) { DrawPlanarContext *context = (DrawPlanarContext *)pContext; _DrawPlanar_ClearStructures(context); free(pContext); } /******************************************************************** ********************************************************************/ int _DrawPlanar_EnsureVertexCapacity(graphP theGraph, int N) { DrawPlanarContext *context = NULL; gp_FindExtension(theGraph, DRAWPLANAR_ID, (void *)&context); if (context == NULL) { return NOTOK; } theGraph->N = N; theGraph->NV = N; if (theGraph->edgeCapacity == 0) theGraph->edgeCapacity = DEFAULT_EDGE_CAPACITY_FACTOR * N; if (_DrawPlanar_CreateStructures(context) != OK || _DrawPlanar_InitStructures(context) != OK) return NOTOK; context->functions.fpEnsureVertexCapacity(theGraph, N); return OK; } /******************************************************************** ********************************************************************/ void _DrawPlanar_ResetGraphStorage(graphP theGraph) { DrawPlanarContext *context = NULL; gp_FindExtension(theGraph, DRAWPLANAR_ID, (void *)&context); if (context != NULL) { // Reset the graph storage in base class(es) context->functions.fpResetGraphStorage(theGraph); // Do the reset that is specific to this module _DrawPlanar_InitStructures(context); } } /******************************************************************** _DrawPlanar_EnsureEdgeCapacity() ********************************************************************/ int _DrawPlanar_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity) { DrawPlanarContext *context = NULL; DrawPlanar_EdgeRecP oldE = NULL, newE = NULL; int oldEsize = gp_UpperBoundEdgeStorage(theGraph), newEsize = 0; // If the requirement is already satisfied, then no work to do if (gp_GetEdgeCapacity(theGraph) >= requiredEdgeCapacity) return OK; // Get the graph's extension context so we can work on it gp_FindExtension(theGraph, DRAWPLANAR_ID, (void *)&context); if (context == NULL) return NOTOK; // Call the superclass function to make sure lower levels of parallel // edge arrays can successfully meet the new capacity requirement if (context->functions.fpEnsureEdgeCapacity(theGraph, requiredEdgeCapacity) != OK) return NOTOK; // Save the current E so it can be freed once we replace it oldE = context->E; // The superclass EnsureEdgeCapacity method succeeded, so the graph's // new edge capacity is already set, which means we the upper bound of // the graph's edge storage gives the new parallel array size we need. newEsize = gp_UpperBoundEdgeStorage(theGraph); // We must successfully allocate the new parallel edge array newE = (DrawPlanar_EdgeRecP)malloc(newEsize * sizeof(DrawPlanar_EdgeRec)); if (newE == NULL) return NOTOK; // Clear all new edge records memset(newE, NIL_CHAR, newEsize * sizeof(DrawPlanar_EdgeRec)); // Copy the old edge records to the new edge records memcpy(newE, oldE, oldEsize * sizeof(DrawPlanar_EdgeRec)); // Set the new edge array into the context and free the old one context->E = newE; free(oldE); return OK; } /******************************************************************** ********************************************************************/ int _DrawPlanar_SortVertices(graphP theGraph) { DrawPlanarContext *context = NULL; gp_FindExtension(theGraph, DRAWPLANAR_ID, (void *)&context); if (context != NULL) { // If this is a planarity-based algorithm to which graph drawing has been attached, // and if the embedding process has already been completed if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_DRAWPLANAR) { int v, vIndex; DrawPlanar_VertexInfo temp; // Relabel the context data members that indicate vertices for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { if (gp_IsVertex(theGraph, context->VI[v].ancestor)) { context->VI[v].ancestor = gp_GetIndex(theGraph, context->VI[v].ancestor); context->VI[v].ancestorChild = gp_GetIndex(theGraph, context->VI[v].ancestorChild); } } // "Sort" the extra vertex info associated with each vertex so that it is rearranged according // to the index values of the vertices. This could be done very easily with an extra array in // which, for each v, newVI[index of v] = VI[v]. However, this loop avoids memory allocation // by performing the operation (almost) in-place, except for the pre-existing visitation flags. _ClearVertexVisitedFlags(theGraph, FALSE); for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { // If the correct data has already been placed into position v // by prior steps, then skip to the next vertex if (gp_GetVisited(theGraph, v)) continue; // At the beginning of processing position v, the data in position v // corresponds to data that belongs at the index of v. vIndex = gp_GetIndex(theGraph, v); // Iterate on position v until it receives the correct data while (!gp_GetVisited(theGraph, v)) { // Place the data at position v into its proper location at position // vIndex, and move vIndex's data into position v. temp = context->VI[v]; context->VI[v] = context->VI[vIndex]; context->VI[vIndex] = temp; // The data at position vIndex is now marked as being correct. gp_SetVisited(theGraph, vIndex); // The data now in position v is the data from position vIndex, // whose index we now take as the new vIndex vIndex = gp_GetIndex(theGraph, vIndex); } } } if (context->functions.fpSortVertices(theGraph) != OK) return NOTOK; return OK; } return NOTOK; } /******************************************************************** Returns OK for a successful merge, NOTOK on an internal failure, or NONEMBEDDABLE if the merge is blocked ********************************************************************/ int _DrawPlanar_MergeBicomps(graphP theGraph, int v, int RootVertex, int W, int WPrevLink) { DrawPlanarContext *context = NULL; gp_FindExtension(theGraph, DRAWPLANAR_ID, (void *)&context); if (context != NULL) { if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_DRAWPLANAR) { _CollectDrawingData(context, RootVertex, W, WPrevLink); } return context->functions.fpMergeBicomps(theGraph, v, RootVertex, W, WPrevLink); } return NOTOK; } /******************************************************************** ********************************************************************/ int _DrawPlanar_HandleInactiveVertex(graphP theGraph, int BicompRoot, int *pW, int *pWPrevLink) { DrawPlanarContext *context = NULL; gp_FindExtension(theGraph, DRAWPLANAR_ID, (void *)&context); if (context != NULL) { int RetVal = context->functions.fpHandleInactiveVertex(theGraph, BicompRoot, pW, pWPrevLink); if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_DRAWPLANAR) { if (_BreakTie(context, BicompRoot, *pW, *pWPrevLink) != OK) return NOTOK; } return RetVal; } return NOTOK; } /******************************************************************** ********************************************************************/ void _DrawPlanar_InitEdgeRec(DrawPlanarContext *context, int e) { context->E[e].pos = 0; context->E[e].start = 0; context->E[e].end = 0; } /******************************************************************** ********************************************************************/ void _DrawPlanar_InitVertexInfo(DrawPlanarContext *context, int v) { context->VI[v].pos = 0; context->VI[v].start = 0; context->VI[v].end = 0; context->VI[v].drawingFlag = DRAWINGFLAG_BEYOND; context->VI[v].ancestorChild = NIL; context->VI[v].ancestor = NIL; context->VI[v].tie[0] = NIL; context->VI[v].tie[1] = NIL; } /******************************************************************** ********************************************************************/ int _DrawPlanar_EmbedPostprocess(graphP theGraph, int v, int edgeEmbeddingResult) { DrawPlanarContext *context = NULL; gp_FindExtension(theGraph, DRAWPLANAR_ID, (void *)&context); if (context != NULL) { int RetVal = context->functions.fpEmbedPostprocess(theGraph, v, edgeEmbeddingResult); if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_DRAWPLANAR) { if (RetVal == OK) { RetVal = _ComputeVisibilityRepresentation(context); } } return RetVal; } return NOTOK; } /******************************************************************** ********************************************************************/ int _DrawPlanar_CheckEmbeddingIntegrity(graphP theGraph, graphP origGraph) { DrawPlanarContext *context = NULL; gp_FindExtension(theGraph, DRAWPLANAR_ID, (void *)&context); if (context != NULL) { if (context->functions.fpCheckEmbeddingIntegrity(theGraph, origGraph) != OK) return NOTOK; return _CheckVisibilityRepresentationIntegrity(context); } return NOTOK; } /******************************************************************** ********************************************************************/ int _DrawPlanar_CheckObstructionIntegrity(graphP theGraph, graphP origGraph) { return OK; } /******************************************************************** ********************************************************************/ int _DrawPlanar_ReadPostprocess(graphP theGraph, char *extraData) { DrawPlanarContext *context = NULL; gp_FindExtension(theGraph, DRAWPLANAR_ID, (void *)&context); if (context != NULL) { if (context->functions.fpReadPostprocess(theGraph, extraData) != OK) return NOTOK; else if (extraData != NULL && strlen(extraData) > 0) { int v, tempInt, e; char line[64], tempChar; sprintf(line, "<%s>", DRAWPLANAR_NAME); // Find the start of the data for this feature extraData = strstr(extraData, line); if (extraData == NULL) return NOTOK; // Advance past the start tag extraData = extraData + strlen(line) + 1; // Read the N lines of vertex information for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { sscanf(extraData, " %d%c %d %d %d", &tempInt, &tempChar, &context->VI[v].pos, &context->VI[v].start, &context->VI[v].end); extraData = strchr(extraData, '\n') + 1; } // Read the lines that contain edge information for (e = gp_LowerBoundEdges(theGraph); e < gp_UpperBoundEdges(theGraph); ++e) { sscanf(extraData, " %d%c %d %d %d", &tempInt, &tempChar, &context->E[e].pos, &context->E[e].start, &context->E[e].end); extraData = strchr(extraData, '\n') + 1; } } return OK; } return NOTOK; } /******************************************************************** ********************************************************************/ int _DrawPlanar_WritePostprocess(graphP theGraph, char **pExtraData) { DrawPlanarContext *context = NULL; gp_FindExtension(theGraph, DRAWPLANAR_ID, (void *)&context); if (context != NULL) { (*pExtraData) = NULL; if (context->functions.fpWritePostprocess(theGraph, pExtraData) != OK) return NOTOK; else if ((*pExtraData) != NULL) { // NOTE: We currently do not support stacking WritePostprocess calls // from multiple extensions; it wouldn't be hard, we just don't ;) free((*pExtraData)); (*pExtraData) = NULL; return NOTOK; } else { int v, e; char line[64]; int maxLineSize = 64, extraDataPos = 0; char *extraData = (char *)calloc((1 + gp_GetN(theGraph) + 2 * gp_GetM(theGraph) + 1) * maxLineSize, sizeof(char)); int zeroBasedVertexOffset = 0; int zeroBasedEdgeOffset = 0; if (extraData == NULL) return NOTOK; // If we are supposed to write 0-based output, then we have to set these two variables to indicate // how much to subtract from each vertex and edge index based on whether this library has been // compiled with 0-based or 1-based array indexing for the in-memory data structure (i.e., compiled // with USE_1BASEDARRAYS USE_0BASEDARRAYS). The macros invoked are responsive to the difference. if (gp_GetGraphFlags(theGraph) & GRAPHFLAGS_ZEROBASEDIO) { zeroBasedVertexOffset = gp_LowerBoundVertexStorage(theGraph); zeroBasedEdgeOffset = gp_LowerBoundEdgeStorage(theGraph); } // Bit of an unlikely case, but for safety, a bigger maxLineSize // and line array size are needed to handle very large graphs if (gp_GetN(theGraph) > 2000000000) { free(extraData); extraData = NULL; return NOTOK; } sprintf(line, "<%s>\n", DRAWPLANAR_NAME); strcpy(extraData + extraDataPos, line); extraDataPos += (int)strlen(line); for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { sprintf(line, "%d: %d %d %d\n", v - zeroBasedVertexOffset, context->VI[v].pos, context->VI[v].start, context->VI[v].end); strcpy(extraData + extraDataPos, line); extraDataPos += (int)strlen(line); } for (e = gp_LowerBoundEdges(theGraph); e < gp_UpperBoundEdges(theGraph); e++) { if (gp_EdgeInUse(theGraph, e)) { sprintf(line, "%d: %d %d %d\n", e - zeroBasedEdgeOffset, context->E[e].pos, context->E[e].start, context->E[e].end); strcpy(extraData + extraDataPos, line); extraDataPos += (int)strlen(line); } } sprintf(line, "\n", DRAWPLANAR_NAME); strcpy(extraData + extraDataPos, line); extraDataPos += (int)strlen(line); *pExtraData = extraData; } return OK; } return NOTOK; } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/planarityRelated/graphEmbed.c000066400000000000000000002027351522057144000310130ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include // This source file implements the main graph planarity/outerplanarity method, gp_Embed() #include "../planarityRelated/graphPlanarity.h" #include "../planarityRelated/graphPlanarity.private.h" #include "../planarityRelated/graphOuterplanarity.h" #include "../planarityRelated/graphOuterplanarity.private.h" // Includes needed by _gp_EmbedFlagsValid() #include "graphDrawPlanar.private.h" #include "../homeomorphSearch/graphK23Search.private.h" #include "../homeomorphSearch/graphK33Search.private.h" #include "../homeomorphSearch/graphK4Search.private.h" // For LOGGING-related declarations #include "../lowLevelUtils/apiutils.private.h" /* Imported functions */ extern void _ClearVertexVisitedFlags(graphP theGraph, int); extern int _IsolateKuratowskiSubgraph(graphP theGraph, int v, int R); extern int _IsolateOuterplanarObstruction(graphP theGraph, int v, int R); extern void _InitVertexRec(graphP theGraph, int v); extern int _gp_FindEdge(graphP theGraph, int u, int v); /* Private functions (some are exported to system only) */ int _gp_EmbedFlagsValid(graphP theGraph, int embedFlags); int _EmbeddingInitialize(graphP theGraph); void _EmbedBackEdgeToDescendant(graphP theGraph, int RootSide, int RootVertex, int W, int WPrevLink); void _InvertVertex(graphP theGraph, int V); void _MergeVertex(graphP theGraph, int W, int WPrevLink, int R); int _MergeBicomps(graphP theGraph, int v, int RootVertex, int W, int WPrevLink); void _WalkUp(graphP theGraph, int v, int e); int _WalkDown(graphP theGraph, int v, int RootVertex); int _HandleInactiveVertex(graphP theGraph, int BicompRoot, int *pW, int *pWPrevLink); int _HandleBlockedBicomp(graphP theGraph, int v, int RootVertex, int R); void _AdvanceFwdEdgeList(graphP theGraph, int v, int child, int nextChild); int _EmbedPostprocess(graphP theGraph, int v, int edgeEmbeddingResult); int _OrientVerticesInEmbedding(graphP theGraph); int _OrientVerticesInBicomp(graphP theGraph, int BicompRoot, int PreserveSigns); int _OrientExternalFacePath(graphP theGraph, int u, int v, int w, int x); int _JoinBicomps(graphP theGraph); /******************************************************************** gp_Embed() Either a planar embedding is created in theGraph, or a Kuratowski subgraph is isolated. Either way, theGraph remains sorted by DFI since that is the most common desired result. The original vertex numbers are available in the 'index' members of the vertex records. Moreover, gp_SortVertices() can be invoked to put the vertices in the order of the input graph, at which point the 'index' members of the vertex records will contain the vertex DFIs. return OK if the embedding was successfully created or no subgraph homeomorphic to a topological obstruction was found. NOTOK on failure (e.g., NULL graph, gp_Embed already called, failure to attach algorithm extension) NONEMBEDDABLE if the embedding couldn't be created due to the existence of a subgraph homeomorphic to a topological obstruction. For core planarity, OK is returned when theGraph contains a planar embedding of the input graph, and NONEMBEDDABLE is returned when a subgraph homeomorphic to K5 or K3,3 has been isolated in theGraph. Extension modules can overload functions used by gp_Embed to achieve alternate algorithms. In those cases, the return results are similar. For example, a K3,3 search algorithm would return NONEMBEDDABLE if it finds the K3,3 obstruction, and OK if the graph is planar or only contains K5 homeomorphs. Similarly, an outerplanarity module can return OK for an outerplanar embedding or NONEMBEDDABLE when a subgraph homeomorphic to K2,3 or K4 has been isolated. The algorithm extension for gp_Embed() is encoded in the embedFlags, and the details of the return value can be found in the extension module that defines the embedding flag. ********************************************************************/ int gp_Embed(graphP theGraph, unsigned embedFlags) { int v, e, c; int RetVal = OK; // Basic safety checks if (theGraph == NULL || embedFlags == 0 || gp_GetEmbedFlags(theGraph) != 0) return NOTOK; // Preprocessing if (!_gp_EmbedFlagsValid(theGraph, embedFlags)) { // For historical reasons, the graph will be automatically extended with // Planarity or Outerplanarity if not already done. if (embedFlags == EMBEDFLAGS_PLANAR) { if (gp_ExtendWith_Planarity(theGraph) != OK) return NOTOK; } else if (embedFlags == EMBEDFLAGS_OUTERPLANAR) { if (gp_ExtendWith_Outerplanarity(theGraph) != OK) return NOTOK; } // For other Graph subclasses, the caller must have invoked their // ExtendWith method prior to calling gp_Embed() else return NOTOK; } theGraph->embedFlags = embedFlags; // Initialize embedding data structures and allow extension algorithms // that overload the function to postprocess the DFS if (theGraph->functions->fpEmbeddingInitialize(theGraph) != OK) return NOTOK; // In reverse DFI order, embed the back edges from each vertex to its DFS descendants. for (v = gp_UpperBoundVertices(theGraph) - 1; v >= gp_LowerBoundVertices(theGraph); --v) { RetVal = OK; // Walkup calls establish Pertinence in Step v // Do the Walkup for each cycle edge from v to a DFS descendant W. e = gp_GetVertexFwdEdgeList(theGraph, v); while (gp_IsEdge(theGraph, e)) { theGraph->functions->fpWalkUp(theGraph, v, e); e = gp_GetNextEdge(theGraph, e); if (e == gp_GetVertexFwdEdgeList(theGraph, v)) e = NIL; } gp_SetVertexPertinentRootsList(theGraph, v, NIL); // Work systematically through the DFS children of vertex v, using Walkdown // to add the back edges from v to its descendants in each of the DFS subtrees c = gp_GetVertexSortedDFSChildList(theGraph, v); while (gp_IsVertex(theGraph, c)) { if (gp_IsVertex(theGraph, gp_GetVertexPertinentRootsList(theGraph, c))) { RetVal = theGraph->functions->fpWalkDown(theGraph, v, gp_GetBicompRootFromDFSChild(theGraph, c)); // If Walkdown returns OK, then it is OK to proceed with edge addition. // Otherwise, if Walkdown returns NONEMBEDDABLE then we stop edge addition. if (RetVal != OK) break; } c = gp_GetVertexNextDFSChild(theGraph, v, c); } // If the Walkdown determined that the graph is NONEMBEDDABLE, // then the guiding embedder loop can be stopped now. if (RetVal != OK) break; } // Postprocessing to orient the embedding and merge any remaining separated bicomps. // Some extension algorithms may overload this function, e.g. to do nothing if they // have no need of an embedding. return theGraph->functions->fpEmbedPostprocess(theGraph, v, RetVal); } /******************************************************************** _gp_EmbedFlagsValid() Returns TRUE the theGraph has been extended to a subclass that supports the value in embedFlags and if embedFlags has a value that is supportable by extensions available in the graphLib. Returns FALSE otherwise. NOTE: Returns TRUE/FALSE rather than OK/NOTOK so the caller can decide if it is an error or if they want to try to take corrective actions on theGraph. ********************************************************************/ int _gp_EmbedFlagsValid(graphP theGraph, int embedFlags) { // Currently, planar and outerplanar graph embedding and obstruction // isolation do not require an explicit extension. if (embedFlags == EMBEDFLAGS_PLANAR) { if (gp_GetGraphFlags(theGraph) & GRAPHFLAGS_EXTENDEDWITH_PLANARITY) return TRUE; } else if (embedFlags == EMBEDFLAGS_OUTERPLANAR) { if (gp_GetGraphFlags(theGraph) & GRAPHFLAGS_EXTENDEDWITH_OUTERPLANARITY) return TRUE; } // For other algorithms that are supported by explicit extensions, we // ensure they are attached (the attach methods exit early if it has // already been done). else if (embedFlags == EMBEDFLAGS_DRAWPLANAR) { DrawPlanarContext *context = NULL; gp_FindExtension(theGraph, DRAWPLANAR_ID, (void *)&context); if (context != NULL) return TRUE; } else if (embedFlags == EMBEDFLAGS_SEARCHFORK23) { K23SearchContext *context = NULL; gp_FindExtension(theGraph, K23SEARCH_ID, (void *)&context); if (context != NULL) return TRUE; } else if (embedFlags == EMBEDFLAGS_SEARCHFORK33) { K33SearchContext *context = NULL; gp_FindExtension(theGraph, K33SEARCH_ID, (void *)&context); if (context != NULL) return TRUE; } else if (embedFlags == EMBEDFLAGS_SEARCHFORK4) { K4SearchContext *context = NULL; gp_FindExtension(theGraph, K4SEARCH_ID, (void *)&context); if (context != NULL) return TRUE; } // The embedFlags are not valid if they indicate an algorithm for // which there is no graph extension, or even if they indicate // multiple supported algorithm extensions at the same time. return FALSE; } /******************************************************************** _EmbeddingInitialize() This method performs the following tasks: (1) Assign depth first index (DFI) and DFS parentvalues to vertices (2) Assign DFS edge types (3) Create a sortedDFSChildList for each vertex, sorted by child DFI (4) Create a sorted fwdEdgeList for each vertex, sorted by descendant DFI (5) Assign leastAncestor values to vertices (6) Sort the vertices by their DFIs (7) Initialize for pertinence and future pertinence management (8) Embed each tree edge as a singleton biconnected component The first five of these are performed in a single-pass DFS of theGraph. Afterward, the vertices are sorted by their DFIs, the lowpoint values are assigned and then the DFS tree edges stored in virtual vertices during the DFS are used to create the DFS tree embedding. ********************************************************************/ int _EmbeddingInitialize(graphP theGraph) { stackP theStack; int DFI, v, R, uparent, u, uneighbor, e, f, eTwin, ePrev, eNext; int leastValue, child; _gp_LogLine("graphEmbed.c/_EmbeddingInitialize() start\n"); theStack = theGraph->theStack; // At most we push 2 integers per edge from a vertex to each *unvisited* neighbor // plus one extra (NIL, NIL) at the beginning to represent arriving at a DFS tree // root. We ensure that theGraph's stack has this capacity and, if so, we clear // the stack for use in the depth-first search (DFS). if (sp_GetCapacity(theStack) < 2 * 2 * gp_GetM(theGraph) + 2) return NOTOK; sp_ClearStack(theStack); // We clear the visited flags of vertices because they are used to determine // which vertices have already been visited as the DFS traverses theGraph. _ClearVertexVisitedFlags(theGraph, FALSE); // This outer loop processes each connected component of a disconnected graph // No need to compare v < N since DFI will reach N when inner loop processes the // last connected component in the graph for (DFI = v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { // Skip numbered vertices to cause the outerloop to find the // next DFS tree root in a disconnected graph if (gp_IsVertex(theGraph, gp_GetVertexParent(theGraph, v))) continue; // DFS a connected component sp_Push2(theStack, NIL, NIL); while (sp_NonEmpty(theStack)) { sp_Pop2(theStack, uparent, e); // For vertex uparent and edge e, obtain the opposing endpoint u of e // If uparent is NIL, then e is also NIL and we have encountered the // false edge to the DFS tree root as pushed above. u = gp_IsNotVertex(theGraph, uparent) ? v : gp_GetNeighbor(theGraph, e); // We popped an edge to an unvisited vertex, so it is either a DFS tree edge // or a false edge to the DFS tree root (u). if (!gp_GetVisited(theGraph, u)) { _gp_LogLine(_gp_MakeLogStr3("v=%d, DFI=%d, parent=%d", u, DFI, uparent)); // (1) Set the DFI and DFS parent gp_SetVisited(theGraph, u); gp_SetIndex(theGraph, u, DFI++); gp_SetVertexParent(theGraph, u, uparent); if (gp_IsEdge(theGraph, e)) { // (2) Set the edge type values for tree edges gp_SetEdgeType(theGraph, e, EDGE_TYPE_CHILD); gp_SetEdgeType(theGraph, gp_GetTwin(theGraph, e), EDGE_TYPE_PARENT); // (3) Record u in the sortedDFSChildList of uparent gp_SetVertexSortedDFSChildList(theGraph, uparent, gp_AppendDFSChild(theGraph, uparent, gp_GetIndex(theGraph, u))); // (8) Record e as the first and last edges of the virtual vertex R, // a root copy of uparent uniquely associated with child u R = gp_GetBicompRootFromDFSChild(theGraph, gp_GetIndex(theGraph, u)); gp_SetFirstEdge(theGraph, R, e); gp_SetLastEdge(theGraph, R, e); } // (5) Initialize the least ancestor value gp_SetVertexLeastAncestor(theGraph, u, gp_GetIndex(theGraph, u)); // Push edges to all unvisited neighbors. These will be either // tree edges to children or forward edge records to descendants // Edges that are not pushed are either marked as back edges or as // a tree edge if it leads back to the immediate DFS parent. e = gp_GetFirstEdge(theGraph, u); while (gp_IsEdge(theGraph, e)) { if (!gp_GetVisited(theGraph, gp_GetNeighbor(theGraph, e))) { sp_Push2(theStack, u, e); } else if (gp_GetEdgeType(theGraph, e) != EDGE_TYPE_PARENT) { // (2) Set the edge type values for back edges gp_SetEdgeType(theGraph, e, EDGE_TYPE_BACK); eTwin = gp_GetTwin(theGraph, e); gp_SetEdgeType(theGraph, eTwin, EDGE_TYPE_FORWARD); // (4) Move the twin of back edge record e to the sorted FwdEdgeList of the ancestor uneighbor = gp_GetNeighbor(theGraph, e); ePrev = gp_GetPrevEdge(theGraph, eTwin); eNext = gp_GetNextEdge(theGraph, eTwin); if (gp_IsEdge(theGraph, ePrev)) gp_SetNextEdge(theGraph, ePrev, eNext); else gp_SetFirstEdge(theGraph, uneighbor, eNext); if (gp_IsEdge(theGraph, eNext)) gp_SetPrevEdge(theGraph, eNext, ePrev); else gp_SetLastEdge(theGraph, uneighbor, ePrev); if (gp_IsEdge(theGraph, f = gp_GetVertexFwdEdgeList(theGraph, uneighbor))) { ePrev = gp_GetPrevEdge(theGraph, f); gp_SetPrevEdge(theGraph, eTwin, ePrev); gp_SetNextEdge(theGraph, eTwin, f); gp_SetPrevEdge(theGraph, f, eTwin); gp_SetNextEdge(theGraph, ePrev, eTwin); } else { gp_SetVertexFwdEdgeList(theGraph, uneighbor, eTwin); gp_SetPrevEdge(theGraph, eTwin, eTwin); gp_SetNextEdge(theGraph, eTwin, eTwin); } // (5) Update the leastAncestor value for the vertex u uneighbor = gp_GetIndex(theGraph, uneighbor); if (uneighbor < gp_GetVertexLeastAncestor(theGraph, u)) gp_SetVertexLeastAncestor(theGraph, u, uneighbor); } e = gp_GetNextEdge(theGraph, e); } } } } // The graph is now DFS numbered theGraph->graphFlags |= GRAPHFLAGS_DFSNUMBERED; // (6) Now that all vertices have a DFI in the index member, we can sort vertices if (gp_SortVertices(theGraph) != OK) return NOTOK; // Loop through the vertices to... for (v = gp_UpperBoundVertices(theGraph) - 1; v >= gp_LowerBoundVertices(theGraph); --v) { // (7) Initialize for pertinence management gp_SetVertexVisitedInfo(theGraph, v, gp_GetN(theGraph)); // (7) Initialize for future pertinence management child = gp_GetVertexSortedDFSChildList(theGraph, v); gp_SetVertexFuturePertinentChild(theGraph, v, child); leastValue = gp_GetVertexLeastAncestor(theGraph, v); while (gp_IsVertex(theGraph, child)) { if (leastValue > gp_GetVertexLowpoint(theGraph, child)) leastValue = gp_GetVertexLowpoint(theGraph, child); child = gp_GetVertexNextDFSChild(theGraph, v, child); } gp_SetVertexLowpoint(theGraph, v, leastValue); // (8) Create the DFS tree embedding using the child edge records stored in the virtual vertices // For each vertex v that is a DFS child, the virtual vertex R that will represent v's parent // in the singleton bicomp with v is at location v + N in the vertex array. if (gp_IsDFSTreeRoot(theGraph, v)) { gp_SetFirstEdge(theGraph, v, NIL); gp_SetLastEdge(theGraph, v, NIL); } else { R = gp_GetBicompRootFromDFSChild(theGraph, v); // Make the child edge the only edge in the virtual vertex adjacency list e = gp_GetFirstEdge(theGraph, R); gp_SetPrevEdge(theGraph, e, NIL); gp_SetNextEdge(theGraph, e, NIL); // Reset the twin's neighbor value to point to the virtual vertex eTwin = gp_GetTwin(theGraph, e); gp_SetNeighbor(theGraph, eTwin, R); // Make its twin the only edge in the child's adjacency list gp_SetFirstEdge(theGraph, v, eTwin); gp_SetLastEdge(theGraph, v, eTwin); gp_SetPrevEdge(theGraph, eTwin, NIL); gp_SetNextEdge(theGraph, eTwin, NIL); // Set up the external face management data structure to match gp_SetExtFaceVertex(theGraph, R, 0, v); gp_SetExtFaceVertex(theGraph, R, 1, v); gp_SetExtFaceVertex(theGraph, v, 0, R); gp_SetExtFaceVertex(theGraph, v, 1, R); } } _gp_LogLine("graphEmbed.c/_EmbeddingInitialize() end\n"); return OK; } /******************************************************************** _EmbedBackEdgeToDescendant() The Walkdown has found a descendant vertex W to which it can attach a back edge up to the root of the bicomp it is processing. The RootSide and WPrevLink indicate the parts of the external face that will be replaced at each endpoint of the back edge. ********************************************************************/ void _EmbedBackEdgeToDescendant(graphP theGraph, int RootSide, int RootVertex, int W, int WPrevLink) { int fwdEdgeRec, backEdgeRec, parentCopy; /* We get the two edge records of the back edge (v, W) to embed. The Walkup recorded in W's adjacentTo the index of the forward edge record that goes from the root's parent copy, v, to the descendant W. */ fwdEdgeRec = gp_GetVertexPertinentEdge(theGraph, W); backEdgeRec = gp_GetTwin(theGraph, fwdEdgeRec); /* The forward edge record is removed from the fwdEdgeList of the root's parent copy. */ parentCopy = gp_GetVertexFromBicompRoot(theGraph, RootVertex); _gp_LogLine(_gp_MakeLogStr5("graphEmbed.c/_EmbedBackEdgeToDescendant() V=%d, R=%d, R_out=%d, W=%d, W_in=%d", parentCopy, RootVertex, RootSide, W, WPrevLink)); if (gp_GetVertexFwdEdgeList(theGraph, parentCopy) == fwdEdgeRec) { gp_SetVertexFwdEdgeList(theGraph, parentCopy, gp_GetNextEdge(theGraph, fwdEdgeRec)); if (gp_GetVertexFwdEdgeList(theGraph, parentCopy) == fwdEdgeRec) gp_SetVertexFwdEdgeList(theGraph, parentCopy, NIL); } gp_SetNextEdge(theGraph, gp_GetPrevEdge(theGraph, fwdEdgeRec), gp_GetNextEdge(theGraph, fwdEdgeRec)); gp_SetPrevEdge(theGraph, gp_GetNextEdge(theGraph, fwdEdgeRec), gp_GetPrevEdge(theGraph, fwdEdgeRec)); // The forward edge record is added to the adjacency list of the RootVertex. // Note that we're guaranteed that the RootVertex adjacency list is non-empty, // so tests for NIL are not needed gp_SetAdjacentEdge(theGraph, fwdEdgeRec, 1 ^ RootSide, NIL); gp_SetAdjacentEdge(theGraph, fwdEdgeRec, RootSide, gp_GetEdgeByLink(theGraph, RootVertex, RootSide)); gp_SetAdjacentEdge(theGraph, gp_GetEdgeByLink(theGraph, RootVertex, RootSide), 1 ^ RootSide, fwdEdgeRec); gp_SetEdgeByLink(theGraph, RootVertex, RootSide, fwdEdgeRec); // The back edge record is added to the adjacency list of W. // The adjacency list of W is also guaranteed non-empty gp_SetAdjacentEdge(theGraph, backEdgeRec, 1 ^ WPrevLink, NIL); gp_SetAdjacentEdge(theGraph, backEdgeRec, WPrevLink, gp_GetEdgeByLink(theGraph, W, WPrevLink)); gp_SetAdjacentEdge(theGraph, gp_GetEdgeByLink(theGraph, W, WPrevLink), 1 ^ WPrevLink, backEdgeRec); gp_SetEdgeByLink(theGraph, W, WPrevLink, backEdgeRec); gp_SetNeighbor(theGraph, backEdgeRec, RootVertex); /* Link the two endpoint vertices together on the external face */ gp_SetExtFaceVertex(theGraph, RootVertex, RootSide, W); gp_SetExtFaceVertex(theGraph, W, WPrevLink, RootVertex); } /******************************************************************** _InvertVertex() This function flips the orientation of a single vertex such that instead of using link successors to go clockwise (or counterclockwise) around a vertex's adjacency list, link predecessors would be used. ********************************************************************/ void _InvertVertex(graphP theGraph, int W) { int e, temp; _gp_LogLine(_gp_MakeLogStr1("graphEmbed.c/_InvertVertex() W=%d", W)); // Swap the links in all of the edge records of the adjacency list e = gp_GetFirstEdge(theGraph, W); while (gp_IsEdge(theGraph, e)) { temp = gp_GetNextEdge(theGraph, e); gp_SetNextEdge(theGraph, e, gp_GetPrevEdge(theGraph, e)); gp_SetPrevEdge(theGraph, e, temp); e = temp; } // Swap the first/last edge record indicators in the vertex temp = gp_GetFirstEdge(theGraph, W); gp_SetFirstEdge(theGraph, W, gp_GetLastEdge(theGraph, W)); gp_SetLastEdge(theGraph, W, temp); // Swap the first/last external face indicators in the vertex temp = gp_GetExtFaceVertex(theGraph, W, 0); gp_SetExtFaceVertex(theGraph, W, 0, gp_GetExtFaceVertex(theGraph, W, 1)); gp_SetExtFaceVertex(theGraph, W, 1, temp); } /******************************************************************** _MergeVertex() The merge step joins the vertex W to the root R of a child bicompRoot, which is a root copy of W appearing in the region N to 2N-1. Actually, the first step of this is to redirect all of the edges leading into R so that they indicate W as the neighbor instead of R. For each edge node pointing to R, we set the 'v' field to W. Once an edge is redirected from a root copy R to a parent copy W, the edge is never redirected again, so we associate the cost of the redirection as constant per edge, which maintains linear time performance. After this is done, a regular circular list union occurs. The only consideration is that WPrevLink is used to indicate the two edge records e_w and e_r that will become consecutive in the resulting adjacency list of W. We set e_w to W's link [WPrevLink] and e_r to R's link [1^WPrevLink] so that e_w and e_r indicate W and R with opposing links, which become free to be cross-linked. Finally, the edge record e_ext, set equal to R's link [WPrevLink], is the edge that, with e_r, held R to the external face. Now, e_ext will be the new link [WPrevLink] edge record for W. If e_w and e_r become part of a proper face, then e_ext and W's link [1^WPrevLink] are the two edges that attach W to the external face cycle of the containing bicomp. ********************************************************************/ void _MergeVertex(graphP theGraph, int W, int WPrevLink, int R) { int e, eTwin, e_w, e_r, e_ext; _gp_LogLine(_gp_MakeLogStr4("graphEmbed.c/_MergeVertex() W=%d, W_in=%d, R=%d, R_out=%d", W, WPrevLink, R, 1 ^ WPrevLink)); // All edge records leading _into_ R _from_ its neighbors must be changed // to say that they are leading into W. e = gp_GetFirstEdge(theGraph, R); while (gp_IsEdge(theGraph, e)) { eTwin = gp_GetTwin(theGraph, e); gp_GetNeighbor(theGraph, eTwin) = W; e = gp_GetNextEdge(theGraph, e); } // Obtain the edge records that will be involved in the adjacency list union e_w = gp_GetEdgeByLink(theGraph, W, WPrevLink); e_r = gp_GetEdgeByLink(theGraph, R, 1 ^ WPrevLink); e_ext = gp_GetEdgeByLink(theGraph, R, WPrevLink); // If W has any edges, then join its adjacency list with that of R if (gp_IsEdge(theGraph, e_w)) { // The WPrevLink edge of W is e_w, so the 1^WPrevLink edge in e_w leads back to W. // Now it must lead to e_r. Likewise, e_r needs to lead back to e_w with the // opposing link, which is WPrevLink // Note that the adjacency lists of W and R are guaranteed non-empty, which is // why these linkages can be made without NIL tests. gp_SetAdjacentEdge(theGraph, e_w, 1 ^ WPrevLink, e_r); gp_SetAdjacentEdge(theGraph, e_r, WPrevLink, e_w); // Cross-link W's WPrevLink edge record and the 1^WPrevLink edge record in e_ext gp_SetEdgeByLink(theGraph, W, WPrevLink, e_ext); gp_SetAdjacentEdge(theGraph, e_ext, 1 ^ WPrevLink, NIL); } // Otherwise, W just receives R's adjacency list. This can happen, for example, on // a DFS tree root vertex during JoinBicomps() else { // Cross-link W's 1^WPrevLink edge record and the WPrevLink edge record in e_r gp_SetEdgeByLink(theGraph, W, 1 ^ WPrevLink, e_r); gp_SetAdjacentEdge(theGraph, e_r, WPrevLink, NIL); // Cross-link W's WPrevLink edge record and the 1^WPrevLink edge record in e_ext gp_SetEdgeByLink(theGraph, W, WPrevLink, e_ext); gp_SetAdjacentEdge(theGraph, e_ext, 1 ^ WPrevLink, NIL); } // Erase the entries in R, which is a root copy that is no longer needed _InitVertexRec(theGraph, R); } /******************************************************************** _MergeBicomps() Merges all biconnected components at the cut vertices indicated by entries on the stack. theGraph contains the stack of bicomp roots and cut vertices to merge v, RootVertex, W and WPrevLink are not used in this routine, but are used by overload extensions Returns OK, but an extension function may return a value other than OK in order to cause Walkdown to terminate immediately. ********************************************************************/ int _MergeBicomps(graphP theGraph, int v, int RootVertex, int W, int WPrevLink) { int R, Rout, Z, ZPrevLink, e, extFaceVertex; while (sp_NonEmpty(theGraph->theStack)) { sp_Pop2(theGraph->theStack, R, Rout); sp_Pop2(theGraph->theStack, Z, ZPrevLink); /* The external faces of the bicomps containing R and Z will form two corners at Z. One corner will become part of the internal face formed by adding the new back edge. The other corner will be the new external face corner at Z. We first want to update the links at Z to reflect this. */ extFaceVertex = gp_GetExtFaceVertex(theGraph, R, 1 ^ Rout); gp_SetExtFaceVertex(theGraph, Z, ZPrevLink, extFaceVertex); if (gp_GetExtFaceVertex(theGraph, extFaceVertex, 0) == gp_GetExtFaceVertex(theGraph, extFaceVertex, 1)) // When (R, extFaceVertex) form a singleton bicomp, they have the same orientation, so the Rout link in extFaceVertex // is the one that has to now point back to Z gp_SetExtFaceVertex(theGraph, extFaceVertex, Rout, Z); else // When R and extFaceVertex are not alone in the bicomp, then they may not have the same orientation, so the // ext face link that should point to Z is whichever one pointed to R, since R is a root copy of Z. gp_SetExtFaceVertex(theGraph, extFaceVertex, gp_GetExtFaceVertex(theGraph, extFaceVertex, 0) == R ? 0 : 1, Z); /* If the path used to enter Z is opposed to the path used to exit R, then we have to flip the bicomp rooted at R, which we signify by inverting R then setting the sign on its DFS child edge to indicate that its descendants must be flipped later */ if (ZPrevLink == Rout) { Rout = 1 ^ ZPrevLink; if (gp_GetFirstEdge(theGraph, R) != gp_GetLastEdge(theGraph, R)) _InvertVertex(theGraph, R); e = gp_GetFirstEdge(theGraph, R); while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) { // The core planarity algorithm could simply "set" the inverted flag // because a bicomp root edge cannot be already inverted in the core // planarity algorithm at the time of this merge. // However, extensions may perform edge reductions on tree edges, resulting // in an inversion sign being promoted to the root edge of a bicomp before // it gets merged. So, xor is used to reverse the inversion flag on the // root edge if the bicomp root must be inverted before it is merged. gp_XorEdgeFlagInverted(theGraph, e); break; } e = gp_GetNextEdge(theGraph, e); } } // R is no longer pertinent to Z since we are about to merge R into Z, so we delete R // from Z's pertinent bicomp list (Walkdown gets R from the head of the list). gp_DeleteVertexPertinentRoot(theGraph, Z, R); // If the merge will place the current future pertinence child into the same bicomp as Z, // then we advance to the next child (or NIL) because future pertinence is if (gp_GetDFSChildFromBicompRoot(theGraph, R) == gp_GetVertexFuturePertinentChild(theGraph, Z)) { gp_SetVertexFuturePertinentChild(theGraph, Z, gp_GetVertexNextDFSChild(theGraph, Z, gp_GetVertexFuturePertinentChild(theGraph, Z))); } // Now we push R into Z, eliminating R theGraph->functions->fpMergeVertex(theGraph, Z, ZPrevLink, R); } return OK; } /******************************************************************** _WalkUp() v is the vertex currently being embedded e is the forward edge record of the "back" edge between v and a descendant W of v The Walkup establishes pertinence for step v. It marks W with e as a way of indicating it is pertinent because it should be made 'adjacent to' v by adding a back edge (v', W), which will occur when the Walkdown encounters W. The Walkup also determines the pertinent child bicomps that should be set up as a result of the need to embed edge (v, W). It does this by recording the pertinent child biconnected components of all cut vertices between W and the child of v that is an ancestor of W. Note that it stops the traversal if it finds a visited info value set to v, which indicates that a prior walkup call in step v has already done the work. This ensures work is not duplicated. A second technique used to maintain a total linear time bound for the whole planarity method is that of parallel external face traversal. This ensures that the cost of determining pertinence in step v is linearly commensurate with the length of the path that ultimately is removed from the external face. Zig and Zag are so named because one goes around one side of a bicomp and the other goes around the other side, yet we have as yet no notion of orientation for the bicomp. The edge record e from vertex v gestures to a descendant vertex W in some other bicomp. Zig and Zag start out at W. They go around alternate sides of the bicomp until its root is found. We then hop from the root copy to the parent copy of the vertex in order to record which bicomp we just came from and also to continue the walk-up at the parent copy as if it were the new W. We reiterate this process until the parent copy actually is v, at which point the Walkup is done. ********************************************************************/ void _WalkUp(graphP theGraph, int v, int e) { int W = gp_GetNeighbor(theGraph, e); int Zig = W, Zag = W, ZigPrevLink = 1, ZagPrevLink = 0; int nextZig, nextZag, R; // Start by marking W as being directly pertinent gp_SetVertexPertinentEdge(theGraph, W, e); // Zig and Zag are initialized at W, and we continue looping around // the external faces of bicomps up from W until we reach vertex v // (or until the visited info optimization breaks the loop) while (Zig != v) { // Obtain the next vertex in a first direction and determine if it is a bicomp root if (gp_IsVirtualVertex(theGraph, (nextZig = gp_GetExtFaceVertex(theGraph, Zig, 1 ^ ZigPrevLink)))) { // If the current vertex along the external face was visited in this step v, // then the bicomp root and its ancestor roots have already been added. if (gp_GetVertexVisitedInfo(theGraph, Zig) == v) break; // Store the bicomp root that was found R = nextZig; // Since the bicomp root was the next vertex on the path from Zig, determine the // vertex on the opposing path that enters the bicomp root. nextZag = gp_GetExtFaceVertex(theGraph, R, gp_GetExtFaceVertex(theGraph, R, 0) == Zig ? 1 : 0); // If the opposing vertex was already marked visited in this step, then a prior // Walkup already recorded as pertinent the bicomp root and its ancestor roots. if (gp_GetVertexVisitedInfo(theGraph, nextZag) == v) break; } // Obtain the next vertex in the parallel direction and perform the analogous logic else if (gp_IsVirtualVertex(theGraph, (nextZag = gp_GetExtFaceVertex(theGraph, Zag, 1 ^ ZagPrevLink)))) { if (gp_GetVertexVisitedInfo(theGraph, Zag) == v) break; R = nextZag; nextZig = gp_GetExtFaceVertex(theGraph, R, gp_GetExtFaceVertex(theGraph, R, 0) == Zag ? 1 : 0); if (gp_GetVertexVisitedInfo(theGraph, nextZig) == v) break; } // The bicomp root was not found in either direction. else { if (gp_GetVertexVisitedInfo(theGraph, Zig) == v) break; if (gp_GetVertexVisitedInfo(theGraph, Zag) == v) break; R = NIL; } // This Walkup has now finished with another vertex along each of the parallel // paths, so they are marked visited in step v so that future Walkups in this // step v can break if these vertices are encountered again. gp_SetVertexVisitedInfo(theGraph, Zig, v); gp_SetVertexVisitedInfo(theGraph, Zag, v); // If both directions found new non-root vertices, then proceed with parallel external face traversal if (gp_IsNotVirtualVertex(theGraph, R)) { ZigPrevLink = gp_GetExtFaceVertex(theGraph, nextZig, 0) == Zig ? 0 : 1; Zig = nextZig; ZagPrevLink = gp_GetExtFaceVertex(theGraph, nextZag, 0) == Zag ? 0 : 1; Zag = nextZag; } // The bicomp root was found and not previously recorded as pertinent, // so walk up to the parent bicomp and continue else { // Step up from the bicomp root vertex (virtual) to the parent copy of // the vertex (non-virtual; called parent copy because it is the one that // is in a bicomp with a virtual or non-virtual copy of its DFS parent) Zig = Zag = gp_GetVertexFromBicompRoot(theGraph, R); ZigPrevLink = 1; ZagPrevLink = 0; // Add the new bicomp root o the list of pertinent bicomp roots of the parent copy vertex. // The new root vertex is appended if future pertinent and prepended if only pertinent // so that, by virtue of storage, the Walkdown will process all pertinent bicomps that // are not future pertinent before any future pertinent bicomps. // NOTE: Unlike vertices, the activity status of a bicomp is computed solely using // the lowpoint of the DFS child in the bicomp's root edge, which indicates // whether the DFS child or any of its descendants connect by a back edge to // ancestors of v. If so, then the bicomp rooted at RootVertex must contain a // future pertinent vertex that must be kept on the external face. if (gp_GetVertexLowpoint(theGraph, gp_GetDFSChildFromBicompRoot(theGraph, R)) < v) gp_AppendVertexPertinentRoot(theGraph, Zig, R); else gp_PrependVertexPertinentRoot(theGraph, Zag, R); } } } /******************************************************************** _WalkDown() Consider a circular shape with small circles and squares along its perimeter. The small circle at the top is the root vertex of the bicomp. The other small circles represent active vertices, and the squares represent future pertinent vertices. The root vertex is a root copy of v, the vertex currently being processed. The Walkup previously marked all vertices adjacent to v by setting their pertinentEdge members with the forward edge records of the back edges to embed. Two Walkdown traversals are performed to visit all reachable vertices along each of the external face paths emanating from RootVertex (a root copy of vertex v) to embed back edges to descendants of vertex v that have their pertinentEdge members marked. During each Walkdown traversal, it is sometimes necessary to hop from a vertex to one of its child biconnected components in order to reach the desired vertices. In such cases, the biconnected components are merged such that adding the back edge forms a new proper face in the biconnected component rooted at RootVertex (which, again, is a root copy of v). The outer loop performs both walks, unless the first walk got all the way around to RootVertex (only happens when bicomp contains no external activity, such as when processing the last vertex), or when non-planarity is discovered (in a pertinent child bicomp such that the stack is non-empty). For the inner loop, each iteration visits a vertex W. If W is marked as requiring a back edge, then MergeBicomps is called to merge the biconnected components whose cut vertices have been collecting in merge stack. Then, the back edge (RootVertex, W) is added, and the pertinentEdge of W is cleared. Next, we check whether W has a pertinent child bicomp. If so, then we figure out which path down from the root of the child bicomp leads to the next vertex to be visited, and we push onto the stack information on the cut vertex and the paths used to enter into it and exit from it. Alternately, if W had no pertinent child bicomps, then we check to see if it is inactive. If so, we find the next vertex along the external face, then short-circuit its inactive predecessor (under certain conditions). Finally, if W is not inactive, but it has no pertinent child bicomps, then we already know its adjacentTo flag is clear so both criteria for internal activity also fail. Therefore, W must be a stopping vertex. A stopping vertex X is a future pertinent vertex that has no pertinent child bicomps and no unembedded back edge to the current vertex v. The inner loop of Walkdown stops walking when it reaches a stopping vertex X because if it were to proceed beyond X and embed a back edge, then X would be surrounded by the bounding cycle of the bicomp. This would clearly be incorrect because X has a path leading from it to an ancestor of v, which would have to cross the bounding cycle. Either Walkdown traversal can halt the Walkdown and return if a pertinent child biconnected component to which the traversal has descended is blocked, i.e. has stopping vertices on both paths emanating from the root. This indicates an obstruction to embedding. In core planarity it is evidence of a K_{3,3}, but some extension algorithms are able to clear the blockage and proceed with embedding. If both Walkdown traversals successfully completed, then the outer loop ends. Post-processing code tests whether the Walkdown embedded all the back edges from v to its descendants in the subtree rooted by c, a DFS child of v uniquely associated with the RootVertex. If not, then embedding was obstructed. In core planarity it is evidence of a K_{3,3} or K_5, but some extension algorithms are able to clear the blockage and proceed with embedding. Returns OK if all possible edges were embedded, NONEMBEDDABLE if less than all possible edges were embedded, NOTOK for an internal code failure ********************************************************************/ int _WalkDown(graphP theGraph, int v, int RootVertex) { int RetVal, W, WPrevLink, R, X, XPrevLink, Y, YPrevLink, RootSide, e; int RootEdgeChild = gp_GetDFSChildFromBicompRoot(theGraph, RootVertex); sp_ClearStack(theGraph->theStack); for (RootSide = 0; RootSide < 2; RootSide++) { W = gp_GetExtFaceVertex(theGraph, RootVertex, RootSide); // Determine the link used to enter W based on which side points back to RootVertex // Implicitly handled special case: In core planarity, the first Walkdown traversal // Will be on a singleton edge. In this case, RootVertex and W are *consistently* // oriented, and the RootSide is 0, so WPrevLink should be 1. This calculation is // written to implicitly produce that result. WPrevLink = gp_GetExtFaceVertex(theGraph, W, 1) == RootVertex ? 1 : 0; while (W != RootVertex) { // Detect unembedded back edge descendant endpoint W if (gp_IsEdge(theGraph, gp_GetVertexPertinentEdge(theGraph, W))) { // Merge any bicomps whose cut vertices were traversed to reach W, then add the // edge to W to form a new proper face in the embedding. if (sp_NonEmpty(theGraph->theStack)) { if ((RetVal = theGraph->functions->fpMergeBicomps(theGraph, v, RootVertex, W, WPrevLink)) != OK) return RetVal; } theGraph->functions->fpEmbedBackEdgeToDescendant(theGraph, RootSide, RootVertex, W, WPrevLink); // Clear W's pertinentEdge since the forward edge record it contained has been embedded gp_SetVertexPertinentEdge(theGraph, W, NIL); } // If W has a pertinent child bicomp, then we descend to the first one... // NOTE: Each pertinent root is stored as the DFS child with which it is // associated, so we test gp_IsVertex, not gp_IsVirtualVertex here. if (gp_IsVertex(theGraph, gp_GetVertexPertinentRootsList(theGraph, W))) { // Push the vertex W and the direction of entry, then descend to a root copy R of W sp_Push2(theGraph->theStack, W, WPrevLink); R = gp_GetVertexFirstPertinentRoot(theGraph, W); // Get the next active vertices X and Y on the external face paths emanating from R X = gp_GetExtFaceVertex(theGraph, R, 0); XPrevLink = gp_GetExtFaceVertex(theGraph, X, 1) == R ? 1 : 0; Y = gp_GetExtFaceVertex(theGraph, R, 1); YPrevLink = gp_GetExtFaceVertex(theGraph, Y, 0) == R ? 0 : 1; // Now we implement the Walkdown's simple path selection rules! // Select a direction from the root to a pertinent vertex, // preferentially toward a vertex that is not future pertinent gp_UpdateVertexFuturePertinentChild(theGraph, X, v); gp_UpdateVertexFuturePertinentChild(theGraph, Y, v); if (PERTINENT(theGraph, X) && NOTFUTUREPERTINENT(theGraph, X, v)) { W = X; WPrevLink = XPrevLink; sp_Push2(theGraph->theStack, R, 0); } else if (PERTINENT(theGraph, Y) && NOTFUTUREPERTINENT(theGraph, Y, v)) { W = Y; WPrevLink = YPrevLink; sp_Push2(theGraph->theStack, R, 1); } else if (PERTINENT(theGraph, X)) { W = X; WPrevLink = XPrevLink; sp_Push2(theGraph->theStack, R, 0); } else if (PERTINENT(theGraph, Y)) { W = Y; WPrevLink = YPrevLink; sp_Push2(theGraph->theStack, R, 1); } else { // Both the X and Y sides of the descendant bicomp are blocked. // Let the application decide whether it can unblock the bicomp. // The core planarity/outerplanarity embedder simply isolates a // planarity/outerplanary obstruction and returns NONEMBEDDABLE if ((RetVal = theGraph->functions->fpHandleBlockedBicomp(theGraph, v, RootVertex, R)) != OK) return RetVal; // If an extension algorithm cleared the blockage, then we pop W and WPrevLink // back off the stack and let the Walkdown traversal try descending again sp_Pop2(theGraph->theStack, W, WPrevLink); } } else { // The vertex W is known to be non-pertinent, so if it is future pertinent // (or if the algorithm is based on outerplanarity), then the vertex is // a stopping vertex for the Walkdown traversal. gp_UpdateVertexFuturePertinentChild(theGraph, W, v); if (FUTUREPERTINENT(theGraph, W, v) || (gp_GetEmbedFlags(theGraph) & EMBEDFLAGS_OUTERPLANAR)) { // Create an external face short-circuit between RootVertex and the stopping vertex W // so that future steps do not walk down a long path of inactive vertices between them. // As a special case, we ensure that the external face is not reduced to just two // vertices, W and RootVertex, because it would then become a challenge to determine // whether W has the same orientation as RootVertex. // So, if the other side of RootVertex is already attached to W, then we simply push // W back one vertex so that the external face will have at least three vertices. if (gp_GetExtFaceVertex(theGraph, RootVertex, 1 ^ RootSide) == W) { X = W; W = gp_GetExtFaceVertex(theGraph, W, WPrevLink); WPrevLink = gp_GetExtFaceVertex(theGraph, W, 0) == X ? 1 : 0; } gp_SetExtFaceVertex(theGraph, RootVertex, RootSide, W); gp_SetExtFaceVertex(theGraph, W, WPrevLink, RootVertex); // Terminate the Walkdown traversal since it encountered the stopping vertex break; } // If the vertex is neither pertinent nor future pertinent, then it is inactive. // The default handler planarity handler simply skips inactive vertices by traversing // to the next vertex on the external face. // Once upon a time, false edges called short-circuit edges were added to eliminate // inactive vertices, but the extFace links above achieve the same result with less work. else { if (theGraph->functions->fpHandleInactiveVertex(theGraph, RootVertex, &W, &WPrevLink) != OK) return NOTOK; } } } } // Detect and handle the case in which Walkdown was blocked from embedding all the back edges from v // to descendants in the subtree of the child of v associated with the bicomp RootVertex. if (gp_IsEdge(theGraph, e = gp_GetVertexFwdEdgeList(theGraph, v)) && RootEdgeChild < gp_GetNeighbor(theGraph, e)) { int nextChild = gp_GetVertexNextDFSChild(theGraph, v, RootEdgeChild); // We finish detecting that the Walkdown was blocked from embedding all forward edge records into // the RootEdgeChild subtree if there the next child's DFI is greater than the descendant endpoint // of the next forward edge record, or if there is no next child. if (gp_IsNotVertex(theGraph, nextChild) || nextChild > gp_GetNeighbor(theGraph, e)) { // If an extension to core planarity indicates it is OK to proceed despite having detected // unembedded forward edges, then advance to the forward edges for the next child, if any if ((RetVal = theGraph->functions->fpHandleBlockedBicomp(theGraph, v, RootVertex, RootVertex)) == OK) _AdvanceFwdEdgeList(theGraph, v, RootEdgeChild, nextChild); return RetVal; } } return OK; } /******************************************************************** _HandleBlockedBicomp() A biconnected component has blocked the Walkdown from embedding back edges. Each external face path emanating from the root is blocked by a stopping vertex. The core planarity/outerplanarity algorithm handles the blockage by isolating an embedding obstruction (a subgraph homeomorphic to K_{3,3} or K_5 for planarity, or a subgraph homeomorphic to K_{2,3} or K_4 for outerplanarity). Then NONEMBEDDABLE is returned so that the WalkDown can terminate. Extension algorithms are able to clear some of the blockages, in which case OK is returned to indicate that the WalkDown can proceed. Returns OK to proceed with WalkDown at W, NONEMBEDDABLE to terminate WalkDown of Root Vertex NOTOK for internal error ********************************************************************/ int _HandleBlockedBicomp(graphP theGraph, int v, int RootVertex, int R) { int RetVal = NONEMBEDDABLE; if (R != RootVertex) sp_Push2(theGraph->theStack, R, 0); if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_PLANAR) { if (_IsolateKuratowskiSubgraph(theGraph, v, RootVertex) != OK) RetVal = NOTOK; } else if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_OUTERPLANAR) { if (_IsolateOuterplanarObstruction(theGraph, v, RootVertex) != OK) RetVal = NOTOK; } return RetVal; } /******************************************************************** _AdvanceFwdEdgeList() If an extension determines that it is OK to leave some forward edges unembedded, then we advance the forward edge list head pointer past the unembedded edges for the current child so that it points to the first forward edge for the next child, if any. There are two meanings of the phrase "if any". First, there may be no next child, in which case nextChild is NIL, and the forward edge list need not be advanced. If there is a next child, then the forward edge list head needs to be advanced to the first edge whose descendant endpoint is greater than the nextChild, if any. However, the tail end of the forward edge list may include unembedded forward edge records to a preceding sibling of the child vertex. So, we advance an edge pointer e until one of the following happens: 1) e gets all the way around to the head of the forward edge list 2) e finds an edge whose descendant endpoint is less than the child 3) e finds an edge whose descendant endpoint is greater than the next child In case 1, all the forward edges belong in the subtree of the child, so there is no need to change the forward edge list head. In case 2, there are no more forward edges to any following siblings of the child, only left-behind unembedded forward edges that we advanced past in previous calls to this method from Walkdowns of the preceding children of v. So the forward edge list head should be set to e so that it is set to the forward edge with the least numbered descendant endpoint. In case 3, the desired forward edge into the subtree of a following sibling of the child has been found, so again the forward edge list head should be set to e to indicate that edge. After all Walkdowns of the children of a vertex, the forward edge list will be NIL if all edges were embedded, or it will indicate the unembedded forward edge whose descendant endpoint has the least number. Cases 1 and 2 directly implement this in cases where a Walkdown for the given child fails to embed an edge, and case 3 indirectly finishes the job by making sure the forward edge list head has the right value at the beginning of a Walkdown for a particular child. If the Walkdown of that child succeeds at embedding all the forward edges into that child's subtree, then each embedding advances the forward edge list head. So, even if the Walkdown of the last pertinent child embeds all forward edges, then the Walkdown itself advances the head of the forward edge list to the first unembedded forward edge, or to NIL. ********************************************************************/ void _AdvanceFwdEdgeList(graphP theGraph, int v, int child, int nextChild) { int e = gp_GetVertexFwdEdgeList(theGraph, v); while (gp_IsEdge(theGraph, e)) { // 2) e finds an edge whose descendant endpoint is less than the child if (gp_GetNeighbor(theGraph, e) < child) { gp_SetVertexFwdEdgeList(theGraph, v, e); break; } // 3) e finds an edge whose descendant endpoint is greater than the next child else if (gp_IsVertex(theGraph, nextChild) && nextChild < gp_GetNeighbor(theGraph, e)) { gp_SetVertexFwdEdgeList(theGraph, v, e); break; } e = gp_GetNextEdge(theGraph, e); // 1) e gets all the way around to the head of the forward edge list if (e == gp_GetVertexFwdEdgeList(theGraph, v)) e = NIL; } } /******************************************************************** _HandleInactiveVertex() Although it is possible to short-circuit every inactive vertex from the external face, for efficiency the Walkdown traversal now just does a single short-circuit between the bicomp root and a stopping vertex. This is because the main thing that short-circuiting needs to optimize is the Walkdown's choice of direction after descending to the root of a pertinent biconnected component. So, the Walkdown just optimizes the external face of a biconnected component as it finishes processing it so it will be ready in future steps when it becomes pertinent. Hence, when traversing the face of a bicomp during the current step, we only need to skip an inactive vertex and traverse to the next vertex on the external face. ********************************************************************/ int _HandleInactiveVertex(graphP theGraph, int BicompRoot, int *pW, int *pWPrevLink) { int X = gp_GetExtFaceVertex(theGraph, *pW, 1 ^ *pWPrevLink); *pWPrevLink = gp_GetExtFaceVertex(theGraph, X, 0) == *pW ? 0 : 1; *pW = X; return OK; } /******************************************************************** _EmbedPostprocess() After the loop that embeds the cycle edges from each vertex to its DFS descendants, this method is invoked to postprocess the graph. If the graph is planar or outerplanar, then a consistent orientation is imposed on the vertices of the embedding, and any remaining separated biconnected components are joined together. If the graph is non-planar or non-outerplanar, then an obstruction to planarity or outerplanarity has already been isolated. Extensions may override this function to provide alternate behavior. @param theGraph - the graph ready for postprocessing @param v - the last vertex processed by the edge embedding loop @param edgeEmbeddingResult - OK if all edge embedding iterations returned OK NONEMBEDDABLE if an embedding iteration failed to embed all edges for a vertex @return NOTOK on internal failure NONEMBEDDABLE if a subgraph homeomorphic to a topological obstruction is isolated in the graph OK otherwise (e.g. if the graph contains an embedding) *****************************************************************/ int _EmbedPostprocess(graphP theGraph, int v, int edgeEmbeddingResult) { int RetVal = edgeEmbeddingResult; // If an embedding was found, then post-process the embedding structure give // a consistent orientation to all vertices then eliminate virtual vertices if (edgeEmbeddingResult == OK) { if (_OrientVerticesInEmbedding(theGraph) != OK || _JoinBicomps(theGraph) != OK) RetVal = NOTOK; } // If the graph is embedded (OK) or NONEMBEDDABLE, we pass the result back return RetVal; } /******************************************************************** _OrientVerticesInEmbedding() Each vertex will then have an orientation, either clockwise or counterclockwise. All vertices in each bicomp need to have the same orientation. This method clears the stack, and the stack is clear when it is finished. Returns OK on success, NOTOK on implementation failure. ********************************************************************/ int _OrientVerticesInEmbedding(graphP theGraph) { sp_ClearStack(theGraph->theStack); // For each vertex, obtain the associated bicomp root location and, // if it is still in use as a bicomp root, orient the vertices in the bicomp for (int R = gp_LowerBoundVirtualVertices(theGraph); R < gp_UpperBoundVirtualVertices(theGraph); ++R) { if (gp_VirtualVertexInUse(theGraph, R)) { if (_OrientVerticesInBicomp(theGraph, R, 0) != OK) return NOTOK; } } return OK; } /******************************************************************** _OrientVerticesInBicomp() As a result of the work done so far, the edges around each vertex have been put in order, but the orientation may be counterclockwise or clockwise for different vertices within the same bicomp. We need to reverse the orientations of those vertices that are not oriented the same way as the root of the bicomp. During embedding, a bicomp with root edge (v', c) may need to be flipped. We do this by inverting the root copy v' and implicitly inverting the orientation of the vertices in the subtree rooted by c by assigning -1 to the sign of the DFSCHILD edge record leading to c. We now use these signs to help propagate a consistent vertex orientation throughout all vertices that have been merged into the given bicomp. The bicomp root contains the orientation to be imposed on all parent copy vertices. We perform a standard depth first search to visit each vertex. A vertex must be inverted if the product of the edge signs along the tree edges between the bicomp root and the vertex is -1. Finally, the PreserveSigns flag, if set, performs the inversions but does not change any of the edge signs. This allows a second invocation of this function to restore the state of the bicomp as it was before the first call. This method uses the stack but preserves whatever may have been on it. In debug mode, it will return NOTOK if the stack overflows. This method pushes at most two integers per vertext in the bicomp. Returns OK on success, NOTOK on implementation failure. ********************************************************************/ int _OrientVerticesInBicomp(graphP theGraph, int BicompRoot, int PreserveSigns) { int W, e, invertedFlag; int stackBottom = sp_GetCurrentSize(theGraph->theStack); sp_Push2(theGraph->theStack, BicompRoot, 0); while (sp_GetCurrentSize(theGraph->theStack) > stackBottom) { /* Pop a vertex to orient */ sp_Pop2(theGraph->theStack, W, invertedFlag); /* Invert the vertex if the inverted flag is set */ if (invertedFlag) _InvertVertex(theGraph, W); /* Push the vertex's DFS children that are in the bicomp */ e = gp_GetFirstEdge(theGraph, W); while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_CHILD) { sp_Push2(theGraph->theStack, gp_GetNeighbor(theGraph, e), invertedFlag ^ gp_GetEdgeFlagInverted(theGraph, e)); if (!PreserveSigns) gp_ClearEdgeFlagInverted(theGraph, e); } e = gp_GetNextEdge(theGraph, e); } } return OK; } /******************************************************************** _JoinBicomps() The embedding algorithm works by only joining bicomps once the result forms a larger bicomp. However, if the original graph was separable or disconnected, then the result of the embed function will be a graph that contains each bicomp as a distinct entity. This function merges the bicomps into one connected graph. ********************************************************************/ int _JoinBicomps(graphP theGraph) { for (int R = gp_LowerBoundVirtualVertices(theGraph); R < gp_UpperBoundVirtualVertices(theGraph); ++R) { // If the bicomp root is still active (i.e. an in-use virtual vertex) // then merge it with its parent copy vertex (non-virtual) if (gp_VirtualVertexInUse(theGraph, R)) _MergeVertex(theGraph, gp_GetVertexFromBicompRoot(theGraph, R), 0, R); } return OK; } /**************************************************************************** _OrientExternalFacePath() The vertices along the path (v ... w) are assumed to be degree two vertices in an external face path connecting u and x. This method imparts the orientation of u and x onto the vertices v ... w. The work done is on the order of the path length. Returns OK if the external face path was oriented, NOTOK on implementation error (i.e. if a condition arises providing the path is not on the external face). ****************************************************************************/ int _OrientExternalFacePath(graphP theGraph, int u, int v, int w, int x) { int e_u, e_v, e_ulink, e_vlink; // Get the edge record in u that indicates v; uses the "get twin" method // to ensure the cost is dominated by the degree of v (which is 2), not u // (which can be any degree). e_u = gp_GetTwin(theGraph, _gp_FindEdge(theGraph, v, u)); do { // Get the external face link in vertex u that indicates the // edge e_u which connects to the next vertex v in the path // As a sanity check, we determine whether e_u is an // external face edge, because there would be an internal // implementation error if not if (gp_GetFirstEdge(theGraph, u) == e_u) e_ulink = 0; else if (gp_GetLastEdge(theGraph, u) == e_u) e_ulink = 1; else return NOTOK; v = gp_GetNeighbor(theGraph, e_u); // Now get the external face link in vertex v that indicates the // edge e_v which connects back to the prior vertex u. e_v = gp_GetTwin(theGraph, e_u); if (gp_GetFirstEdge(theGraph, v) == e_v) e_vlink = 0; else if (gp_GetLastEdge(theGraph, v) == e_v) e_vlink = 1; else return NOTOK; // The vertices u and v are inversely oriented if they // use the same link to indicate the edge [e_u, e_v]. if (e_vlink == e_ulink) { _InvertVertex(theGraph, v); e_vlink = 1 ^ e_vlink; } // This update of the extFace short-circuit is polite but unnecessary. // This orientation only occurs once we know we can isolate a K_{3,3}, // at which point the extFace data structure is not used. gp_SetExtFaceVertex(theGraph, u, e_ulink, v); gp_SetExtFaceVertex(theGraph, v, e_vlink, u); u = v; e_u = gp_GetEdgeByLink(theGraph, v, 1 ^ e_vlink); } while (u != x); return OK; } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/planarityRelated/graphIsolator.c000066400000000000000000000741221522057144000315700ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #define GRAPHISOLATOR_C // This source file implements subroutines of the main Planarity method #include "../planarityRelated/graphPlanarity.h" #include "../planarityRelated/graphPlanarity.private.h" /* Imported functions */ extern void _ClearAllVisitedFlagsInGraph(graphP); extern int _GetNeighborOnExtFace(graphP theGraph, int curVertex, int *pPrevLink); extern int _JoinBicomps(graphP theGraph); extern int _ChooseTypeOfNonplanarityMinor(graphP theGraph, int v, int R); /* Private function declarations (exported within system) */ int _IsolateKuratowskiSubgraph(graphP theGraph, int v, int R); int _FindUnembeddedEdgeToAncestor(graphP theGraph, int cutVertex, int *pAncestor, int *pDescendant); int _FindUnembeddedEdgeToCurVertex(graphP theGraph, int cutVertex, int *pDescendant); int _FindUnembeddedEdgeToSubtree(graphP theGraph, int ancestor, int SubtreeRoot, int *pDescendant); int _MarkPathAlongBicompExtFace(graphP theGraph, int startVert, int endVert); int _MarkDFSPath(graphP theGraph, int ancestor, int descendant); int _AddAndMarkEdge(graphP theGraph, int ancestor, int descendant); void _AddBackEdge(graphP theGraph, int ancestor, int descendant); int _DeleteUnmarkedVerticesAndEdges(graphP theGraph); int _InitializeIsolatorContext(graphP theGraph); int _IsolateMinorA(graphP theGraph); int _IsolateMinorB(graphP theGraph); int _IsolateMinorC(graphP theGraph); int _IsolateMinorD(graphP theGraph); int _IsolateMinorE(graphP theGraph); int _IsolateMinorE1(graphP theGraph); int _IsolateMinorE2(graphP theGraph); int _IsolateMinorE3(graphP theGraph); int _IsolateMinorE4(graphP theGraph); int _GetLeastAncestorConnection(graphP theGraph, int cutVertex); int _MarkDFSPathsToDescendants(graphP theGraph); int _AddAndMarkUnembeddedEdges(graphP theGraph); /**************************************************************************** gp_IsolateKuratowskiSubgraph() ****************************************************************************/ int _IsolateKuratowskiSubgraph(graphP theGraph, int v, int R) { int RetVal; /* A subgraph homeomorphic to K_{3,3} or K_5 will be isolated by using the visited flags, set=keep edge/vertex and clear=omit. Here we initialize to omit all, then we subsequently set visited on all edges and vertices in the homeomorph. */ _ClearAllVisitedFlagsInGraph(theGraph); /* Next, we determine which of the non-planarity Minors was encountered and the principal bicomp on which the isolator will focus attention. */ if (_ChooseTypeOfNonplanarityMinor(theGraph, v, R) != OK) return NOTOK; if (_InitializeIsolatorContext(theGraph) != OK) return NOTOK; /* Call the appropriate isolator */ if (theGraphIC(theGraph)->minorType & MINORTYPE_A) RetVal = _IsolateMinorA(theGraph); else if (theGraphIC(theGraph)->minorType & MINORTYPE_B) RetVal = _IsolateMinorB(theGraph); else if (theGraphIC(theGraph)->minorType & MINORTYPE_C) RetVal = _IsolateMinorC(theGraph); else if (theGraphIC(theGraph)->minorType & MINORTYPE_D) RetVal = _IsolateMinorD(theGraph); else if (theGraphIC(theGraph)->minorType & MINORTYPE_E) RetVal = _IsolateMinorE(theGraph); else RetVal = NOTOK; /* Delete the unmarked edges and vertices, and return */ if (RetVal == OK) RetVal = _DeleteUnmarkedVerticesAndEdges(theGraph); return RetVal; } /**************************************************************************** _InitializeIsolatorContext() ****************************************************************************/ int _InitializeIsolatorContext(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); /* Obtains the edges connecting X and Y to ancestors of the current vertex */ if (_FindUnembeddedEdgeToAncestor(theGraph, IC->x, &IC->ux, &IC->dx) != TRUE || _FindUnembeddedEdgeToAncestor(theGraph, IC->y, &IC->uy, &IC->dy) != TRUE) return NOTOK; /* For Minor B, we seek the last pertinent child biconnected component, which is also future pertinent, and obtain the DFS child in its root edge. This child is the subtree root containing vertices with connections to both the current vertex and an ancestor of the current vertex. */ if (theGraphIC(theGraph)->minorType & MINORTYPE_B) { int SubtreeRoot = gp_GetVertexLastPertinentRootChild(theGraph, IC->w); IC->uz = gp_GetVertexLowpoint(theGraph, SubtreeRoot); if (_FindUnembeddedEdgeToSubtree(theGraph, IC->v, SubtreeRoot, &IC->dw) != TRUE || _FindUnembeddedEdgeToSubtree(theGraph, IC->uz, SubtreeRoot, &IC->dz) != TRUE) return NOTOK; } /* For all other minors, we obtain an unembedded connecting the current vertex to the pertinent vertex W, and for minor E we collect the additional unembedded ancestor connection for the future pertinent vertex Z. */ else { if (_FindUnembeddedEdgeToCurVertex(theGraph, IC->w, &IC->dw) != TRUE) return NOTOK; if (theGraphIC(theGraph)->minorType & MINORTYPE_E) if (_FindUnembeddedEdgeToAncestor(theGraph, IC->z, &IC->uz, &IC->dz) != TRUE) return NOTOK; } return OK; } /**************************************************************************** _IsolateMinorA(): Isolate a K3,3 homeomorph ****************************************************************************/ int _IsolateMinorA(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); if (_MarkPathAlongBicompExtFace(theGraph, IC->r, IC->r) != OK || theGraph->functions->fpMarkDFSPath(theGraph, MIN(IC->ux, IC->uy), IC->r) != OK || _MarkDFSPathsToDescendants(theGraph) != OK || _JoinBicomps(theGraph) != OK || _AddAndMarkUnembeddedEdges(theGraph) != OK) return NOTOK; return OK; } /**************************************************************************** _IsolateMinorB(): Isolate a K3,3 homeomorph ****************************************************************************/ int _IsolateMinorB(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); if (_MarkPathAlongBicompExtFace(theGraph, IC->r, IC->r) != OK || theGraph->functions->fpMarkDFSPath(theGraph, MIN3(IC->ux, IC->uy, IC->uz), MAX3(IC->ux, IC->uy, IC->uz)) != OK || _MarkDFSPathsToDescendants(theGraph) != OK || _JoinBicomps(theGraph) != OK || _AddAndMarkUnembeddedEdges(theGraph) != OK) return NOTOK; return OK; } /**************************************************************************** _IsolateMinorC(): Isolate a K3,3 homeomorph ****************************************************************************/ int _IsolateMinorC(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); if (gp_GetObstructionMark(theGraph, IC->px) == ANYVERTEX_OBSTRUCTIONMARK_HIGH_RXW) { int highY = gp_GetObstructionMark(theGraph, IC->py) == ANYVERTEX_OBSTRUCTIONMARK_HIGH_RYW ? IC->py : IC->y; if (_MarkPathAlongBicompExtFace(theGraph, IC->r, highY) != OK) return NOTOK; } else { if (_MarkPathAlongBicompExtFace(theGraph, IC->x, IC->r) != OK) return NOTOK; } // Note: The x-y path is already marked, due to identifying the type of non-planarity minor if (_MarkDFSPathsToDescendants(theGraph) != OK || theGraph->functions->fpMarkDFSPath(theGraph, MIN(IC->ux, IC->uy), IC->r) != OK || _JoinBicomps(theGraph) != OK || _AddAndMarkUnembeddedEdges(theGraph) != OK) return NOTOK; return OK; } /**************************************************************************** _IsolateMinorD(): Isolate a K3,3 homeomorph ****************************************************************************/ int _IsolateMinorD(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); // Note: The x-y and v-z paths are already marked, due to identifying the type of non-planarity minor if (_MarkPathAlongBicompExtFace(theGraph, IC->x, IC->y) != OK || theGraph->functions->fpMarkDFSPath(theGraph, MIN(IC->ux, IC->uy), IC->r) != OK || _MarkDFSPathsToDescendants(theGraph) != OK || _JoinBicomps(theGraph) != OK || _AddAndMarkUnembeddedEdges(theGraph) != OK) return NOTOK; return OK; } /**************************************************************************** _IsolateMinorE() ****************************************************************************/ int _IsolateMinorE(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); /* Minor E1: Isolate a K3,3 homeomorph */ if (IC->z != IC->w) return _IsolateMinorE1(theGraph); /* Minor E2: Isolate a K3,3 homeomorph */ if (IC->uz > MAX(IC->ux, IC->uy)) return _IsolateMinorE2(theGraph); /* Minor E3: Isolate a K3,3 homeomorph */ if (IC->uz < MAX(IC->ux, IC->uy) && IC->ux != IC->uy) return _IsolateMinorE3(theGraph); /* Minor E4: Isolate a K3,3 homeomorph */ else if (IC->x != IC->px || IC->y != IC->py) return _IsolateMinorE4(theGraph); /* Minor E: Isolate a K5 homeomorph */ // Note: The x-y path is already marked, due to identifying the type of non-planarity minor if (_MarkPathAlongBicompExtFace(theGraph, IC->r, IC->r) != OK || theGraph->functions->fpMarkDFSPath(theGraph, MIN3(IC->ux, IC->uy, IC->uz), IC->r) != OK || _MarkDFSPathsToDescendants(theGraph) != OK || _JoinBicomps(theGraph) != OK || _AddAndMarkUnembeddedEdges(theGraph) != OK) return NOTOK; return OK; } /**************************************************************************** _IsolateMinorE1() Reduce to Minor C if the vertex Z responsible for external activity below the X-Y path does not equal the pertinent vertex W. ****************************************************************************/ int _IsolateMinorE1(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); if (gp_GetObstructionMark(theGraph, IC->z) == ANYVERTEX_OBSTRUCTIONMARK_LOW_RXW) { gp_ResetObstructionMark(theGraph, IC->px, ANYVERTEX_OBSTRUCTIONMARK_HIGH_RXW); IC->x = IC->z; IC->ux = IC->uz; IC->dx = IC->dz; } else if (gp_GetObstructionMark(theGraph, IC->z) == ANYVERTEX_OBSTRUCTIONMARK_LOW_RYW) { gp_ResetObstructionMark(theGraph, IC->py, ANYVERTEX_OBSTRUCTIONMARK_HIGH_RYW); IC->y = IC->z; IC->uy = IC->uz; IC->dy = IC->dz; } else return NOTOK; // Note: The x-y path is already marked, due to identifying E as the type of non-planarity minor, // but the x-y path is also included in minor C, so we let it stay marked since the minor C // isolator also assumes the x-y path has been marked by non-planarity minor type identification IC->z = IC->uz = IC->dz = NIL; theGraphIC(theGraph)->minorType ^= MINORTYPE_E; theGraphIC(theGraph)->minorType |= (MINORTYPE_C | MINORTYPE_E1); return _IsolateMinorC(theGraph); } /**************************************************************************** _IsolateMinorE2() If uZ (which is the ancestor of v that is adjacent to Z) is a descendant of both uY and uX, then we reduce to Minor A ****************************************************************************/ int _IsolateMinorE2(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); // Note: The x-y path was already marked, due to identifying E as the type of non-planarity minor, // but we're reducing to Minor A, which does not include the x-y path, so the visited flags are // cleared as a convenient, if somewhat wasteful, way to clear the marking on the x-y path _ClearAllVisitedFlagsInGraph(theGraph); IC->v = IC->uz; IC->dw = IC->dz; IC->z = IC->uz = IC->dz = NIL; theGraphIC(theGraph)->minorType ^= MINORTYPE_E; theGraphIC(theGraph)->minorType |= (MINORTYPE_A | MINORTYPE_E2); return _IsolateMinorA(theGraph); } /**************************************************************************** _IsolateMinorE3() ****************************************************************************/ int _IsolateMinorE3(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); if (IC->ux < IC->uy) { if (_MarkPathAlongBicompExtFace(theGraph, IC->r, IC->px) != OK || _MarkPathAlongBicompExtFace(theGraph, IC->w, IC->y) != OK) return NOTOK; } else { if (_MarkPathAlongBicompExtFace(theGraph, IC->x, IC->w) != OK || _MarkPathAlongBicompExtFace(theGraph, IC->py, IC->r) != OK) return NOTOK; } // Note: The x-y path is already marked, due to identifying E as the type of non-planarity minor if (theGraph->functions->fpMarkDFSPath(theGraph, MIN3(IC->ux, IC->uy, IC->uz), IC->r) != OK || _MarkDFSPathsToDescendants(theGraph) != OK || _JoinBicomps(theGraph) != OK || _AddAndMarkUnembeddedEdges(theGraph) != OK) return NOTOK; theGraphIC(theGraph)->minorType |= MINORTYPE_E3; return OK; } /**************************************************************************** _IsolateMinorE4() ****************************************************************************/ int _IsolateMinorE4(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); if (IC->px != IC->x) { if (_MarkPathAlongBicompExtFace(theGraph, IC->r, IC->w) != OK || _MarkPathAlongBicompExtFace(theGraph, IC->py, IC->r) != OK) return NOTOK; } else { if (_MarkPathAlongBicompExtFace(theGraph, IC->r, IC->px) != OK || _MarkPathAlongBicompExtFace(theGraph, IC->w, IC->r) != OK) return NOTOK; } // Note: The x-y path is already marked, due to identifying E as the type of non-planarity minor if (theGraph->functions->fpMarkDFSPath(theGraph, MIN3(IC->ux, IC->uy, IC->uz), MAX3(IC->ux, IC->uy, IC->uz)) != OK || _MarkDFSPathsToDescendants(theGraph) != OK || _JoinBicomps(theGraph) != OK || _AddAndMarkUnembeddedEdges(theGraph) != OK) return NOTOK; theGraphIC(theGraph)->minorType |= MINORTYPE_E4; return OK; } /**************************************************************************** _GetLeastAncestorConnection() This function searches for an ancestor of the current vertex v adjacent by a cycle edge to the given cutVertex or one of its DFS descendants appearing in a separated bicomp. The given cutVertex is assumed to be future pertinent such that either the leastAncestor or the lowpoint of a separated DFS child is less than v. We obtain the minimum possible connection from the cutVertex to an ancestor of v. ****************************************************************************/ int _GetLeastAncestorConnection(graphP theGraph, int cutVertex) { int child; int ancestor = gp_GetVertexLeastAncestor(theGraph, cutVertex); child = gp_GetVertexFuturePertinentChild(theGraph, cutVertex); while (gp_IsVertex(theGraph, child)) { if (gp_IsSeparatedDFSChild(theGraph, child) && ancestor > gp_GetVertexLowpoint(theGraph, child)) ancestor = gp_GetVertexLowpoint(theGraph, child); child = gp_GetVertexNextDFSChild(theGraph, cutVertex, child); } return ancestor; } /**************************************************************************** _FindUnembeddedEdgeToAncestor() This function searches for an ancestor of the current vertex v adjacent by a cycle edge to the given cutVertex or one of its DFS descendants appearing in a separated bicomp. The given cutVertex is assumed to be future pertinent such that either the leastAncestor or the lowpoint of a separated DFS child is less than v. We obtain the minimum possible connection from the cutVertex to an ancestor of v, then compute the descendant accordingly. Returns TRUE if found, FALSE otherwise. ****************************************************************************/ int _FindUnembeddedEdgeToAncestor(graphP theGraph, int cutVertex, int *pAncestor, int *pDescendant) { int child, foundChild; int ancestor = gp_GetVertexLeastAncestor(theGraph, cutVertex); child = gp_GetVertexFuturePertinentChild(theGraph, cutVertex); foundChild = NIL; while (gp_IsVertex(theGraph, child)) { if (gp_IsSeparatedDFSChild(theGraph, child) && ancestor > gp_GetVertexLowpoint(theGraph, child)) { ancestor = gp_GetVertexLowpoint(theGraph, child); foundChild = child; } child = gp_GetVertexNextDFSChild(theGraph, cutVertex, child); } *pAncestor = ancestor; // If the least ancestor connection was direct, then return the cutVertex as the descendant if (ancestor == gp_GetVertexLeastAncestor(theGraph, cutVertex)) { *pDescendant = cutVertex; return TRUE; } // Otherwise find the descendant based on the separated child with least lowpoint return _FindUnembeddedEdgeToSubtree(theGraph, *pAncestor, foundChild, pDescendant); } /**************************************************************************** _FindUnembeddedEdgeToCurVertex() Given the current vertex v, we search for an edge connecting v to either a given pertinent vertex W or one of its DFS descendants in the subtree indicated by the the last pertinent child biconnected component. Returns TRUE if founds, FALSE otherwise. ****************************************************************************/ int _FindUnembeddedEdgeToCurVertex(graphP theGraph, int cutVertex, int *pDescendant) { if (gp_IsEdge(theGraph, gp_GetVertexPertinentEdge(theGraph, cutVertex))) { *pDescendant = cutVertex; return TRUE; } else { int subtreeRoot = gp_GetVertexFirstPertinentRootChild(theGraph, cutVertex); return _FindUnembeddedEdgeToSubtree(theGraph, theGraphIC(theGraph)->v, subtreeRoot, pDescendant); } } /**************************************************************************** _FindUnembeddedEdgeToSubtree() Given the root vertex of a DFS subtree and an ancestor of that subtree, find a vertex in the subtree that is adjacent to the ancestor by a cycle edge. Returns TRUE if found, FALSE if not found. ****************************************************************************/ int _FindUnembeddedEdgeToSubtree(graphP theGraph, int ancestor, int SubtreeRoot, int *pDescendant) { int e, Z, ZNew; *pDescendant = NIL; /* If SubtreeRoot is a root copy, then we change to the DFS child in the DFS tree root edge of the bicomp rooted by SubtreeRoot. */ SubtreeRoot = gp_IsVirtualVertex(theGraph, SubtreeRoot) ? gp_GetDFSChildFromBicompRoot(theGraph, SubtreeRoot) : SubtreeRoot; /* Find the least descendant of the cut vertex incident to the ancestor. */ e = gp_GetVertexFwdEdgeList(theGraph, ancestor); while (gp_IsEdge(theGraph, e)) { if (gp_GetNeighbor(theGraph, e) >= SubtreeRoot) { if (gp_IsNotVertex(theGraph, *pDescendant) || *pDescendant > gp_GetNeighbor(theGraph, e)) *pDescendant = gp_GetNeighbor(theGraph, e); } e = gp_GetNextEdge(theGraph, e); if (e == gp_GetVertexFwdEdgeList(theGraph, ancestor)) e = NIL; } if (gp_IsNotVertex(theGraph, *pDescendant)) return FALSE; /* Make sure the identified descendant actually descends from the cut vertex */ Z = *pDescendant; while (Z != SubtreeRoot) { ZNew = gp_GetVertexParent(theGraph, Z); if (gp_IsNotVertex(theGraph, ZNew) || ZNew == Z) return FALSE; Z = ZNew; } /* Return successfully */ return TRUE; } /**************************************************************************** _MarkPathAlongBicompExtFace() Sets the visited flags of vertices and edges on the external face of a bicomp from startVert to endVert, inclusive, by following the 'first' edge link out of each visited vertex. ****************************************************************************/ int _MarkPathAlongBicompExtFace(graphP theGraph, int startVert, int endVert) { int Z, ZPrevLink, ZPrevEdge; /* Mark the start vertex (and if it is a root copy, mark the parent copy too. */ gp_SetVisited(theGraph, startVert); /* For each vertex visited after the start vertex, mark the vertex and the edge used to get there. Stop after marking the ending vertex. */ Z = startVert; ZPrevLink = 1; do { Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); ZPrevEdge = gp_GetEdgeByLink(theGraph, Z, ZPrevLink); gp_SetEdgeVisited(theGraph, ZPrevEdge); gp_SetEdgeVisited(theGraph, gp_GetTwin(theGraph, ZPrevEdge)); gp_SetVisited(theGraph, Z); } while (Z != endVert); return OK; } /**************************************************************************** _MarkDFSPath() Sets visited flags of vertices and edges from descendant to ancestor, including root copy vertices, and including the step of hopping from a root copy to its parent copy. At each vertex, the edge record is obtained whose type indicates that it leads to the DFS parent. An earlier implementation just used the DFS parent member of the vertex, but then had to find the edge to mark anyway. This method is more generalized because some extension algorithms reduce DFS paths to single DFS tree edges, in which case the edge record with type EDGE_TYPE_PARENT may indicate the DFS paent or an ancestor. ****************************************************************************/ int _MarkDFSPath(graphP theGraph, int ancestor, int descendant) { int e, parent; // If we are marking from a root (virtual) vertex upward, then go up to the // non-virtual parent copy before starting the loop if (gp_IsVirtualVertex(theGraph, descendant)) descendant = gp_GetVertexFromBicompRoot(theGraph, descendant); // Mark the lowest vertex (the one with the highest number). gp_SetVisited(theGraph, descendant); // Mark all ancestors of the lowest vertex, and the edges used to reach // them, up to the given ancestor vertex. while (descendant != ancestor) { // This loop traverses all vertices from descendant to ancestor, // including intervening bicomp roots (which are virtual vertices) if (descendant == NIL) return NOTOK; // If we are at a bicomp root, then ascend to its non-virtual // counterpart, so that can also be marked as visited. if (gp_IsVirtualVertex(theGraph, descendant)) { parent = gp_GetVertexFromBicompRoot(theGraph, descendant); } // If we are on a regular, non-virtual vertex then get the edge to the parent, // mark the edge, then fall through to the code that marks the parent vertex. else { // Scan the edges for the one marked as the DFS parent parent = NIL; e = gp_GetFirstEdge(theGraph, descendant); while (gp_IsEdge(theGraph, e)) { if (gp_GetEdgeType(theGraph, e) == EDGE_TYPE_PARENT) { parent = gp_GetNeighbor(theGraph, e); break; } e = gp_GetNextEdge(theGraph, e); } // Sanity check on the data structure integrity // The found parent may be a non-virtual or a virtual vertex. // If the latter, then it will be marked visited, and then the // next iteration of the loop will hop up to its non-virtual if (parent == NIL) return NOTOK; // Mark the edge gp_SetEdgeVisited(theGraph, e); gp_SetEdgeVisited(theGraph, gp_GetTwin(theGraph, e)); } // Mark the parent, then hop to the parent and reiterate gp_SetVisited(theGraph, parent); descendant = parent; } return OK; } /**************************************************************************** _MarkDFSPathsToDescendants() ****************************************************************************/ int _MarkDFSPathsToDescendants(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); if (theGraph->functions->fpMarkDFSPath(theGraph, IC->x, IC->dx) != OK || theGraph->functions->fpMarkDFSPath(theGraph, IC->y, IC->dy) != OK) return NOTOK; if (gp_IsVertex(theGraph, IC->dw)) if (theGraph->functions->fpMarkDFSPath(theGraph, IC->w, IC->dw) != OK) return NOTOK; if (gp_IsVertex(theGraph, IC->dz)) if (theGraph->functions->fpMarkDFSPath(theGraph, IC->w, IC->dz) != OK) return NOTOK; return OK; } /**************************************************************************** _AddAndMarkUnembeddedEdges() ****************************************************************************/ int _AddAndMarkUnembeddedEdges(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); if (_AddAndMarkEdge(theGraph, IC->ux, IC->dx) != OK || _AddAndMarkEdge(theGraph, IC->uy, IC->dy) != OK) return NOTOK; if (gp_IsVertex(theGraph, IC->dw)) if (_AddAndMarkEdge(theGraph, IC->v, IC->dw) != OK) return NOTOK; if (gp_IsVertex(theGraph, IC->dz)) if (_AddAndMarkEdge(theGraph, IC->uz, IC->dz) != OK) return NOTOK; return OK; } /**************************************************************************** _AddAndMarkEdge() Adds edge records for the edge (ancestor, descendant) and marks the edge records and vertex structures that represent the edge. ****************************************************************************/ int _AddAndMarkEdge(graphP theGraph, int ancestor, int descendant) { _AddBackEdge(theGraph, ancestor, descendant); /* Mark the edge so it is not deleted */ gp_SetVisited(theGraph, ancestor); gp_SetEdgeVisited(theGraph, gp_GetFirstEdge(theGraph, ancestor)); gp_SetEdgeVisited(theGraph, gp_GetFirstEdge(theGraph, descendant)); gp_SetVisited(theGraph, descendant); return OK; } /**************************************************************************** _AddBackEdge() This function transfers the edge records for the edge between the ancestor and descendant from the forward edge list of the ancestor to the adjacency lists of the ancestor and descendant. ****************************************************************************/ void _AddBackEdge(graphP theGraph, int ancestor, int descendant) { int fwdEdgeRec, backEdgeRec; /* We get the two edge records of the back edge to embed. */ fwdEdgeRec = gp_GetVertexFwdEdgeList(theGraph, ancestor); while (gp_IsEdge(theGraph, fwdEdgeRec)) { if (gp_GetNeighbor(theGraph, fwdEdgeRec) == descendant) break; fwdEdgeRec = gp_GetNextEdge(theGraph, fwdEdgeRec); if (fwdEdgeRec == gp_GetVertexFwdEdgeList(theGraph, ancestor)) fwdEdgeRec = NIL; } if (gp_IsNotEdge(theGraph, fwdEdgeRec)) { #ifdef DEBUG NOTOK; #endif return; } backEdgeRec = gp_GetTwin(theGraph, fwdEdgeRec); /* The forward edge record is removed from the fwdEdgeList of the ancestor. */ if (gp_GetVertexFwdEdgeList(theGraph, ancestor) == fwdEdgeRec) { if (gp_GetNextEdge(theGraph, fwdEdgeRec) == fwdEdgeRec) gp_SetVertexFwdEdgeList(theGraph, ancestor, NIL); else gp_SetVertexFwdEdgeList(theGraph, ancestor, gp_GetNextEdge(theGraph, fwdEdgeRec)); } gp_SetNextEdge(theGraph, gp_GetPrevEdge(theGraph, fwdEdgeRec), gp_GetNextEdge(theGraph, fwdEdgeRec)); gp_SetPrevEdge(theGraph, gp_GetNextEdge(theGraph, fwdEdgeRec), gp_GetPrevEdge(theGraph, fwdEdgeRec)); /* The forward edge record is added to the adjacency list of the ancestor. */ gp_SetPrevEdge(theGraph, fwdEdgeRec, NIL); gp_SetNextEdge(theGraph, fwdEdgeRec, gp_GetFirstEdge(theGraph, ancestor)); gp_SetPrevEdge(theGraph, gp_GetFirstEdge(theGraph, ancestor), fwdEdgeRec); gp_SetFirstEdge(theGraph, ancestor, fwdEdgeRec); /* The back edge record is added to the adjacency list of the descendant. */ gp_SetPrevEdge(theGraph, backEdgeRec, NIL); gp_SetNextEdge(theGraph, backEdgeRec, gp_GetFirstEdge(theGraph, descendant)); gp_SetPrevEdge(theGraph, gp_GetFirstEdge(theGraph, descendant), backEdgeRec); gp_SetFirstEdge(theGraph, descendant, backEdgeRec); gp_SetNeighbor(theGraph, backEdgeRec, ancestor); } /**************************************************************************** _DeleteUnmarkedVerticesAndEdges() For each vertex, traverse its adjacency list and delete all unvisited edges. ****************************************************************************/ int _DeleteUnmarkedVerticesAndEdges(graphP theGraph) { int v, e, eNext; /* All of the forward and back edge records of all of the "back" edges were removed from the adjacency lists in the planarity algorithm preprocessing. We now put them back into the adjacency lists (and we do not mark them), so they can be properly deleted below. */ for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { while (gp_IsEdge(theGraph, e = gp_GetVertexFwdEdgeList(theGraph, v))) _AddBackEdge(theGraph, v, gp_GetNeighbor(theGraph, e)); } /* Now we delete all unmarked edges. We don't delete vertices from the embedding, but the ones we should delete will become degree zero. */ for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { e = gp_GetFirstEdge(theGraph, v); while (gp_IsEdge(theGraph, e)) { eNext = gp_GetNextEdge(theGraph, e); if (!gp_GetEdgeVisited(theGraph, e)) gp_DeleteEdge(theGraph, e); e = eNext; } } return OK; } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/planarityRelated/graphNonplanar.c000066400000000000000000001042411522057144000317200ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #define GRAPHNONPLANAR_C // This source file implements subroutines of the main graph planarity method #include "../planarityRelated/graphPlanarity.h" #include "../planarityRelated/graphPlanarity.private.h" /* Imported functions */ extern void _InitIsolatorContext(graphP theGraph); extern int _ClearAllVisitedFlagsInBicomp(graphP theGraph, int BicompRoot); extern int _ClearObstructionMarksInBicomp(graphP theGraph, int BicompRoot); extern int _HideInternalEdges(graphP theGraph, int vertex); extern int _RestoreInternalEdges(graphP theGraph, int stackBottom); // extern int _OrientVerticesInEmbedding(graphP theGraph); extern int _OrientVerticesInBicomp(graphP theGraph, int BicompRoot, int PreserveSigns); /* Private functions (exported to system) */ int _ChooseTypeOfNonplanarityMinor(graphP theGraph, int v, int R); int _InitializeNonplanarityContext(graphP theGraph, int v, int R); int _GetNeighborOnExtFace(graphP theGraph, int curVertex, int *pPrevLink); void _FindActiveVertices(graphP theGraph, int R, int *pX, int *pY); int _FindPertinentVertex(graphP theGraph); int _SetVertexTypesForMarkingXYPath(graphP theGraph); int _PopAndUnmarkVerticesAndEdges(graphP theGraph, int Z, int stackBottom); int _MarkHighestXYPath(graphP theGraph); int _MarkLowestXYPath(graphP theGraph); int _MarkClosestXYPath(graphP theGraph, int targetVertex); int _MarkZtoRPath(graphP theGraph); int _FindFuturePertinenceBelowXYPath(graphP theGraph); /**************************************************************************** _gp_GetObstructionMinorType() ****************************************************************************/ unsigned gp_GetObstructionMinorType(graphP theGraph) { if (theGraph == NULL || theGraphIC(theGraph) == NULL) return MINORTYPE_NONE; return theGraphIC(theGraph)->minorType; } /**************************************************************************** _ChooseTypeOfNonplanarityMinor() ****************************************************************************/ int _ChooseTypeOfNonplanarityMinor(graphP theGraph, int v, int R) { int W, Px, Py, Z; /* Create the initial non-planarity minor state in the isolator context */ if (_InitializeNonplanarityContext(theGraph, v, R) != OK) return NOTOK; R = theGraphIC(theGraph)->r; W = theGraphIC(theGraph)->w; /* If the root copy is not a root copy of the current vertex v, then the Walkdown terminated because it couldn't find a viable path along a child bicomp, which is Minor A. */ if (gp_GetVertexFromBicompRoot(theGraph, R) != v) { theGraphIC(theGraph)->minorType |= MINORTYPE_A; return OK; } /* If W has a pertinent and future pertinent child bicomp, then we've found Minor B */ // NOTE: Each pertinent root is stored as the DFS child with which it is // associated, so we test gp_IsVertex, not gp_IsVirtualVertex here. if (gp_IsVertex(theGraph, gp_GetVertexPertinentRootsList(theGraph, W))) { if (gp_GetVertexLowpoint(theGraph, gp_GetVertexLastPertinentRootChild(theGraph, W)) < v) { theGraphIC(theGraph)->minorType |= MINORTYPE_B; return OK; } } /* Find the highest obstructing X-Y path */ if (_MarkHighestXYPath(theGraph) != OK || theGraphIC(theGraph)->py == NIL) return NOTOK; Px = theGraphIC(theGraph)->px; Py = theGraphIC(theGraph)->py; /* If either point of attachment is 'high' (P_x closer to R than X or P_y closer to R than Y along external face), then we've matched Minor C. */ if (gp_GetObstructionMark(theGraph, Px) == ANYVERTEX_OBSTRUCTIONMARK_HIGH_RXW || gp_GetObstructionMark(theGraph, Py) == ANYVERTEX_OBSTRUCTIONMARK_HIGH_RYW) { theGraphIC(theGraph)->minorType |= MINORTYPE_C; return OK; } /* For Minor D, we search for a path from an internal vertex Z along the X-Y path up to the root R of the bicomp. */ if (_MarkZtoRPath(theGraph) != OK) return NOTOK; if (gp_IsVertex(theGraph, theGraphIC(theGraph)->z)) { theGraphIC(theGraph)->minorType |= MINORTYPE_D; return OK; } /* For Minor E, we search for an future pertinent vertex Z below the points of attachment of the X-Y path */ Z = _FindFuturePertinenceBelowXYPath(theGraph); if (gp_IsVertex(theGraph, Z)) { theGraphIC(theGraph)->z = Z; theGraphIC(theGraph)->minorType |= MINORTYPE_E; return OK; } return NOTOK; } /**************************************************************************** _InitializeNonplanarityContext() This method finds the stopping vertices X and Y, and the pertinent vertex W of a bicomp rooted by vertex R. If R is NIL, the routine first determines which bicomp produced non-planarity condition. If the stack is non-empty, then R is on the top of the stack. Otherwise, an unembedded edge from the fwdEdgeList of vertex v is used in combination with the sortedDFSChildList of v to determine R. If the parameter R was not NIL, then this method assumes it must operate only on the bicomp rooted by R, and it also assumes that the caller has not cleared the visited flags in the bicomp, so they are cleared. This routine imparts consistent orientation to all vertices in bicomp R since several subroutines count on this. The edge signs are preserved so that the original orientations of all vertices can be restored. If the vertices of the embedding are already consistently oriented, then this operation simply has no effect. Finally, in the bicomp R, the vertex types of all non-root vertices on the external face are classified according to whether or not they are closer to the root R than X and Y along the external face paths (R X W) and (R Y W). ****************************************************************************/ int _InitializeNonplanarityContext(graphP theGraph, int v, int R) { // Blank out the isolator context, then assign the input graph reference // and the current vertext v into the context. _InitIsolatorContext(theGraph); theGraphIC(theGraph)->v = v; // The bicomp root provided was the one on which the WalkDown was performed, // but in the case of Minor A, the central bicomp of the minor is at the top // of the stack, so R must be changed to that value. if (sp_NonEmpty(theGraph->theStack)) { // The top of stack has the pair R and 0/1 direction Walkdown traversal proceeds from R // Need only R, so pop and discard the direction, then pop R sp_Pop2_Discard1(theGraph->theStack, R); } theGraphIC(theGraph)->r = R; // A number of subroutines require the main bicomp of the minor to be // consistently oriented and its visited flags clear. if (_OrientVerticesInBicomp(theGraph, R, 1) != OK) { return NOTOK; } if (_ClearAllVisitedFlagsInBicomp(theGraph, R) != OK) return NOTOK; // Now we find the active vertices along both external face paths // extending from R. _FindActiveVertices(theGraph, R, &theGraphIC(theGraph)->x, &theGraphIC(theGraph)->y); // Now, we obtain the pertinent vertex W on the lower external face // path between X and Y (that path that does not include R). theGraphIC(theGraph)->w = _FindPertinentVertex(theGraph); // Now we can classify the vertices along the external face of the bicomp // rooted at R as 'high RXW', 'low RXW', 'high RXY', 'low RXY' // NOTE: We do not need to set up for xy path identification when we // have minor A, which occurs when the parent copy vertex of // bicomp root R is a descendant of v (not v). if (gp_GetVertexFromBicompRoot(theGraph, R) == v) { if (_SetVertexTypesForMarkingXYPath(theGraph) != OK) return NOTOK; } // All work is done, so return success return OK; } /******************************************************************** _GetNeighborOnExtFace() Each vertex contains two 'link' index pointers that indicate the first and last adjacency list edges. If the vertex is on the external face, then these two edges are also on the external face. We want to take one of those edges to get to the next vertex on the external face. On input *pPrevLink indicates which link we followed to arrive at curVertex. On output *pPrevLink will be set to the link we follow to get into the next vertex. To get to the next vertex, we use the opposite link from the one used to get into curVertex. This takes us to an edge record. The twin of that edge record carries us to an edge record in the next vertex. At least one of the two links in that edge record will lead to a vertex node in G, which is the next vertex. Once we arrive at the next vertex, at least one of its links will lead back to the edge record, and that link becomes the output value of *pPrevLink. NOTE: This method intentionally ignores the extFace optimization links. It is invoked when the "real" external face must be traversed and hence when the constant time guarantee is not needed from the extFace short-circuit that connects the bicomp root to the first active vertices along each external face path emanating from the bicomp root. ********************************************************************/ int _GetNeighborOnExtFace(graphP theGraph, int curVertex, int *pPrevLink) { /* Exit curVertex from whichever link was not previously used to enter it */ int e = gp_GetEdgeByLink(theGraph, curVertex, 1 ^ (*pPrevLink)); int nextVertex = gp_GetNeighbor(theGraph, e); /* This if stmt assigns the new prev link that tells us which edge record was used to enter nextVertex (so that we exit from the opposing edge record). However, if we are in a singleton bicomp, then both links in nextVertex lead back to curVertex. We want the two edge records of a singleton bicomp to act like a cycle, so we just don't change the prev link in this case. But when nextVertex has more than one edge, we need to figure out whether the first edge or last edge (which are the two on the external face) was used to enter nextVertex so we can exit from the other one as traversal of the external face continues later. */ if (gp_GetFirstEdge(theGraph, nextVertex) != gp_GetLastEdge(theGraph, nextVertex)) *pPrevLink = gp_GetTwin(theGraph, e) == gp_GetFirstEdge(theGraph, nextVertex) ? 0 : 1; return nextVertex; } /**************************************************************************** _FindActiveVertices() Descends from the root of a bicomp R along both external face paths (which are indicated by the first and last edge records in R's adjacency list), returning the first active vertex appearing in each direction. ****************************************************************************/ void _FindActiveVertices(graphP theGraph, int R, int *pX, int *pY) { int XPrevLink = 1, YPrevLink = 0, v = theGraphIC(theGraph)->v; *pX = _GetNeighborOnExtFace(theGraph, R, &XPrevLink); *pY = _GetNeighborOnExtFace(theGraph, R, &YPrevLink); // For planarity algorithms, advance past inactive vertices // For outerplanarity algorithms, ignore the notion of inactive vertices // since all vertices must remain on the external face. if (!(gp_GetEmbedFlags(theGraph) & EMBEDFLAGS_OUTERPLANAR)) { gp_UpdateVertexFuturePertinentChild(theGraph, *pX, v); while (INACTIVE(theGraph, *pX, v)) { *pX = _GetNeighborOnExtFace(theGraph, *pX, &XPrevLink); gp_UpdateVertexFuturePertinentChild(theGraph, *pX, v); } gp_UpdateVertexFuturePertinentChild(theGraph, *pY, v); while (INACTIVE(theGraph, *pY, v)) { *pY = _GetNeighborOnExtFace(theGraph, *pY, &YPrevLink); gp_UpdateVertexFuturePertinentChild(theGraph, *pY, v); } } } /**************************************************************************** _FindPertinentVertex() Get the first vertex after x. Since x was obtained using a prevlink of 1 on r, we use the same prevlink so we don't go back to R. Then, we proceed around the lower path until we find a vertex W that either has pertinent child bicomps or is directly adjacent to the current vertex v. ****************************************************************************/ int _FindPertinentVertex(graphP theGraph) { int W = theGraphIC(theGraph)->x, WPrevLink = 1; W = _GetNeighborOnExtFace(theGraph, W, &WPrevLink); while (W != theGraphIC(theGraph)->y) { if (PERTINENT(theGraph, W)) return W; W = _GetNeighborOnExtFace(theGraph, W, &WPrevLink); } return NIL; } /**************************************************************************** _SetVertexTypesForMarkingXYPath() Label the vertices along the external face of the bicomp rooted at R as 'high RXW', 'low RXW', 'high RXY', 'low RXY' ****************************************************************************/ int _SetVertexTypesForMarkingXYPath(graphP theGraph) { int R, X, Y, W, Z, ZPrevLink, ZType; // Unpack the context for efficiency of loops R = theGraphIC(theGraph)->r; X = theGraphIC(theGraph)->x; Y = theGraphIC(theGraph)->y; W = theGraphIC(theGraph)->w; // Ensure basic preconditions of this routine are met if (gp_IsNotVirtualVertex(theGraph, R) || gp_IsNotVertex(theGraph, X) || gp_IsNotVertex(theGraph, Y) || gp_IsNotVertex(theGraph, W)) { return NOTOK; } // Clear the type member of each vertex in the bicomp if (_ClearObstructionMarksInBicomp(theGraph, R) != OK) return NOTOK; // Traverse from R to W in the X direction ZPrevLink = 1; Z = _GetNeighborOnExtFace(theGraph, R, &ZPrevLink); ZType = ANYVERTEX_OBSTRUCTIONMARK_HIGH_RXW; while (Z != W) { if (Z == X) ZType = ANYVERTEX_OBSTRUCTIONMARK_LOW_RXW; gp_ResetObstructionMark(theGraph, Z, ZType); Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); } // Traverse from R to W in the Y direction ZPrevLink = 0; Z = _GetNeighborOnExtFace(theGraph, R, &ZPrevLink); ZType = ANYVERTEX_OBSTRUCTIONMARK_HIGH_RYW; while (Z != W) { if (Z == Y) ZType = ANYVERTEX_OBSTRUCTIONMARK_LOW_RYW; gp_ResetObstructionMark(theGraph, Z, ZType); Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); } return OK; } /**************************************************************************** _PopAndUnmarkVerticesAndEdges() Pop all vertex/edge pairs from the top of the stack up to a terminating vertex Z and mark as unvisited. If Z is NIL, then all vertex/edge pairs are popped and marked as unvisited. The stackBottom indicates where other material besides the vertex/edge pairs may appear. ****************************************************************************/ int _PopAndUnmarkVerticesAndEdges(graphP theGraph, int Z, int stackBottom) { int V, e; // Pop vertex/edge pairs until all have been popped from the stack, // and all that's left is what was under the pairs, or until... while (sp_GetCurrentSize(theGraph->theStack) > stackBottom) { sp_Pop(theGraph->theStack, V); // If we pop the terminating vertex Z, then put it back and break if (V == Z) { sp_Push(theGraph->theStack, V); break; } // Otherwise, pop the edge part of the vertex/edge pair sp_Pop(theGraph->theStack, e); // Now unmark the vertex and edge (i.e. revert to "unvisited") gp_ClearVisited(theGraph, V); gp_ClearEdgeVisited(theGraph, e); gp_ClearEdgeVisited(theGraph, gp_GetTwin(theGraph, e)); } return OK; } /**************************************************************************** _MarkHighestXYPath() Sets the visited flags on the highest X-Y path, i.e. the one closest to the root vertex R of the biconnected component containing X and Y as well as a pertinent vertex W that the Walkdown could not reach due to the future pertinent vertices X and Y being along both external face paths emanating from the root R. The caller receives an OK result if the method succeeded in operating or NOTOK on an internal failure. However, there may or may not be any X-Y path, in which case no visitation flags are set and the return result is still OK because the caller must decide whether the absence of an X-Y path is an operational error. This method also sets the isolator context's points of attachment on the external face of the marked X-Y path, if there was an X-Y path. So, the caller can also use this call to decide if there was an X-Y path by testing whether theGraphIC(theGraph)->px and py have been set to non-NIL values. ****************************************************************************/ int _MarkHighestXYPath(graphP theGraph) { return _MarkClosestXYPath(theGraph, theGraphIC(theGraph)->r); } /**************************************************************************** _MarkLowestXYPath() Sets the visited flags on the lowest X-Y path, i.e. the one closest to the pertinent vertex W that the Walkdown could not reach due to future pertinent vertices X and Y along both external face paths emanating from the root R of the biconnected component containing W, X and Y. The caller receives an OK result if the method succeeded in operating or NOTOK on an internal failure. However, there may or may not be any X-Y path, in which case no visitation flags are set and the return result is still OK because the caller must decide whether the absence of an X-Y path is an operational error. This method also sets the isolator context's points of attachment on the external face of the marked X-Y path, if there was an X-Y path. So, the caller can also use this call to decide if there was an X-Y path by testing whether theGraphIC(theGraph)->px and py have been set to non-NIL values. ****************************************************************************/ int _MarkLowestXYPath(graphP theGraph) { return _MarkClosestXYPath(theGraph, theGraphIC(theGraph)->w); } /**************************************************************************** _MarkClosestXYPath() This method searches for and marks the X-Y path in the bicomp rooted by R that is either closest to R (highest) or closest to W (lowest). This method will return NOTOK if the targetVertex parameter is other than R or W. The closest X-Y path is the path through the inside of the bicomp that only attaches to the external face at its two endpoint vertices and those endpoints are closer along the external face path emanating from the targetVertex than the attachment points of any other X-Y path. This method returns NOTOK if there is an internal processing error and otherwise it returns OK. If there is no X-Y path, the method still returns OK to indicate no internal failures, but on return the caller can detect whether there was an X-Y path by testing whether the attachment points in the isolator context have been set to non-NIL values. Specifically, test whether theGraphIC(theGraph)->px and py have been set to non-NIL values. The caller must decide whether the absence of an X-Y path is an error. For example, in core planarity, the proof of correctness guarantees an X-Y path exists by the time this method is called, so that caller would decide to return NOTOK since there should be an X-Y path. If there is an X-Y path, it is marked using the visited flags on the vertices and edges. PRECONDITION: During non-planarity context initialization, the vertices along the external face (other than R and W) have been classified as 'high RXW', 'low RXW', 'high RXY', or 'low RXY'. Once the vertices have been categorized, we proceed with trying to set the visitation flags of vertices and edges. First, we remove all edges incident to the targetVertex, except the two edges that join it to the external face. The result is that the targetVertex and its two remaining edges are a 'corner' in the external face but also in a single proper face whose boundary includes the X-Y path with the closest attachment points. Thus, we simply need to walk this proper face to find the desired X-Y path. Note, however, that the resulting face boundary may have attached cut vertices. Any such separable component contains a vertex neighbor of the targetVertex, but the edge to the targetVertex has been temporarily hidden. The algorithm removes loops of vertices and edges along the proper face so that only the desired path is identified. To walk the proper face containing the targetVertex, we first identify an edge record that will be considered to be the one used to enter the targetVertex. When the first loop iteration exits the targetVertex, it comes out on the RXW side (even though it may be an internal vertex not marked RXW). Then we take either the next edge (if targetVertex==W) or previous edge (if targetVertex==R) at every subsequent corner to determine the edge record to use to exit the vertex. Then, we use the twin of the exit edge record to determine the edge record to use to enter the next vertex. For each vertex, we mark as visited the vertex as well as both edge records of the edge used to enter the vertex. We also push the visited vertices and edges onto a stack. Each time the traversal lands on an external face vertex on the RXW side, it is recorded as a candidate point of attachment Px. We also pop and unmark all previously visited vertices and edges because they are now known to not be part of the internal X-Y path after encountering the point of attachment. Instead, these preceding edges and vertices were part of a path parallel to the external face that does not obstruct the space between R and W inside the bicomp. As we walk the proper face, we keep track of the last vertex P_x we visited of type RXW (high or low). If we encounter antipodalVertex of the targetVertex (i.e., W if the targetVertex is R, or R if the targetVertex is W), then there is no obstructing X-Y path since we removed only edges incident to the targetVertex, so we pop the stack unmarking everything then clear the X-Y path points of attachment in the isolator context so the caller will know that no X-Y path was found (and then we return OK since there was no internal error). If, during the traversal, we encounter a vertex Z previously visited, then we pop the stack, unmarking the vertices and edges popped, until we find the prior occurrence of Z on the stack. This is because we have traversed a path that would connect back to the targetVertex had we not hidden the internal edges of the targetVertex. Otherwise, the first time we encounter a vertex of type 'RYW', we stop because the obstructing X-Y path has been marked visited and its points of attachment to the external face have been found. This second point of attachment Py is stored in the isolator context. Once the X-Y path is identified (or once we have found that there is no X-Y path), we restore the previously hidden edges incident to the targetVertex. This method uses the stack, but it preserves any prior content. The stack space used is no greater than 3N. The first N accounts for hiding the edges incident to the targetVertex. The other 2N accounts for the fact that each iteration of the main loop visits a vertex, pushing its index and the location of an edge record. If a vertex is encountered that is already on the stack, then it is not pushed again (and in fact part of the stack is removed). Returns OK on successful operation and NOTOK on internal failure. Also, if an X-Y path is found (which will be the closest), then the graph isolator context contains its attachment points on the external face of the bicomp rooted by R, and the edges and vertices in the X-Y path will have been marked visited. ****************************************************************************/ int _MarkClosestXYPath(graphP theGraph, int targetVertex) { int e, Z; int R, W, antipodalVertex; int stackBottom1, stackBottom2; /* Initialization */ R = theGraphIC(theGraph)->r; W = theGraphIC(theGraph)->w; theGraphIC(theGraph)->px = theGraphIC(theGraph)->py = NIL; /* This method only makes sense for a targetVertex of R or W */ if (targetVertex != R && targetVertex != W) return NOTOK; /* The vertex opposite the targetVertex is needed to detect when there is no X-Y path */ antipodalVertex = targetVertex == R ? W : R; /* Save the stack bottom before we start hiding internal edges, so we will know how many edges to restore */ stackBottom1 = sp_GetCurrentSize(theGraph->theStack); /* Remove the internal edges incident to targetVertex (R or W) */ if (_HideInternalEdges(theGraph, targetVertex) != OK) return NOTOK; /* Now we're going to use the stack to collect the vertices of potential * X-Y paths, so we need to store where the hidden internal edges are * located because we must, at times, pop the collected vertices if * the path being collected doesn't work out. */ stackBottom2 = sp_GetCurrentSize(theGraph->theStack); /* Walk the proper face containing targetVertex to find and mark the closest X-Y path. */ Z = targetVertex; // Now we will get the edge considered to be the one used to enter // the targetVertex. This will be an edge on the RYW side, and the // first line of the loop code will get the previous or next edge // that will be used to exit the targetVertex on the RXW side of the // bicomp (that one operation to get previous or next, circular, will // switch sides because all internal edges of targetVertex are hidden). e = targetVertex == R ? gp_GetLastEdge(theGraph, R) : gp_GetFirstEdge(theGraph, W); while (gp_GetObstructionMark(theGraph, Z) != ANYVERTEX_OBSTRUCTIONMARK_HIGH_RYW && gp_GetObstructionMark(theGraph, Z) != ANYVERTEX_OBSTRUCTIONMARK_LOW_RYW) { /* Advance e and Z along the proper face containing the targetVertex */ // Get the opposing edge of the corner at vertex Z, as the edge to exit Z e = targetVertex == R ? gp_GetPrevEdgeCircular(theGraph, e) : gp_GetNextEdgeCircular(theGraph, e); // Now use the exit edge record to get the next Z to visit Z = gp_GetNeighbor(theGraph, e); // And get the entry edge record of the new Z being visited e = gp_GetTwin(theGraph, e); /* If Z is already visited, then pop everything since the last time we visited Z because its all part of a separable component. */ if (gp_GetVisited(theGraph, Z)) { if (_PopAndUnmarkVerticesAndEdges(theGraph, Z, stackBottom2) != OK) return NOTOK; } /* If we have not visited this vertex before... */ else { /* If we find the antipodalVertex of the targetVertex (W if R, R if W), then there is no X-Y path. Never happens for Kuratowski subgraph isolator, but this routine is also used to test for certain X-Y paths. So, we clean up and bail out in that case. */ if (Z == antipodalVertex) { if (_PopAndUnmarkVerticesAndEdges(theGraph, NIL, stackBottom2) != OK) return NOTOK; break; } /* If we found another vertex along the RXW path, then blow off all the vertices we visited so far because they're not part of the obstructing path */ if (gp_GetObstructionMark(theGraph, Z) == ANYVERTEX_OBSTRUCTIONMARK_HIGH_RXW || gp_GetObstructionMark(theGraph, Z) == ANYVERTEX_OBSTRUCTIONMARK_LOW_RXW) { theGraphIC(theGraph)->px = Z; if (_PopAndUnmarkVerticesAndEdges(theGraph, NIL, stackBottom2) != OK) return NOTOK; } /* Push the current vertex onto the stack of vertices visited since the last RXW vertex was encountered */ sp_Push(theGraph->theStack, e); sp_Push(theGraph->theStack, Z); /* Mark the vertex Z as visited as well as its edge of entry (except the entry edge for P_x).*/ gp_SetVisited(theGraph, Z); if (Z != theGraphIC(theGraph)->px) { gp_SetEdgeVisited(theGraph, e); gp_SetEdgeVisited(theGraph, gp_GetTwin(theGraph, e)); } /* If we found an RYW vertex, then we have successfully finished identifying the closest X-Y path, so we record the point of attachment and break the loop. */ if (gp_GetObstructionMark(theGraph, Z) == ANYVERTEX_OBSTRUCTIONMARK_HIGH_RYW || gp_GetObstructionMark(theGraph, Z) == ANYVERTEX_OBSTRUCTIONMARK_LOW_RYW) { theGraphIC(theGraph)->py = Z; break; } } } /* Remove any remaining vertex-edge pairs on the top of the stack, then Restore the internal edges incident to R that were previously removed. */ sp_SetCurrentSize(theGraph->theStack, stackBottom2); if (_RestoreInternalEdges(theGraph, stackBottom1) != OK) return NOTOK; /* Return the result */ if (!gp_IsVertex(theGraph, theGraphIC(theGraph)->py)) theGraphIC(theGraph)->px = NIL; return OK; } /**************************************************************************** _MarkZtoRPath() This function assumes that _MarkHighestXYPath() has already been called, which marked as visited the vertices and edges along the X-Y path. We begin at the point of attachment P_x, take its last edge and traverse the predecessor edges until we find one marked visited, which leads to the first internal vertex along the X-Y path. We begin with this vertex (and its edge of entry), and we run until we find P_y. For each internal vertex Z and its edge of entry ZPrevEdge, we take the predecessor edge record of ZPrevEdge, called ZNextEdge. If ZNextEdge is marked visited then it is along the X-Y path, so we use it to exit Z and go to the next vertex on the X-Y path. If ZNextEdge is not visited, then when _MarkHighestXYPath() ran, it exited Z from ZNextedge, then eventually reentered Z. In other words, Z became a cut vertex when we removed the internal edges incident to R. Thus, ZNextEdge indicates the first edge in an internal path to R. When we find an unvisited ZNextEdge, we stop running the X-Y path and instead begin marking the Z to R path. We move to successive vertices using a twin edge record then its predecessor in the adjacency list, only this time we have not removed the internal edges incident to R, so this technique does eventually lead us all the way to R. If we do not find an unvisited ZNextEdge for any vertex Z on the X-Y path and inside the bicomp, then there is no Z to R path, so we return. Returns OK if a Z-to-R path has been marked or if it has been found that there is not a Z-to-R path; returns NOTOK on error ****************************************************************************/ int _MarkZtoRPath(graphP theGraph) { int ZPrevEdge, ZNextEdge, Z, R, Px, Py; /* Initialize */ R = theGraphIC(theGraph)->r; Px = theGraphIC(theGraph)->px; Py = theGraphIC(theGraph)->py; theGraphIC(theGraph)->z = NIL; /* Begin at Px and search its adjacency list for the edge leading to the first internal vertex of the X-Y path. */ Z = Px; ZNextEdge = gp_GetLastEdge(theGraph, Z); while (ZNextEdge != gp_GetFirstEdge(theGraph, Z)) { if (gp_GetEdgeVisited(theGraph, ZNextEdge)) break; ZNextEdge = gp_GetPrevEdge(theGraph, ZNextEdge); } if (!gp_GetEdgeVisited(theGraph, ZNextEdge)) return NOTOK; /* For each internal vertex Z, determine whether it has a path to root. */ while (gp_GetEdgeVisited(theGraph, ZNextEdge)) { ZPrevEdge = gp_GetTwin(theGraph, ZNextEdge); ZNextEdge = gp_GetPrevEdgeCircular(theGraph, ZPrevEdge); } ZPrevEdge = gp_GetTwin(theGraph, ZNextEdge); Z = gp_GetNeighbor(theGraph, ZPrevEdge); /* If there is no Z to R path, return */ if (Z == Py) return OK; /* Otherwise, store Z in the isolation context */ theGraphIC(theGraph)->z = Z; /* Walk the proper face starting with (Z, ZNextEdge) until we reach R, marking the vertices and edges encountered along the way, then Return OK. */ while (Z != R) { /* If we ever encounter a non-internal vertex (other than the root R), then corruption has occurred, so we return NOTOK */ if (gp_GetObstructionMark(theGraph, Z) != ANYVERTEX_OBSTRUCTIONMARK_UNMARKED) return NOTOK; /* Go to the next vertex indicated by ZNextEdge */ Z = gp_GetNeighbor(theGraph, ZNextEdge); /* Mark the next vertex and the edge leading to it as visited. */ gp_SetEdgeVisited(theGraph, ZNextEdge); gp_SetEdgeVisited(theGraph, ZPrevEdge); gp_SetVisited(theGraph, Z); /* Go to the next edge in the proper face */ ZNextEdge = gp_GetPrevEdgeCircular(theGraph, ZPrevEdge); ZPrevEdge = gp_GetTwin(theGraph, ZNextEdge); } /* Found Z to R path, so indicate as much to caller */ return OK; } /**************************************************************************** _FindFuturePertinenceBelowXYPath() Get a future pertinent vertex along the lower external face path between the points of attachment P_x and P_y of a 'low' X-Y Path. NOTE: By the time this function is called, Px and Py have already been found to be at or below X and Y. ****************************************************************************/ int _FindFuturePertinenceBelowXYPath(graphP theGraph) { int Z = theGraphIC(theGraph)->px, ZPrevLink = 1, Py = theGraphIC(theGraph)->py, v = theGraphIC(theGraph)->v; Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); while (Z != Py) { gp_UpdateVertexFuturePertinentChild(theGraph, Z, v); if (FUTUREPERTINENT(theGraph, Z, v)) return Z; Z = _GetNeighborOnExtFace(theGraph, Z, &ZPrevLink); } return NIL; } graphOuterplanarObstruction.c000066400000000000000000000163111522057144000344410ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/planarity/c/graphLib/planarityRelated/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "graphOuterplanarity.h" #include "graphOuterplanarity.private.h" /* Imported functions */ extern void _ClearAllVisitedFlagsInGraph(graphP); extern int _JoinBicomps(graphP theGraph); extern int _InitializeNonplanarityContext(graphP theGraph, int v, int R); extern int _MarkHighestXYPath(graphP theGraph); // extern int _FindUnembeddedEdgeToAncestor(graphP theGraph, int cutVertex, int *pAncestor, int *pDescendant); extern int _FindUnembeddedEdgeToCurVertex(graphP theGraph, int cutVertex, int *pDescendant); extern int _FindUnembeddedEdgeToSubtree(graphP theGraph, int ancestor, int SubtreeRoot, int *pDescendant); extern int _MarkPathAlongBicompExtFace(graphP theGraph, int startVert, int endVert); extern int _AddAndMarkEdge(graphP theGraph, int ancestor, int descendant); extern int _DeleteUnmarkedVerticesAndEdges(graphP theGraph); /* Private function declarations (exported to system) */ int _IsolateOuterplanarObstruction(graphP theGraph, int v, int R); int _ChooseTypeOfNonOuterplanarityMinor(graphP theGraph, int v, int R); int _IsolateOuterplanarityObstructionA(graphP theGraph); int _IsolateOuterplanarityObstructionB(graphP theGraph); int _IsolateOuterplanarityObstructionE(graphP theGraph); /**************************************************************************** _ChooseTypeOfNonOuterplanarityMinor() A constant time implementation is easily feasible but only constant amortized time is needed for the outerplanarity obstruction isolation, which also benefits from having the bicomp rooted by R oriented. If an extension algorithm requires constant actual time, then this function should not be used and instead the minor should be decided without orienting the bicomp. ****************************************************************************/ int _ChooseTypeOfNonOuterplanarityMinor(graphP theGraph, int v, int R) { int W; // Create the initial non-outerplanarity obstruction isolator state. if (_InitializeNonplanarityContext(theGraph, v, R) != OK) return NOTOK; R = theGraphIC(theGraph)->r; W = theGraphIC(theGraph)->w; // If the root copy is not a root copy of the current vertex v, // then the Walkdown terminated on a descendant bicomp, which is Minor A. if (gp_GetVertexFromBicompRoot(theGraph, R) != v) { theGraphIC(theGraph)->minorType |= MINORTYPE_A; return OK; } // If W has a pertinent child bicomp, then we've found Minor B. // Notice this is different from planarity, in which minor B is indicated // only if the pertinent child bicomp is also future pertinent. // NOTE: Each pertinent root is stored as the DFS child with which it is // associated, so we test gp_IsVertex, not gp_IsVirtualVertex here. if (gp_IsVertex(theGraph, gp_GetVertexPertinentRootsList(theGraph, W))) { theGraphIC(theGraph)->minorType |= MINORTYPE_B; return OK; } // The only other result is minor E (we will search for the X-Y path later) theGraphIC(theGraph)->minorType |= MINORTYPE_E; return OK; } /**************************************************************************** _IsolateOuterplanarObstruction() ****************************************************************************/ int _IsolateOuterplanarObstruction(graphP theGraph, int v, int R) { int RetVal; /* A subgraph homeomorphic to K_{2,3} or K_4 will be isolated by using the visited flags, set=keep edge/vertex and clear=omit. Here we initialize to omit all, then we subsequently set visited on all edges and vertices in the homeomorph. */ _ClearAllVisitedFlagsInGraph(theGraph); /* Next we determineg which of the non-outerplanarity Minors was encountered and the principal bicomp on which the isolator will focus attention. */ if (_ChooseTypeOfNonOuterplanarityMinor(theGraph, v, R) != OK) return NOTOK; /* Find the path connecting the pertinent vertex w with the current vertex v */ if (theGraphIC(theGraph)->minorType & MINORTYPE_B) { isolatorContextP IC = theGraphIC(theGraph); int SubtreeRoot = gp_GetVertexLastPertinentRootChild(theGraph, IC->w); if (_FindUnembeddedEdgeToSubtree(theGraph, IC->v, SubtreeRoot, &IC->dw) != TRUE) return NOTOK; } else { isolatorContextP IC = theGraphIC(theGraph); if (_FindUnembeddedEdgeToCurVertex(theGraph, IC->w, &IC->dw) != TRUE) return NOTOK; } /* For minor E, we need to find and mark an X-Y path */ if (theGraphIC(theGraph)->minorType & MINORTYPE_E) { if (_MarkHighestXYPath(theGraph) != OK || theGraphIC(theGraph)->py == NIL) return NOTOK; } /* Call the appropriate isolator */ if (theGraphIC(theGraph)->minorType & MINORTYPE_A) RetVal = _IsolateOuterplanarityObstructionA(theGraph); else if (theGraphIC(theGraph)->minorType & MINORTYPE_B) RetVal = _IsolateOuterplanarityObstructionB(theGraph); else if (theGraphIC(theGraph)->minorType & MINORTYPE_E) RetVal = _IsolateOuterplanarityObstructionE(theGraph); else RetVal = NOTOK; /* Delete the unmarked edges and vertices, and return */ if (RetVal == OK) RetVal = _DeleteUnmarkedVerticesAndEdges(theGraph); return RetVal; } /**************************************************************************** _IsolateOuterplanarityObstructionA(): Isolate a K2,3 homeomorph ****************************************************************************/ int _IsolateOuterplanarityObstructionA(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); if (_MarkPathAlongBicompExtFace(theGraph, IC->r, IC->r) != OK || theGraph->functions->fpMarkDFSPath(theGraph, IC->v, IC->r) != OK || theGraph->functions->fpMarkDFSPath(theGraph, IC->w, IC->dw) != OK || _JoinBicomps(theGraph) != OK || _AddAndMarkEdge(theGraph, IC->v, IC->dw) != OK) return NOTOK; return OK; } /**************************************************************************** _IsolateOuterplanarityObstructionB(): Isolate a K2,3 homeomorph ****************************************************************************/ int _IsolateOuterplanarityObstructionB(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); if (_MarkPathAlongBicompExtFace(theGraph, IC->r, IC->r) != OK || theGraph->functions->fpMarkDFSPath(theGraph, IC->w, IC->dw) != OK || _JoinBicomps(theGraph) != OK || _AddAndMarkEdge(theGraph, IC->v, IC->dw) != OK) return NOTOK; return OK; } /**************************************************************************** _IsolateOuterplanarityObstructionE(): Isolate a K4 homeomorph ****************************************************************************/ int _IsolateOuterplanarityObstructionE(graphP theGraph) { isolatorContextP IC = theGraphIC(theGraph); if (_MarkPathAlongBicompExtFace(theGraph, IC->r, IC->r) != OK || theGraph->functions->fpMarkDFSPath(theGraph, IC->w, IC->dw) != OK || _JoinBicomps(theGraph) != OK || _AddAndMarkEdge(theGraph, IC->v, IC->dw) != OK) return NOTOK; return OK; } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/planarityRelated/graphOuterplanarity.h000066400000000000000000000015451522057144000330220ustar00rootroot00000000000000#ifndef GRAPHOUTERPLANARITY_H #define GRAPHOUTERPLANARITY_H /* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "graphPlanarity.h" #ifdef __cplusplus extern "C" { #endif // Create an Outerplanarity Graph, i.e., subclass a Planarity Graph by extending it // with the ability to perform planar graph embedding and obstruction isolation. #define OUTERPLANARITY_NAME "Outerplanarity" int gp_ExtendWith_Outerplanarity(graphP theGraph); int gp_Detach_Outerplanarity(graphP theGraph); /* Graph Flags: see gp_GetGraphFlags() GRAPHFLAGS_EXTENDEDWITH_OUTERPLANARITY is set by calling gp_ExtendWith_OuterPlanarity() This is automatically by gp_Embed() if not already done. */ #define GRAPHFLAGS_EXTENDEDWITH_OUTERPLANARITY 131072 #ifdef __cplusplus } #endif #endif graphOuterplanarity.private.h000066400000000000000000000006001522057144000344030ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/planarity/c/graphLib/planarityRelated/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #ifndef GRAPHOUTERPLANARITY_PRIVATE_H #define GRAPHOUTERPLANARITY_PRIVATE_H #include "graphPlanarity.private.h" #ifdef __cplusplus extern "C" { #endif // Currently nothing to add here. #ifdef __cplusplus } #endif #endif /* GRAPHPOUTERLANARITY_PRIVATE_H */ graphOuterplanarity_Extensions.c000066400000000000000000000042101522057144000351450ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/planarity/c/graphLib/planarityRelated/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "graphOuterplanarity.h" #include "graphOuterplanarity.private.h" #include /**************************************************************************** gp_ExtendWith_Outerplanarity() This function is intended to subclass a Planarity Graph by extending it with the outerplanar graph embedding and obstruction isolation capabilities. If the given graph has not already been extended with Planarity, then gp_ExtendWith_Planarity() is called. To use Outerplanarity during gp_Embed(), use EMBEDFLAGS_OUTERPLANAR. Returns OK for success, NOTOK for failure. ****************************************************************************/ int gp_ExtendWith_Outerplanarity(graphP theGraph) { if (theGraph == NULL || gp_GetN(theGraph) <= 0) return NOTOK; // If the Graph has already been extended with Outerplanarity, // then just return successfully if (gp_GetGraphFlags(theGraph) & GRAPHFLAGS_EXTENDEDWITH_OUTERPLANARITY) return OK; // Ensure theGraph is a Planarity Graph if (gp_ExtendWith_Planarity(theGraph) != OK) return NOTOK; // Allocate supporting data structures as needed // Perform "on success" operations theGraph->graphFlags |= GRAPHFLAGS_EXTENDEDWITH_OUTERPLANARITY; return OK; } /******************************************************************** gp_Detach_Outerplanarity() This function is intended to disinherit the outerplanar graph embedding and obstruction isolation feature by removing the extension from the graph, which also frees any outerplanarity-specific data structures. Clears GRAPHFLAGS_EXTENDEDWITH_OUTERPLANARITY after detaching support for Outerplanarity. Returns OK on success, NOTOK on failure ********************************************************************/ int gp_Detach_Outerplanarity(graphP theGraph) { // Free any data structures allocated by the ExtendWith function // Indicate successful detachment of Outerplanarity theGraph->graphFlags &= ~GRAPHFLAGS_EXTENDEDWITH_OUTERPLANARITY; return OK; } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/planarityRelated/graphPlanarity.h000066400000000000000000000054271522057144000317460ustar00rootroot00000000000000#ifndef GRAPHPLANARITY_H #define GRAPHPLANARITY_H /* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "../graphDFSUtils.h" #ifdef __cplusplus extern "C" { #endif // Create a Planarity Graph, i.e., subclass a DFSUtils Graph by extending it with // the ability to perform planar graph embedding and obstruction isolation. #define PLANARITY_NAME "Planarity" int gp_ExtendWith_Planarity(graphP theGraph); int gp_Detach_Planarity(graphP theGraph); /* Graph Flags: see gp_GetGraphFlags() GRAPHFLAGS_EXTENDEDWITH_PLANARITY is set by calling gp_ExtendWith_Planarity() This is automatically by gp_Embed() if not already done. */ #define GRAPHFLAGS_EXTENDEDWITH_PLANARITY 65536 // Graph embedding and result validation methods // The embedResult output by gp_Embed() and input to gp_TestEmbedResultIntegrity() // can be OK if the graph is embedded or embeddable, NONEMBEDDABLE if a minimal // subgraph obstructing embedding has been isolated, or NOTOK on error int gp_Embed(graphP theGraph, unsigned embedFlags); int gp_TestEmbedResultIntegrity(graphP theGraph, graphP origGraph, int embedResult); // A return result value for gp_Embed() to indicate success prior to embedding completion, // due to finding an obstruction to embedding. #define NONEMBEDDABLE -1 // Below are the possible graph embedFlags to pass to gp_Embed() and which are // then set into the graph by gp_Embed() and returned by this method. #define gp_GetEmbedFlags(theGraph) ((theGraph)->embedFlags) #define EMBEDFLAGS_PLANAR 1 #define EMBEDFLAGS_OUTERPLANAR 2 #define EMBEDFLAGS_DRAWPLANAR (4 | EMBEDFLAGS_PLANAR) #define EMBEDFLAGS_SEARCHFORK23 (8 | EMBEDFLAGS_OUTERPLANAR) #define EMBEDFLAGS_SEARCHFORK33 (16 | EMBEDFLAGS_PLANAR) #define EMBEDFLAGS_SEARCHFORK4 (32 | EMBEDFLAGS_OUTERPLANAR) // Reserve flag bits for possible future embedding-related extension modules #define EMBEDFLAGS_SEARCHFORK5 (64 | EMBEDFLAGS_PLANAR) #define EMBEDFLAGS_SEARCHFORK5MINOR (128 | EMBEDFLAGS_PLANAR) #define EMBEDFLAGS_MAXIMALPLANARSUBGRAPH (256 | EMBEDFLAGS_PLANAR) #define EMBEDFLAGS_PROJECTIVEPLANAR 512 #define EMBEDFLAGS_TOROIDAL 1024 // After gp_Embed(), if the result is NONEMBEDDABLE, then this method // returns the obstructing minor type from the list below. // It is best to compare using a bitwise-and operation. unsigned gp_GetObstructionMinorType(graphP theGraph); #define MINORTYPE_NONE 0 #define MINORTYPE_A 1 #define MINORTYPE_B 2 #define MINORTYPE_C 4 #define MINORTYPE_D 8 #define MINORTYPE_E 16 #define MINORTYPE_E1 32 #define MINORTYPE_E2 64 #define MINORTYPE_E3 128 #define MINORTYPE_E4 256 #define MINORTYPE_E5 512 #define MINORTYPE_E6 1024 #define MINORTYPE_E7 2048 #ifdef __cplusplus } #endif #endif graph-algorithms-planarity-08d7b51/planarity/c/graphLib/planarityRelated/graphPlanarity.private.h000066400000000000000000000420271522057144000334140ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #ifndef GRAPHPLANARITY_PRIVATE_H #define GRAPHPLANARITY_PRIVATE_H #include "../graphDFSUtils.private.h" #ifdef __cplusplus extern "C" { #endif // PLANARITY-RELATED ONLY VERTEX FLAGS // // The ANYVERTEX_OBSTRUCTIONMARK_MASK bits are bits 2-4, 4+8+16=28 // They are used by planarity-related algorithms to identify the four // regions of the external face cycle of a bicomp, relative to an // XY-path in the bicomp. // Bit 2 - 4 if the OBSTRUCTIONMARK is set, 0 if not // Bit 3 - 8 if the OBSTRUCTIONMARK indicates Y side, 0 if X side // Bit 4 - 16 if the OBSTRUCTIONMARK indicates high, 0 if low #define ANYVERTEX_OBSTRUCTIONMARK_MASK 28 // Call gp_GetObstructionMark, then compare to one of these four possibilities // ANYVERTEX_OBSTRUCTIONMARK_HIGH_RXW - On the external face path between vertices R and X // ANYVERTEX_OBSTRUCTIONMARK_LOW_RXW - X or on the external face path between vertices X and W // ANYVERTEX_OBSTRUCTIONMARK_HIGH_RYW - On the external face path between vertices R and Y // ANYVERTEX_OBSTRUCTIONMARK_LOW_RYW - Y or on the external face path between vertices Y and W // ANYVERTEX_OBSTRUCTIONMARK_UNMARKED - corresponds to all three bits off #define ANYVERTEX_OBSTRUCTIONMARK_HIGH_RXW 20 #define ANYVERTEX_OBSTRUCTIONMARK_LOW_RXW 4 #define ANYVERTEX_OBSTRUCTIONMARK_HIGH_RYW 28 #define ANYVERTEX_OBSTRUCTIONMARK_LOW_RYW 12 #define ANYVERTEX_OBSTRUCTIONMARK_UNMARKED 0 #define gp_GetObstructionMark(theGraph, v) (theGraph->V[v].flags & ANYVERTEX_OBSTRUCTIONMARK_MASK) #define gp_ClearObstructionMark(theGraph, v) (theGraph->V[v].flags &= ~ANYVERTEX_OBSTRUCTIONMARK_MASK) #define gp_SetObstructionMark(theGraph, v, type) (theGraph->V[v].flags |= type) #define gp_ResetObstructionMark(theGraph, v, type) \ (theGraph->V[v].flags = (theGraph->V[v].flags & ~ANYVERTEX_OBSTRUCTIONMARK_MASK) | type) /******************************************************************** // PLANARITY-RELATED ONLY // This structure defines a pair of links used by each vertex and virtual vertex to create "short circuit" paths that eliminate unimportant vertices from the external face, enabling more efficient traversal of the external face. It is also possible to embed the "short circuit" edges, but this approach creates a better separation of concerns, imparts greater clarity, and removes exceptionalities for handling additional fake "short circuit" edges. vertex[2]: The two adjacent vertices along the external face, possibly short-circuiting paths of inactive vertices. */ struct extFaceLinkRec { int vertex[2]; }; typedef struct extFaceLinkRec extFaceLinkRec; typedef extFaceLinkRec *extFaceLinkRecP; #define gp_GetExtFaceVertex(theGraph, v, link) (theGraphExtFace(theGraph)[v].vertex[link]) #define gp_SetExtFaceVertex(theGraph, v, link, theVertex) (theGraphExtFace(theGraph)[v].vertex[link] = theVertex) /******************************************************************** // PLANARITY-RELATED ONLY // Planarity-specific additional vertex information. visitedInfo: enables algorithms to manage vertex visitation with more than just a flag. For example, the planarity test flags visitation as a step number that implicitly resets on each step, whereas part of the planar drawing method signifies a first visitation by storing the index of the first edge used to reach a vertex pertinentEdge: Used by the planarity method; during Walkup, each vertex that is directly adjacent via a back edge to the vertex v currently being embedded will have the forward edge's index stored in this field. During Walkdown, each vertex for which this field is set will cause a back edge to be embedded. Implicitly resets at each vertex step of the planarity method pertinentRootsList: used by Walkup to store a list of child bicomp roots of a vertex descendant of the current vertex that are pertinent and must be merged by the Walkdown in order to embed the cycle edges of the current vertex. Future pertinent child bicomp roots are placed at the end of the list to ensure bicomps that are only pertinent are processed first. futurePertinentChild: indicates a DFS child with a lowpoint less than the current vertex v. This member is initialized to the start of the sortedDFSChildList and is advanced in a relaxed manner as needed until one with a lowpoint less than v is found or until there are no more children. sortedDFSChildList: at the start of embedding, the list of DFS children of this vertex is calculated in ascending order by DFI (sorted in linear time). The list is used during Walkdown processing of a vertex to process all of its children. It is also used in future pertinence management when processing the ancestors of the vertex. When a child C is merged into the same bicomp as the vertex, it is removed from the list. fwdEdgeList: at the start of embedding, the "back" edges from a vertex to its DFS *descendants* (i.e. the forward edge records) are separated from the main adjacency list and placed in a circular list until they are embedded. The list is sorted in ascending DFI order of the descendants (in linear time). This member indicates (by index) a node in that list. */ struct Planarity_VertexInfo { int visitedInfo; int pertinentEdge, pertinentRoots, futurePertinentChild, sortedDFSChildList, fwdEdgeList; }; typedef struct Planarity_VertexInfo Planarity_VertexInfo; typedef Planarity_VertexInfo *Planarity_VertexInfoP; #define gp_GetVertexVisitedInfo(theGraph, v) (theGraphPVI(theGraph)[v].visitedInfo) #define gp_SetVertexVisitedInfo(theGraph, v, theVisitedInfo) (theGraphPVI(theGraph)[v].visitedInfo = theVisitedInfo) #define gp_GetVertexPertinentEdge(theGraph, v) (theGraphPVI(theGraph)[v].pertinentEdge) #define gp_SetVertexPertinentEdge(theGraph, v, e) (theGraphPVI(theGraph)[v].pertinentEdge = e) #define gp_GetVertexPertinentRootsList(theGraph, v) (theGraphPVI(theGraph)[v].pertinentRoots) #define gp_SetVertexPertinentRootsList(theGraph, v, pertinentRootsHead) (theGraphPVI(theGraph)[v].pertinentRoots = pertinentRootsHead) #define gp_GetVertexFirstPertinentRoot(theGraph, v) gp_GetBicompRootFromDFSChild(theGraph, theGraphPVI(theGraph)[v].pertinentRoots) #define gp_GetVertexFirstPertinentRootChild(theGraph, v) (theGraphPVI(theGraph)[v].pertinentRoots) #define gp_GetVertexLastPertinentRoot(theGraph, v) gp_GetBicompRootFromDFSChild(theGraph, LCGetPrev(theGraphBicompRootLists(theGraph), theGraphPVI(theGraph)[v].pertinentRoots, NIL)) #define gp_GetVertexLastPertinentRootChild(theGraph, v) LCGetPrev(theGraphBicompRootLists(theGraph), theGraphPVI(theGraph)[v].pertinentRoots, NIL) #define gp_DeleteVertexPertinentRoot(theGraph, v, R) \ gp_SetVertexPertinentRootsList(theGraph, v, \ LCDelete(theGraphBicompRootLists(theGraph), \ gp_GetVertexPertinentRootsList(theGraph, v), \ gp_GetDFSChildFromBicompRoot(theGraph, R))) #define gp_PrependVertexPertinentRoot(theGraph, v, R) \ gp_SetVertexPertinentRootsList(theGraph, v, \ LCPrepend(theGraphBicompRootLists(theGraph), \ gp_GetVertexPertinentRootsList(theGraph, v), \ gp_GetDFSChildFromBicompRoot(theGraph, R))) #define gp_AppendVertexPertinentRoot(theGraph, v, R) \ gp_SetVertexPertinentRootsList(theGraph, v, \ LCAppend(theGraphBicompRootLists(theGraph), \ gp_GetVertexPertinentRootsList(theGraph, v), \ gp_GetDFSChildFromBicompRoot(theGraph, R))) #define gp_GetVertexFuturePertinentChild(theGraph, v) (theGraphPVI(theGraph)[v].futurePertinentChild) #define gp_SetVertexFuturePertinentChild(theGraph, v, theFuturePertinentChild) (theGraphPVI(theGraph)[v].futurePertinentChild = theFuturePertinentChild) // Used to advance futurePertinentChild of w to the next separated DFS child with a lowpoint less than v // Once futurePertinentChild advances past a child, no future planarity operation could make that child // relevant to future pertinence. #define gp_UpdateVertexFuturePertinentChild(theGraph, w, v) \ while (gp_IsVertex(theGraph, theGraphPVI(theGraph)[w].futurePertinentChild)) \ { \ /* Skip children that 1) aren't future pertinent, 2) have been merged into the bicomp with w */ \ if (gp_GetVertexLowpoint(theGraph, theGraphPVI(theGraph)[w].futurePertinentChild) >= v || \ gp_IsNotSeparatedDFSChild(theGraph, theGraphPVI(theGraph)[w].futurePertinentChild)) \ { \ theGraphPVI(theGraph)[w].futurePertinentChild = \ gp_GetVertexNextDFSChild(theGraph, w, gp_GetVertexFuturePertinentChild(theGraph, w)); \ } \ else \ break; \ } #define gp_GetVertexSortedDFSChildList(theGraph, v) (theGraphPVI(theGraph)[v].sortedDFSChildList) #define gp_SetVertexSortedDFSChildList(theGraph, v, theSortedDFSChildList) (theGraphPVI(theGraph)[v].sortedDFSChildList = theSortedDFSChildList) #define gp_GetVertexNextDFSChild(theGraph, v, c) LCGetNext(theGraphSortedDFSChildLists(theGraph), gp_GetVertexSortedDFSChildList(theGraph, v), c) #define gp_AppendDFSChild(theGraph, v, c) \ LCAppend(theGraphSortedDFSChildLists(theGraph), gp_GetVertexSortedDFSChildList(theGraph, v), c) #define gp_GetVertexFwdEdgeList(theGraph, v) (theGraphPVI(theGraph)[v].fwdEdgeList) #define gp_SetVertexFwdEdgeList(theGraph, v, theFwdEdgeList) (theGraphPVI(theGraph)[v].fwdEdgeList = theFwdEdgeList) /******************************************************************** // PLANARITY-RELATED ONLY // Variables needed in embedding by Kuratowski subgraph isolator: minorType: the type of planarity obstruction found. v: the current vertex being processed r: the root of the bicomp on which the Walkdown failed x,y: stopping vertices on bicomp rooted by r w: pertinent vertex on ext. face path below x and y px, py: attachment points of x-y path, z: Unused except in minors D and E (not needed in A, B, C). ux,dx: endpoints of unembedded edge that helps connext x with ancestor of v uy,dy: endpoints of unembedded edge that helps connext y with ancestor of v dw: descendant endpoint in unembedded edge to v uz,dz: endpoints of unembedded edge that helps connext z with ancestor of v (for minors B and E, not A, C, D). */ struct isolatorContextStruct { unsigned minorType; int v, r, x, y, w, px, py, z; int ux, dx, uy, dy, dw, uz, dz; }; typedef struct isolatorContextStruct isolatorContextStruct; typedef isolatorContextStruct *isolatorContextP; //******************************************************************** // A few simple integer selection macros for obstruction isolation //******************************************************************** #define MIN(x, y) ((x) < (y) ? (x) : (y)) #define MAX(x, y) ((x) > (y) ? (x) : (y)) #define MIN3(x, y, z) MIN(MIN((x), (y)), MIN((y), (z))) #define MAX3(x, y, z) MAX(MAX((x), (y)), MAX((y), (z))) /******************************************************************** PERTINENT() A vertex is pertinent in a partially processed graph if there is an unprocessed back edge between the vertex v whose edges are currently being processed and either the vertex or a DFS descendant D of the vertex not in the same bicomp as the vertex. The vertex is either directly adjacent to v by an unembedded back edge or there is an unembedded back edge (v, D) and the vertex is a cut vertex in the partially processed graph along the DFS tree path from D to v. Pertinence is a dynamic property that can change for a vertex after each edge addition. In other words, a vertex can become non-pertinent during step v as more back edges to v are embedded. NOTE: Pertinent roots are stored using the DFS children with which they are associated, so we test 'is vertex' (rather than virtual). ********************************************************************/ #define PERTINENT(theGraph, theVertex) \ (gp_IsEdge(theGraph, gp_GetVertexPertinentEdge(theGraph, theVertex)) || \ gp_IsVertex(theGraph, gp_GetVertexPertinentRootsList(theGraph, theVertex))) #define NOTPERTINENT(theGraph, theVertex) \ (gp_IsNotEdge(theGraph, gp_GetVertexPertinentEdge(theGraph, theVertex)) && \ gp_IsNotVertex(theGraph, gp_GetVertexPertinentRootsList(theGraph, theVertex))) /******************************************************************** FUTUREPERTINENT() A vertex is future-pertinent in a partially processed graph if there is an unprocessed back edge between a DFS ancestor A of the vertex v whose edges are currently being processed and either theVertex or a DFS descendant D of theVertex not in the same bicomp as theVertex. Either theVertex is directly adjacent to A by an unembedded back edge or there is an unembedded back edge (A, D) and theVertex is a cut vertex in the partially processed graph along the DFS tree path from D to A. If no more edges are added to the partially processed graph prior to processing the edges of A, then the vertex would be pertinent. The addition of edges to the partially processed graph can alter both the pertinence and future pertinence of a vertex. For example, if the vertex is pertinent due to an unprocessed back edge (v, D1) and future pertinent due to an unprocessed back edge (A, D2), then the vertex may lose both its pertinence and future pertinence when edge (v, D1) is added if D2 is in the same subtree as D1. Generally, pertinence and future pertinence are dynamic properties that can change for a vertex after each edge addition. Note that gp_UpdateVertexFuturePertinentChild() must be called before this macro. Since it is a statement and not a void expression, the desired commented out version does not compile (except with special compiler extensions not assumed by this code). ********************************************************************/ #define FUTUREPERTINENT(theGraph, theVertex, v) \ (theGraphDVI(theGraph)[theVertex].leastAncestor < v || \ (gp_IsVertex(theGraph, theGraphPVI(theGraph)[theVertex].futurePertinentChild) && \ theGraphDVI(theGraph)[theGraphPVI(theGraph)[theVertex].futurePertinentChild].lowpoint < v)) #define NOTFUTUREPERTINENT(theGraph, theVertex, v) \ (theGraphDVI(theGraph)[theVertex].leastAncestor >= v && \ (gp_IsNotVertex(theGraph, theGraphPVI(theGraph)[theVertex].futurePertinentChild) || \ theGraphDVI(theGraph)[theGraphPVI(theGraph)[theVertex].futurePertinentChild].lowpoint >= v)) /******************************************************************** INACTIVE() For planarity algorithms, a vertex is inactive if it is neither pertinent nor future pertinent. ********************************************************************/ #define INACTIVE(theGraph, theVertex, v) \ (NOTPERTINENT(theGraph, theVertex) && \ NOTFUTUREPERTINENT(theGraph, theVertex, v)) #ifdef __cplusplus } #endif #endif /* GRAPHPLANARITY_PRIVATE_H */ graph-algorithms-planarity-08d7b51/planarity/c/graphLib/planarityRelated/graphPlanarity_Extensions.c000066400000000000000000000041231522057144000341500ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #include "graphPlanarity.h" #include "graphPlanarity.private.h" #include /**************************************************************************** gp_ExtendWith_Planarity() This function is intended to subclass a DFSUtils Graph by extending it with the planar graph embedding and obstruction isolation capabilities and any additional required data structures. If the given graph has not already been extended with DFSUtils, then gp_ExtendWith_DFSUtils() is called. To use Planarity during gp_Embed(), use EMBEDFLAGS_PLANAR. Returns OK for success, NOTOK for failure. ****************************************************************************/ int gp_ExtendWith_Planarity(graphP theGraph) { if (theGraph == NULL || gp_GetN(theGraph) <= 0) return NOTOK; // If the Graph has already been extended with Planarity, // then just return successfully if (gp_GetGraphFlags(theGraph) & GRAPHFLAGS_EXTENDEDWITH_PLANARITY) return OK; // Ensure theGraph is a DFSUtils Graph if (gp_ExtendWith_DFSUtils(theGraph) != OK) return NOTOK; // Allocate supporting data structures as needed // Perform "on success" operations theGraph->graphFlags |= GRAPHFLAGS_EXTENDEDWITH_PLANARITY; return OK; } /******************************************************************** gp_Detach_Planarity() This function is intended to disinherit the planar graph embedding and obstruction isolation feature by remove the extension from the graph, which also frees any planarity-specific data structures. Clears GRAPHFLAGS_EXTENDEDWITH_PLANARITY after detaching support for Planarity. Returns OK on success, NOTOK on failure ********************************************************************/ int gp_Detach_Planarity(graphP theGraph) { // Free any data structures allocated by the ExtendWith function // Indicate successful detachment of Planarity theGraph->graphFlags &= ~GRAPHFLAGS_EXTENDEDWITH_PLANARITY; return OK; } graph-algorithms-planarity-08d7b51/planarity/c/graphLib/planarityRelated/graphTests.c000066400000000000000000001102501522057144000310670ustar00rootroot00000000000000/* Copyright (c) 1997-2026, John M. Boyer All rights reserved. See the LICENSE.TXT file for licensing information. */ #define GRAPHTEST_C // This source file implements the main graph planarity result integrity check method // NOTE: Integrity checks for subclasses of Planarity Graph that are extended with // extensions for advanced algorithms are performed by overloads of the // integrity check function in those extensions, e.g., K33Search and DrawPlanar. #include "graphPlanarity.h" #include "graphPlanarity.private.h" extern void _ClearVertexVisitedFlags(graphP theGraph, int); /* Private function declarations (some exported to system) */ int _TestPath(graphP theGraph, int U, int V); int _TryPath(graphP theGraph, int e, int V); void _MarkPath(graphP theGraph, int e); int _TestSubgraph(graphP theSubgraph, graphP theGraph); int _CheckEmbeddingIntegrity(graphP theGraph, graphP origGraph); int _CheckEmbeddingFacialIntegrity(graphP theGraph); int _CheckObstructionIntegrity(graphP theGraph, graphP origGraph); int _getImageVertices(graphP theGraph, int *degrees, int maxDegree, int *imageVerts, int maxNumImageVerts); int _TestForCompleteGraphObstruction(graphP theGraph, int numVerts, int *degrees, int *imageVerts); int _TestForK33GraphObstruction(graphP theGraph, int *degrees, int *imageVerts); int _TestForK23GraphObstruction(graphP theGraph, int *degrees, int *imageVerts); int _CheckKuratowskiSubgraphIntegrity(graphP theGraph); int _CheckOuterplanarObstructionIntegrity(graphP theGraph); int _CheckAllVerticesOnExternalFace(graphP theGraph); void _MarkExternalFaceVertices(graphP theGraph, int startVertex); /******************************************************************** gp_TestEmbedResultIntegrity() This function tests the integrity of the graph result returned from gp_Embed(). The caller of gp_Embed() does not have to save the original graph because, for efficiency, gp_Embed() operates on the input graph. However, to test the integrity of the result relative to the input, a copy of the input graph is required. Modules that extend/alter the behavior of gp_Embed() beyond the core planarity embedder and planarity obstruction isolator should also provide overriding integrity test routines appropriate to the extension algorithm. The main method first calls gp_SortVertices on theGraph, if the origGraph is not in DFI order (the common case). Therefore, extension integrity tests can count on a consistent numbering between theGraph and the origGraph, either DFI order or pre-DFS order if that is the state of the origGraph. After all tests, the main method ensures theGraph is restored to DFI order by invoking gp_SortVertices if needed, thus ensuring that theGraph has the documented post-condition of gp_Embed(). For an embedResult of OK, fpCheckEmbeddingIntegrity is invoked. The core planarity implementation does a face walk of all faces of the embedding. It ensures that all edges were used in the face walk and that the right number of faces exist for the number of vertices and edges. Also, we ensure that all adjacencies expressed in the original graph still exist in the result graph. For an embedResult of NONEMBEDDABLE, fpCheckObstructionIntegrity is invoked. The core planarity algorithm checks that the result graph is homeomorphic to K5 or K3,3 and that it is in fact a subgraph of the input graph. Other algorithms use overloads to make appropriate checks. Returns NOTOK on integrity check failure or embedResult of NOTOK OK for successful integrity check of OK embedResult NONEMBEDDABLE for successful integrity check of an embedResult of NONEMBEDDABLE ********************************************************************/ int gp_TestEmbedResultIntegrity(graphP theGraph, graphP origGraph, int embedResult) { int RetVal = embedResult; if (theGraph == NULL || origGraph == NULL) return NOTOK; if (embedResult == OK) { RetVal = theGraph->functions->fpCheckEmbeddingIntegrity(theGraph, origGraph); } else if (embedResult == NONEMBEDDABLE) { RetVal = theGraph->functions->fpCheckObstructionIntegrity(theGraph, origGraph); } if (RetVal == OK) RetVal = embedResult; return RetVal; } /******************************************************************** _CheckEmbeddingIntegrity() The core planarity implementation does a face walk of all faces of the embedding. It ensures that all edges were used in the face walk and that the right number of faces exist for the number of vertices and edges. Also, we ensure that all adjacencies expressed in the original graph still exist in the result graph, accounting for the fact that the result graph is sorted by DFI, but the input may or may not be sorted by DFI. returns OK if all integrity tests passed, NOTOK otherwise ********************************************************************/ int _CheckEmbeddingIntegrity(graphP theGraph, graphP origGraph) { if (theGraph == NULL || origGraph == NULL) return NOTOK; if (_TestSubgraph(theGraph, origGraph) != TRUE) return NOTOK; if (_TestSubgraph(origGraph, theGraph) != TRUE) return NOTOK; if (_CheckEmbeddingFacialIntegrity(theGraph) != OK) return NOTOK; if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_OUTERPLANAR) { if (_CheckAllVerticesOnExternalFace(theGraph) != OK) return NOTOK; } return OK; } /******************************************************************** _CheckEmbeddingFacialIntegrity() This function traverses all faces of a graph structure containing the planar embedding that results from gp_Embed(). The algorithm begins by placing all of the graph's edge records onto a stack and marking all of them as unvisited. For each edge record popped, if it is visited, it is discarded and the next edge record is popped. Popping an unvisited edge record e begins a face traversal. We move to the true twin edge record of e, and obtain its adjacency list successor. This amounts to always going clockwise or counterclockwise (depending on how the graph is drawn on the plane, or alternately whether one is above or below the plane). This traversal continues until we make it back to the original edge record e. Each edge record along the way is marked as visited. Further, if the successor edge record has been visited, then there is an error since an edge record can only appear in one face (the twin edge record in an edge appears in a separate face, which is traversed in the opposing direction). If this algorithm succeeds without doubly visiting any edge records, and it produces the correct face count according to Euler's formula, then the embedding has all vertices oriented the same way. NOTE: In disconnected graphs, the face reader counts the external face of each connected component. So, we adjust the face count by subtracting one for each component, then we add one to count the external face shared by all components. ********************************************************************/ int _CheckEmbeddingFacialIntegrity(graphP theGraph) { stackP theStack = theGraph->theStack; int v, e, eTwin, eStart, eNext, NumFaces, connectedComponents; if (theGraph == NULL) return NOTOK; /* The stack need only contain 2M entries, one for each edge record. With max M at 3N, this amounts to 6N integers of space. The embedding structure already contains this stack, so we just make sure it starts out empty. */ sp_ClearStack(theStack); /* Push all edge records (both parts of each edge) and set them all to unvisited */ for (e = gp_LowerBoundEdges(theGraph); e < gp_UpperBoundEdges(theGraph); e += 2) { // Except skip edge holes if (gp_EdgeInUse(theGraph, e)) { // Push e and clear its visited flag sp_Push(theStack, e); gp_ClearEdgeVisited(theGraph, e); // And now the same for the twin of e eTwin = gp_GetTwin(theGraph, e); sp_Push(theStack, eTwin); gp_ClearEdgeVisited(theGraph, eTwin); } } // There are M edges, so we better have pushed 2M edge records, // i.e., we test that the continue above skipped edge holes and // didn't push edge records beyond the boundary of those in use. if (sp_GetCurrentSize(theStack) != 2 * gp_GetM(theGraph)) return NOTOK; /* Read faces until every edge record is popped */ NumFaces = 0; while (sp_NonEmpty(theStack)) { /* Get an edge record; if it has already been used by a face, then don't use it to traverse a new face */ sp_Pop(theStack, eStart); if (gp_GetEdgeVisited(theGraph, eStart)) continue; e = eStart; do { eNext = gp_GetNextEdgeCircular(theGraph, gp_GetTwin(theGraph, e)); if (gp_GetEdgeVisited(theGraph, eNext)) return NOTOK; gp_SetEdgeVisited(theGraph, eNext); e = eNext; } while (e != eStart); NumFaces++; } /* Count the external face once rather than once per connected component; each connected component is detected by the fact that it has no DFS parent, except in the case of isolated vertices, no face was counted so we do not subtract one. */ connectedComponents = 0; for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { if (gp_IsDFSTreeRoot(theGraph, v)) { if (gp_GetVertexDegree(theGraph, v) > 0) NumFaces--; connectedComponents++; } } NumFaces++; /* Test number of faces using the extended Euler's formula. For connected components, Euler's formula is f=m-n+2, but for disconnected graphs it is extended to f=m-n+1+c where c is the number of connected components.*/ return NumFaces == gp_GetM(theGraph) - gp_GetN(theGraph) + 1 + connectedComponents ? OK : NOTOK; } /******************************************************************** _CheckAllVerticesOnExternalFace() Determines whether or not any vertices have been embedded within the bounding cycle of the external face. The input graph may be disconnected, so this routine walks the external face starting at each vertex with no DFSParent. return OK if all vertices visited on external face walks, NOTOK otherwise ********************************************************************/ int _CheckAllVerticesOnExternalFace(graphP theGraph) { int v; // Mark all vertices unvisited _ClearVertexVisitedFlags(theGraph, FALSE); // For each connected component, walk its external face and // mark the vertices as visited for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { if (gp_IsDFSTreeRoot(theGraph, v)) _MarkExternalFaceVertices(theGraph, v); } // If any vertex is unvisited, then the embedding is not an outerplanar // embedding, so we return NOTOK for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) if (!gp_GetVisited(theGraph, v)) return NOTOK; // All vertices were found on external faces of the connected components // so the embedding is an outerplanar embedding and we return OK return OK; } /******************************************************************** _MarkExternalFaceVertices() Walks the external face of the connected component containing the start vertex, and marks the visited flag of all vertices found. The start vertex is assumed to be on the external face. This method assumed the embedding integrity has already been verified to be correct. This method correctly handles components that have cut vertices, i.e. it does not assume that the outer face is a simple cycle; it only assumes that all vertices are reachable by walking a single face that starts with startVertex. ********************************************************************/ void _MarkExternalFaceVertices(graphP theGraph, int startVertex) { int nextVertex = startVertex; int e = gp_GetFirstEdge(theGraph, nextVertex); int eTwin; // Handle the case of an isolated vertex if (gp_IsNotEdge(theGraph, e)) { gp_SetVisited(theGraph, startVertex); return; } // Process a non-trivial connected component do { gp_SetVisited(theGraph, nextVertex); // The edge record out of the vertex just visited points to the next vertex nextVertex = gp_GetNeighbor(theGraph, e); // The edge record used to enter the next vertex is needed so we can get // the next edge in rotation order. // Note: for bicomps, first and last edges of all external face vertices // indicate the edges that hold them to the external face // But _JoinBicomps() has already occurred, so cut vertices // will have external face edges other than their first and last // edge records, so we need this more sophisticated traversal method. eTwin = gp_GetTwin(theGraph, e); // Now we get the next edge in rotation order as the new edge out to the // vertex after nextVertex. This sets us up for the next iteration. // NOTE: We cannot simply follow the chain of nextVertex first edges // as we started out doing at the top of this method. This is // because we are no longer dealing with bicomps only. // Since _JoinBicomps() has already been invoked, there may now // be cut vertices on the external face whose adjacency lists // contain external face edges in positions other than their first // and last edges. We will visit those vertices multiple times, // which is OK (just that we have to explain why we're calculating // the out edge to exit a vertex in this way). e = gp_GetNextEdgeCircular(theGraph, eTwin); // Now things get really interesting. The DFS root (startVertex) may // itself be a cut vertex to which multiple bicomps have been joined. // So we cannot simply stop when the external face walk gets back to // startVertex. We must actually get back to startVertex using its // last edge. This ensures that we've looped down into all the DFS // subtrees rooted at startVertex and walked their external faces. // Since we started the whole external face walk with the first edge // of startVertex, we need to proceed until we reenter startVertex // using its last edge. } while (eTwin != gp_GetLastEdge(theGraph, startVertex)); } /******************************************************************** _CheckObstructionIntegrity() Returns OK if theGraph is a subgraph of origGraph and it contains an allowed homeomorph, and NOTOK otherwise. For core planarity, the allowed homeomorphs are K_5 or K_{3,3} Extension modules may overload this method to implement different tests. For example, K_{3,3} search allows only K_{3,3} and outerplanarity allows only K_4 or K_{2,3}. ********************************************************************/ int _CheckObstructionIntegrity(graphP theGraph, graphP origGraph) { if (theGraph == NULL || origGraph == NULL) return NOTOK; if (_TestSubgraph(theGraph, origGraph) != TRUE) { return NOTOK; } if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_PLANAR) return _CheckKuratowskiSubgraphIntegrity(theGraph); else if (gp_GetEmbedFlags(theGraph) == EMBEDFLAGS_OUTERPLANAR) return _CheckOuterplanarObstructionIntegrity(theGraph); return NOTOK; } /******************************************************************** _getImageVertices() Count the number of vertices of each degree and find the locations of the image vertices (also sometimes called the corners of the obstruction). An image vertex is a vertex of degree three or higher because degree 2 vertices are generally internal to the paths between the image vertices. The notable exception is K_{2,3}, an obstruction to outerplanarity. This routine does not know the obstruction it is looking for, so the caller must decide whether there are any degree 2 vertices that should be added to imageVerts. Return NOTOK if any vertex of degree 1 or higher than the max is found NOTOK if more than the max number of image vertices is found. Return OK otherwise. ********************************************************************/ int _getImageVertices(graphP theGraph, int *degrees, int maxDegree, int *imageVerts, int maxNumImageVerts) { int K, v, imageVertPos, degree; for (degree = 0; degree <= maxDegree; degree++) degrees[degree] = 0; for (K = 0; K < maxNumImageVerts; K++) imageVerts[K] = NIL; imageVertPos = 0; for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) { degree = gp_GetVertexDegree(theGraph, v); if (degree == 1) return NOTOK; if (degree > maxDegree) return NOTOK; degrees[degree]++; if (imageVertPos < maxNumImageVerts && degree > 2) imageVerts[imageVertPos++] = v; else if (degree > 2) return NOTOK; } return OK; } /******************************************************************** _TestForCompleteGraphObstruction() theGraph - the graph to test numVerts - the number of image vertices (corners) of the complete graph homeomorph being tested for (e.g. 5 for a K5) degrees - array of counts of the number of vertices of each degree given by the array index. Only valid up to numVerts-1 imageVerts - the vertices of degree numVerts-1 This routine tests whether theGraph is a K_{numVerts} homeomorph for numVerts >= 4. returns FALSE if numVerts < 4, if theGraph has other than numVerts image vertices if theGraph contains other than degree 2 vertices plus the image vertices if any pair of image vertices lacks a connecting path if any degree two vertices are not in the connecting paths TRUE otherwise ********************************************************************/ int _TestForCompleteGraphObstruction(graphP theGraph, int numVerts, int *degrees, int *imageVerts) { int v, w; // We need to make sure we have numVerts vertices of degree numVerts-1 // For example, if numVerts==5, then we're looking for a K5, so we // need to have degrees[4] == 5 (5 vertices of degree 4) if (degrees[numVerts - 1] != numVerts) return FALSE; // All vertices need to be degree 0, degree 2 or degree numVerts-1 if (degrees[0] + degrees[2] + degrees[numVerts - 1] != gp_GetN(theGraph)) return FALSE; // We clear all the vertex visited flags _ClearVertexVisitedFlags(theGraph, FALSE); // For each pair of image vertices, we test that there is a path // between the two vertices. If so, the visited flags of the // internal vertices along the path are marked // for (v = 0; v < numVerts; v++) for (w = 0; w < numVerts; w++) if (v != w) if (_TestPath(theGraph, imageVerts[v], imageVerts[w]) != TRUE) return FALSE; // The visited flags should have marked only degree two vertices, // so for every marked vertex, we subtract one from the count of // the degree two vertices. for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) if (gp_GetVisited(theGraph, v)) degrees[2]--; /* If every degree 2 vertex is used in a path between image vertices, then there are no extra pieces of the graph in theGraph. Specifically, the prior tests identify a K_5 and ensure that nothing else could exist in the graph except extra degree 2 vertices, which must be joined in a cycle so that all are degree 2. */ return degrees[2] == 0 ? TRUE : FALSE; } /******************************************************************** _TestForK33GraphObstruction() theGraph - the graph to test degrees - array of counts of the number of vertices of each degree given by the array index. Only valid up to numVerts-1 imageVerts - the degree 3 vertices of the K3,3 homeomorph This routine tests whether theGraph is a K_{3,3} homeomorph. returns TRUE if so, FALSE if not ********************************************************************/ int _TestForK33GraphObstruction(graphP theGraph, int *degrees, int *imageVerts) { int v, K, imageVertPos, temp, success; if (degrees[4] != 0) return FALSE; if (degrees[3] != 6) return FALSE; /* Partition the six image vertices into two sets of 3 (or report failure) */ for (imageVertPos = 3; imageVertPos < 6; imageVertPos++) { K = 0; success = FALSE; do { if (_TestPath(theGraph, imageVerts[imageVertPos], imageVerts[0]) == TRUE) { success = TRUE; break; } K++; temp = imageVerts[K]; imageVerts[K] = imageVerts[imageVertPos]; imageVerts[imageVertPos] = temp; } while (K < 3); if (!success) return FALSE; } /* Now test the paths between each of the first three vertices and each of the last three vertices */ _ClearVertexVisitedFlags(theGraph, FALSE); for (imageVertPos = 0; imageVertPos < 3; imageVertPos++) for (K = 3; K < 6; K++) if (_TestPath(theGraph, imageVerts[imageVertPos], imageVerts[K]) != TRUE) return FALSE; for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) if (gp_GetVisited(theGraph, v)) degrees[2]--; /* If every degree 2 vertex is used in a path between image vertices, then there are no extra pieces of the graph in theGraph. Specifically, the prior tests identify a K_{3,3} and ensure that nothing else could exist in the graph except extra degree 2 vertices, which must be joined in a cycle so that all are degree 2. */ return degrees[2] == 0 ? TRUE : FALSE; } /******************************************************************** _CheckKuratowskiSubgraphIntegrity() This function checks whether theGraph received as input contains either a K_5 or K_{3,3} homeomorph. RETURNS: OK if theGraph contains a K_5 or K_{3,3} homeomorph, NOTOK otherwise To be a K_5 homeomorph, there must be exactly 5 vertices of degree 4, which are called 'image' vertices, and all other vertices must be either degree 2 or degree 0. Furthermore, each of the image vertices must be able to reach all of the other image vertices by a single edge or a path of degree two vertices. To be a K_{3,3} homeomorph, there must be exactly 6 vertices of degree 3, which are called 'image' vertices, and all other vertices must be either degree 2 or degree 0. Furthermore, the image vertices must be connected by edges or paths of degree two vertices in the manner suggested by a K_{3,3}. To test this, we select an image vertex U, and determine three image vertices X, Y and Z reachable from U by single edges or paths of degree 2 vertices. Then, we check that the two remaining image vertices, V and W, can also reach X, Y and Z by single edges or paths of degree 2 vertices. It is not necessary to check that the paths between the image vertices are distinct since if the paths had a common vertex, then the common vertex would not be degree 2. ********************************************************************/ int _CheckKuratowskiSubgraphIntegrity(graphP theGraph) { int degrees[5], imageVerts[6]; if (_getImageVertices(theGraph, degrees, 4, imageVerts, 6) != OK) return NOTOK; if (_TestForCompleteGraphObstruction(theGraph, 5, degrees, imageVerts) == TRUE) { return OK; } if (_TestForK33GraphObstruction(theGraph, degrees, imageVerts) == TRUE) { return OK; } return NOTOK; } /******************************************************************** _TestForK23GraphObstruction() theGraph - the graph to test degrees - array of counts of the number of vertices of each degree given by the array index. Only valid up to numVerts-1 imageVerts - the degree 3 vertices of the K2,3 homeomorph This routine tests whether theGraph is a K_{2,3} homeomorph. This routine operates over the results of _getImageVertices() returns TRUE if so, FALSE if not ********************************************************************/ int _TestForK23GraphObstruction(graphP theGraph, int *degrees, int *imageVerts) { int v, e, imageVertPos; // This function operates over the imageVerts results produced by // getImageVertices, which only finds vertices of degree 3 or higher. // So, for a K2,3, there must be exactly two degree 3 vertices and // no degree 4 vertices. if (degrees[3] != 2) return FALSE; // For K_{2,3}, the three vertices of degree 2 were not // detected as image vertices because degree 2 vertices // are indistinguishable from the internal path vertices // between the image vertices. So, here we acknowledge // that more image vertices need to be selected. imageVertPos = 2; // Assign the remaining three image vertices to be the // neighbors of the first degree 3 image vertex. // Ensure that each is distinct from the second // degree 3 image vertex. This must be the case because // the two degree 3 image vertices are in the same partition // and hence must not be adjacent. e = gp_GetFirstEdge(theGraph, imageVerts[0]); while (gp_IsEdge(theGraph, e)) { imageVerts[imageVertPos] = gp_GetNeighbor(theGraph, e); if (imageVerts[imageVertPos] == imageVerts[1]) return FALSE; imageVertPos++; e = gp_GetNextEdge(theGraph, e); } /* The paths from imageVerts[0] to each of the new degree 2 image vertices are the edges we just traversed. Now test the paths between each of the degree 2 image vertices and imageVerts[1]. */ _ClearVertexVisitedFlags(theGraph, FALSE); for (imageVertPos = 2; imageVertPos < 5; imageVertPos++) { if (_TestPath(theGraph, imageVerts[imageVertPos], imageVerts[1]) != TRUE) return FALSE; gp_SetVisited(theGraph, imageVerts[imageVertPos]); } for (v = gp_LowerBoundVertices(theGraph); v < gp_UpperBoundVertices(theGraph); ++v) if (gp_GetVisited(theGraph, v)) degrees[2]--; /* If every degree 2 vertex is used in a path between the two degree 3 image vertices, then there are no extra pieces of the graph in theGraph. Specifically, the prior tests identify a K_{2,3} and ensure that nothing else could exist in the graph... except extra degree 2 vertices joined in a cycle. We return NOTOK in that case. */ return degrees[2] == 0 ? TRUE : FALSE; } /******************************************************************** _CheckOuterplanarObstructionIntegrity() This function checks whether theGraph received as input contains either a K_4 or K_{2,3} homeomorph. RETURNS: OK if theGraph contains a K_4 or K_{2,3} homeomorph, NOTOK otherwise To be a K_4 homeomorph, there must be exactly 4 vertices of degree 3, which are called 'image' vertices, and all other vertices must be either degree 2 or degree 0. Furthermore, each of the image vertices must be able to reach all of the other image vertices by a single edge or a path of degree two vertices. To be a K_{2,3} homeomorph, there must be exactly 2 vertices of degree 3. All other vertices must be degree 2. Furthermore, the two degree 3 vertices must have three internally disjoint paths connecting them, and each path must contain at least two edges (i.e. at least one internal vertex). The two degree 3 vertices are image vertices, and an internal vertex from each of the three paths contributes the remaining three image vertices. It is not necessary to check that the paths between the degree three vertices are distinct since if the paths had a common vertex, then the common vertex would not be degree 2. ********************************************************************/ int _CheckOuterplanarObstructionIntegrity(graphP theGraph) { int degrees[4], imageVerts[5]; if (_getImageVertices(theGraph, degrees, 3, imageVerts, 5) != OK) return NOTOK; if (_TestForCompleteGraphObstruction(theGraph, 4, degrees, imageVerts) == TRUE) { return OK; } if (_TestForK23GraphObstruction(theGraph, degrees, imageVerts) == TRUE) { return OK; } /* We get here only if we failed to recognize an outerplanarity obstruction, so we return failure */ return NOTOK; } /******************************************************************** _TestPath() This function determines whether there exists a path of degree two vertices between two given vertices. The function marks each degree two vertex as visited. It returns TRUE if it finds the path and FALSE otherwise. ********************************************************************/ int _TestPath(graphP theGraph, int U, int V) { int e = gp_GetFirstEdge(theGraph, U); while (gp_IsEdge(theGraph, e)) { if (_TryPath(theGraph, e, V) == OK) { _MarkPath(theGraph, e); return TRUE; } e = gp_GetNextEdge(theGraph, e); } return FALSE; } /******************************************************************** _TryPath() This function seeks a given path to a vertex V starting with a given edge out of a starting vertex U. The path is allowed to contain zero or more degree two vertices, but we stop as soon as a vertex of degree higher than two is encountered. The function returns boolean true if that vertex is V, and boolean false otherwise. ********************************************************************/ int _TryPath(graphP theGraph, int e, int V) { int eTwin, nextVertex; nextVertex = gp_GetNeighbor(theGraph, e); // while nextVertex is strictly degree 2 while (gp_IsEdge(theGraph, gp_GetFirstEdge(theGraph, nextVertex)) && gp_IsEdge(theGraph, gp_GetLastEdge(theGraph, nextVertex)) && gp_GetNextEdge(theGraph, gp_GetFirstEdge(theGraph, nextVertex)) == gp_GetLastEdge(theGraph, nextVertex)) { eTwin = gp_GetTwin(theGraph, e); e = gp_GetFirstEdge(theGraph, nextVertex); if (e == eTwin) e = gp_GetLastEdge(theGraph, nextVertex); nextVertex = gp_GetNeighbor(theGraph, e); } return nextVertex == V ? TRUE : FALSE; } /******************************************************************** _MarkPath() This function sets the visitation flag on all degree two vertices along a path to a vertex V that starts with a given edge out of a starting vertex U. ********************************************************************/ void _MarkPath(graphP theGraph, int e) { int eTwin, nextVertex; nextVertex = gp_GetNeighbor(theGraph, e); // while nextVertex is strictly degree 2 while (gp_IsEdge(theGraph, gp_GetFirstEdge(theGraph, nextVertex)) && gp_IsEdge(theGraph, gp_GetLastEdge(theGraph, nextVertex)) && gp_GetNextEdge(theGraph, gp_GetFirstEdge(theGraph, nextVertex)) == gp_GetLastEdge(theGraph, nextVertex)) { gp_SetVisited(theGraph, nextVertex); eTwin = gp_GetTwin(theGraph, e); e = gp_GetFirstEdge(theGraph, nextVertex); if (e == eTwin) e = gp_GetLastEdge(theGraph, nextVertex); nextVertex = gp_GetNeighbor(theGraph, e); } } /******************************************************************** _TestSubgraph() Checks whether theSubgraph is in fact a subgraph of theGraph. For each vertex v in graph G and subgraph H, we iterate the adjacency list of H(v) and, for each neighbor w, we mark G(w). Then, we iterate the adjacency list of G(v) and unmark each neighbor. Then, we iterate the adjacency list of H(v) again to ensure that every neighbor w was unmarked. If there exists a marked neighbor, then H(v) contains an incident edge that is not incident to G(v). Returns TRUE if theSubgraph contains only edges from theGraph, FALSE otherwise ********************************************************************/ int _TestSubgraph(graphP theSubgraph, graphP theGraph) { int v, e, degreeCount; int Result = TRUE; int invokeSortOnGraph = FALSE; int invokeSortOnSubgraph = FALSE; // If the graph is not sorted by DFI, but the alleged subgraph is, // then "unsort" the alleged subgraph so both have the same vertex order if (!(gp_GetGraphFlags(theGraph) & GRAPHFLAGS_SORTEDBYDFI) && (gp_GetGraphFlags(theSubgraph) & GRAPHFLAGS_SORTEDBYDFI)) { invokeSortOnSubgraph = TRUE; gp_SortVertices(theSubgraph); } // If the graph is not sorted by DFI, but the alleged subgraph is, // then "unsort" the alleged subgraph so both have the same vertex order if (!(gp_GetGraphFlags(theSubgraph) & GRAPHFLAGS_SORTEDBYDFI) && (gp_GetGraphFlags(theGraph) & GRAPHFLAGS_SORTEDBYDFI)) { invokeSortOnGraph = TRUE; gp_SortVertices(theGraph); } /* We clear all visitation flags */ _ClearVertexVisitedFlags(theGraph, FALSE); /* For each vertex... */ for (v = gp_LowerBoundVertices(theSubgraph), degreeCount = 0; v < gp_UpperBoundVertices(theSubgraph); ++v) { /* For each neighbor w in the adjacency list of vertex v in the subgraph, set the visited flag in w in the graph */ e = gp_GetFirstEdge(theSubgraph, v); while (gp_IsEdge(theGraph, e)) { if (gp_IsNotVertex(theSubgraph, gp_GetNeighbor(theSubgraph, e))) { Result = FALSE; break; } degreeCount++; gp_SetVisited(theGraph, gp_GetNeighbor(theSubgraph, e)); e = gp_GetNextEdge(theSubgraph, e); } if (Result != TRUE) break; /* For each neighbor w in the adjacency list of vertex v in the graph, clear the visited flag in w in the graph */ e = gp_GetFirstEdge(theGraph, v); while (gp_IsEdge(theGraph, e)) { if (gp_IsNotVertex(theGraph, gp_GetNeighbor(theGraph, e))) { Result = FALSE; break; } gp_ClearVisited(theGraph, gp_GetNeighbor(theGraph, e)); e = gp_GetNextEdge(theGraph, e); } if (Result != TRUE) break; /* For each neighbor w in the adjacency list of vertex v in the subgraph, ensure that the visited flag in w was cleared (otherwise, the "subgraph" would incorrectly contain an adjacency not contained in the ("super") graph) */ e = gp_GetFirstEdge(theSubgraph, v); while (gp_IsEdge(theGraph, e)) { if (gp_GetVisited(theGraph, gp_GetNeighbor(theSubgraph, e))) { Result = FALSE; break; } e = gp_GetNextEdge(theSubgraph, e); } if (Result != TRUE) break; } // Restore the DFI sort order of either graph if it had to be reordered at the start if (invokeSortOnSubgraph) gp_SortVertices(theSubgraph); if (invokeSortOnGraph) gp_SortVertices(theGraph); // Assuming theSubgraph is a subgraph, we also do an extra integrity check to ensure // proper edge array utilization if (Result == TRUE) { // If the edge count is wrong, we fail the subgraph test in a way that invokes // the name NOTOK so that in debug mode there is more trace on the failure. if (degreeCount != 2 * gp_GetM(theSubgraph)) Result = NOTOK == FALSE ? NOTOK : FALSE; } return Result; } graph-algorithms-planarity-08d7b51/planarity/classic/000077500000000000000000000000001522057144000227435ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/planarity/classic/__init__.pxd000066400000000000000000000000001522057144000252050ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/planarity/classic/__init__.py000066400000000000000000000000001522057144000250420ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/planarity/classic/cplanarity.pxd000066400000000000000000000043021522057144000256250ustar00rootroot00000000000000"""Interface for Boyer's (c) planarity algorithms.""" cdef extern from "../c/graphLib/lowLevelUtils/appconst.h": int OK, NOTOK, TRUE, FALSE cdef extern from "../c/graphLib/graph.h": ctypedef struct graphStruct: pass ctypedef graphStruct * graphP graphP gp_New() int gp_EnsureVertexCapacity(graphP theGraph, int N) void gp_Free(graphP *pGraph) int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink) int gp_DynamicAddEdge(graphP theGraph, int u, int ulink, int v, int vlink) int gp_GetFirstEdge(graphP theGraph, int v) int gp_GetLastEdge(graphP theGraph, int v) int gp_LowerBoundVertices(graphP theGraph) int gp_UpperBoundVertices(graphP theGraph) int gp_GetNextEdge(graphP theGraph, int v) int gp_GetPrevEdge(graphP theGraph, int v) int gp_IsEdge(graphP theGraph, int v) int gp_GetNeighbor(graphP theGraph, int v) int EDGEFLAG_DIRECTION_INONLY, EDGEFLAG_DIRECTION_OUTONLY int gp_GetDirection(graphP theGraph, int v) int AT_EDGE_CAPACITY_LIMIT cdef extern from "../c/graphLib/graphDFSUtils.h": void gp_SortVertices(graphP theGraph) cdef extern from "../c/graphLib/io/graphIO.h": int WRITE_ADJLIST int gp_Write(graphP theGraph, char *FileName, int Mode) cdef extern from "../c/graphLib/planarityRelated/graphPlanarity.h": int gp_ExtendWith_Planarity(graphP theGraph) int gp_Embed(graphP theGraph, int embedFlags) int NONEMBEDDABLE int EMBEDFLAGS_PLANAR, EMBEDFLAGS_DRAWPLANAR cdef extern from "../c/graphLib/planarityRelated/graphOuterplanarity.h": int gp_ExtendWith_Outerplanarity(graphP theGraph) cdef extern from "../c/graphLib/planarityRelated/graphDrawPlanar.h": int gp_ExtendWith_DrawPlanar(graphP theGraph) int gp_DrawPlanar_RenderToString(graphP theEmbedding, char **pRenditionString); int gp_DrawPlanar_GetVertexPosition(graphP theEmbedding, int v) int gp_DrawPlanar_GetVertexStart(graphP theEmbedding, int v) int gp_DrawPlanar_GetVertexEnd(graphP theEmbedding, int v) int gp_DrawPlanar_GetEdgePosition(graphP theEmbedding, int e) int gp_DrawPlanar_GetEdgeStart(graphP theEmbedding, int e) int gp_DrawPlanar_GetEdgeEnd(graphP theEmbedding, int e) graph-algorithms-planarity-08d7b51/planarity/classic/planarity.c000066400000000000000000021326261522057144000251260ustar00rootroot00000000000000/* Generated by Cython 3.2.6 */ /* BEGIN: Cython Metadata { "distutils": { "depends": [], "include_dirs": [ "planarity/c/graphLib" ], "name": "planarity.classic.planarity", "sources": [ "planarity/classic/planarity.pyx", "planarity/c/graphLib/graphDFSUtils.c", "planarity/c/graphLib/graphLib.c", "planarity/c/graphLib/graph.c", "planarity/c/graphLib/io/g6-api-utilities.c", "planarity/c/graphLib/io/g6-read-iterator.c", "planarity/c/graphLib/io/strOrFile.c", "planarity/c/graphLib/io/g6-write-iterator.c", "planarity/c/graphLib/io/strbuf.c", "planarity/c/graphLib/io/graphIO.c", "planarity/c/graphLib/extensionSystem/graphExtensions.c", "planarity/c/graphLib/homeomorphSearch/graphK23Search_Extensions.c", "planarity/c/graphLib/homeomorphSearch/graphK33Search_Extensions.c", "planarity/c/graphLib/homeomorphSearch/graphK4Search.c", "planarity/c/graphLib/homeomorphSearch/graphK4Search_Extensions.c", "planarity/c/graphLib/homeomorphSearch/graphK33Search.c", "planarity/c/graphLib/homeomorphSearch/graphK23Search.c", "planarity/c/graphLib/planarityRelated/graphTests.c", "planarity/c/graphLib/planarityRelated/graphPlanarity_Extensions.c", "planarity/c/graphLib/planarityRelated/graphEmbed.c", "planarity/c/graphLib/planarityRelated/graphOuterplanarObstruction.c", "planarity/c/graphLib/planarityRelated/graphNonplanar.c", "planarity/c/graphLib/planarityRelated/graphIsolator.c", "planarity/c/graphLib/planarityRelated/graphOuterplanarity_Extensions.c", "planarity/c/graphLib/planarityRelated/graphDrawPlanar.c", "planarity/c/graphLib/planarityRelated/graphDrawPlanar_Extensions.c", "planarity/c/graphLib/lowLevelUtils/stack.c", "planarity/c/graphLib/lowLevelUtils/apiutils.c", "planarity/c/graphLib/lowLevelUtils/listcoll.c" ] }, "module_name": "planarity.classic.planarity" } END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ /* InitLimitedAPI */ #if defined(Py_LIMITED_API) #if !defined(CYTHON_LIMITED_API) #define CYTHON_LIMITED_API 1 #endif #elif defined(CYTHON_LIMITED_API) #ifdef _MSC_VER #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.") #else #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead. #endif #endif #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 < 0x03080000 #error Cython requires Python 3.8+. #else #define __PYX_ABI_VERSION "3_2_6" #define CYTHON_HEX_VERSION 0x030206F0 #define CYTHON_FUTURE_DIVISION 1 /* CModulePreamble */ #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #define __PYX_COMMA , #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX #if defined(GRAALVM_PYTHON) /* For very preliminary testing purposes. Most variables are set the same as PyPy. The existence of this section does not imply that anything works or is even tested */ #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 #define CYTHON_COMPILING_IN_LIMITED_API 0 #define CYTHON_COMPILING_IN_GRAAL 1 #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 #undef CYTHON_USE_TYPE_SPECS #define CYTHON_USE_TYPE_SPECS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 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_AVOID_THREAD_UNSAFE_BORROWED_REFS #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 #undef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 0 #undef CYTHON_ASSUME_SAFE_SIZE #define CYTHON_ASSUME_SAFE_SIZE 0 #undef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_GIL #define CYTHON_FAST_GIL 0 #undef CYTHON_METH_FASTCALL #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #ifndef CYTHON_PEP487_INIT_SUBCLASS #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #undef CYTHON_USE_MODULE_STATE #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_SYS_MONITORING #define CYTHON_USE_SYS_MONITORING 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_AM_SEND #define CYTHON_USE_AM_SEND 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 1 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif #undef CYTHON_USE_FREELISTS #define CYTHON_USE_FREELISTS 0 #undef CYTHON_IMMORTAL_CONSTANTS #define CYTHON_IMMORTAL_CONSTANTS 0 #elif defined(PYPY_VERSION) #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #define CYTHON_COMPILING_IN_LIMITED_API 0 #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #ifndef CYTHON_USE_TYPE_SPECS #define CYTHON_USE_TYPE_SPECS 0 #endif #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 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_AVOID_THREAD_UNSAFE_BORROWED_REFS #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 #undef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 0 #ifndef CYTHON_ASSUME_SAFE_SIZE #define CYTHON_ASSUME_SAFE_SIZE 1 #endif #undef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_GIL #define CYTHON_FAST_GIL 0 #undef CYTHON_METH_FASTCALL #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #ifndef CYTHON_PEP487_INIT_SUBCLASS #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif #if PY_VERSION_HEX < 0x03090000 #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 0 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif #undef CYTHON_USE_MODULE_STATE #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_SYS_MONITORING #define CYTHON_USE_SYS_MONITORING 0 #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00) #endif #undef CYTHON_USE_AM_SEND #define CYTHON_USE_AM_SEND 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100) #endif #undef CYTHON_USE_FREELISTS #define CYTHON_USE_FREELISTS 0 #undef CYTHON_IMMORTAL_CONSTANTS #define CYTHON_IMMORTAL_CONSTANTS 0 #elif defined(CYTHON_LIMITED_API) #ifdef Py_LIMITED_API #undef __PYX_LIMITED_VERSION_HEX #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API #endif #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 #define CYTHON_COMPILING_IN_LIMITED_API 1 #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 #undef CYTHON_USE_TYPE_SPECS #define CYTHON_USE_TYPE_SPECS 1 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #undef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 0 #ifndef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #endif #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_AVOID_THREAD_UNSAFE_BORROWED_REFS #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 #endif #undef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 0 #undef CYTHON_ASSUME_SAFE_SIZE #define CYTHON_ASSUME_SAFE_SIZE 0 #undef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_GIL #define CYTHON_FAST_GIL 0 #undef CYTHON_METH_FASTCALL #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #ifndef CYTHON_PEP487_INIT_SUBCLASS #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif #ifndef CYTHON_USE_MODULE_STATE #define CYTHON_USE_MODULE_STATE 0 #endif #undef CYTHON_USE_SYS_MONITORING #define CYTHON_USE_SYS_MONITORING 0 #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #endif #ifndef CYTHON_USE_AM_SEND #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000) #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif #ifndef CYTHON_USE_FREELISTS #define CYTHON_USE_FREELISTS 1 #endif #undef CYTHON_IMMORTAL_CONSTANTS #define CYTHON_IMMORTAL_CONSTANTS 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #define CYTHON_COMPILING_IN_LIMITED_API 0 #define CYTHON_COMPILING_IN_GRAAL 0 #ifdef Py_GIL_DISABLED #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1 #else #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 #endif #if PY_VERSION_HEX < 0x030A0000 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #elif !defined(CYTHON_USE_TYPE_SLOTS) #define CYTHON_USE_TYPE_SLOTS 1 #endif #ifndef CYTHON_USE_TYPE_SPECS #define CYTHON_USE_TYPE_SPECS 0 #endif #ifndef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #ifndef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #elif !defined(CYTHON_USE_PYLIST_INTERNALS) #define CYTHON_USE_PYLIST_INTERNALS 1 #endif #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) #define CYTHON_USE_UNICODE_WRITER 1 #endif #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS) #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 #endif #ifndef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 1 #endif #ifndef CYTHON_ASSUME_SAFE_SIZE #define CYTHON_ASSUME_SAFE_SIZE 1 #endif #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #undef CYTHON_FAST_GIL #define CYTHON_FAST_GIL 0 #elif !defined(CYTHON_FAST_GIL) #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6) #endif #ifndef CYTHON_METH_FASTCALL #define CYTHON_METH_FASTCALL 1 #endif #ifndef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 1 #endif #ifndef CYTHON_PEP487_INIT_SUBCLASS #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif #ifndef CYTHON_USE_MODULE_STATE #define CYTHON_USE_MODULE_STATE 0 #endif #ifndef CYTHON_USE_SYS_MONITORING #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1) #endif #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 1 #endif #ifndef CYTHON_USE_AM_SEND #define CYTHON_USE_AM_SEND 1 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #elif !defined(CYTHON_USE_DICT_VERSIONS) #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE) #endif #ifndef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 1 #endif #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 #endif #ifndef CYTHON_USE_FREELISTS #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) #endif #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000 #undef CYTHON_IMMORTAL_CONSTANTS #define CYTHON_IMMORTAL_CONSTANTS 0 // definitely won't work #elif !defined(CYTHON_IMMORTAL_CONSTANTS) #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) #endif #endif #ifndef CYTHON_COMPRESS_STRINGS #define CYTHON_COMPRESS_STRINGS 1 #endif #ifndef CYTHON_FAST_PYCCALL #define CYTHON_FAST_PYCCALL CYTHON_FAST_PYCALL #endif #ifndef CYTHON_VECTORCALL #if CYTHON_COMPILING_IN_LIMITED_API #define CYTHON_VECTORCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) #else #define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL) #endif #endif #if CYTHON_USE_PYLONG_INTERNALS #undef SHIFT #undef BASE #undef MASK #ifdef SIZEOF_VOID_P enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; #endif #endif #ifndef __has_attribute #define __has_attribute(x) 0 #endif #ifndef __has_cpp_attribute #define __has_cpp_attribute(x) 0 #endif #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict #else #define CYTHON_RESTRICT #endif #endif #ifndef CYTHON_UNUSED #if defined(__cplusplus) /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 * but leads to warnings with -pedantic, since it is a C++17 feature */ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) #if __has_cpp_attribute(maybe_unused) #define CYTHON_UNUSED [[maybe_unused]] #endif #endif #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_UNUSED_VAR # if defined(__cplusplus) template void CYTHON_UNUSED_VAR( const T& ) { } # else # define CYTHON_UNUSED_VAR(x) (void)(x) # endif #endif #ifndef CYTHON_MAYBE_UNUSED_VAR #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) #endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING # define CYTHON_NCP_UNUSED # else # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif #ifndef CYTHON_USE_CPP_STD_MOVE #if defined(__cplusplus) && (\ __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) #define CYTHON_USE_CPP_STD_MOVE 1 #else #define CYTHON_USE_CPP_STD_MOVE 0 #endif #endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #include typedef uintptr_t __pyx_uintptr_t; #ifndef CYTHON_FALLTHROUGH #if defined(__cplusplus) /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 * but leads to warnings with -pedantic, since it is a C++17 feature */ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) #if __has_cpp_attribute(fallthrough) #define CYTHON_FALLTHROUGH [[fallthrough]] #endif #endif #ifndef CYTHON_FALLTHROUGH #if __has_cpp_attribute(clang::fallthrough) #define CYTHON_FALLTHROUGH [[clang::fallthrough]] #elif __has_cpp_attribute(gnu::fallthrough) #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] #endif #endif #endif #ifndef CYTHON_FALLTHROUGH #if __has_attribute(fallthrough) #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) #else #define CYTHON_FALLTHROUGH #endif #endif #if defined(__clang__) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif #ifndef Py_UNREACHABLE #define Py_UNREACHABLE() assert(0); abort() #endif #ifdef __cplusplus template struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) #else #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) #endif #if CYTHON_COMPILING_IN_PYPY == 1 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x030A0000) #else #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x03090000) #endif #define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) /* CInitCode */ #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 /* PythonCompatibility */ #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_DefaultClassType PyType_Type #if CYTHON_COMPILING_IN_LIMITED_API #ifndef CO_OPTIMIZED static int CO_OPTIMIZED; #endif #ifndef CO_NEWLOCALS static int CO_NEWLOCALS; #endif #ifndef CO_VARARGS static int CO_VARARGS; #endif #ifndef CO_VARKEYWORDS static int CO_VARKEYWORDS; #endif #ifndef CO_ASYNC_GENERATOR static int CO_ASYNC_GENERATOR; #endif #ifndef CO_GENERATOR static int CO_GENERATOR; #endif #ifndef CO_COROUTINE static int CO_COROUTINE; #endif #else #ifndef CO_COROUTINE #define CO_COROUTINE 0x80 #endif #ifndef CO_ASYNC_GENERATOR #define CO_ASYNC_GENERATOR 0x200 #endif #endif static int __Pyx_init_co_variables(void); #if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) #else #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) #endif #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) #define __Pyx_Py_Is(x, y) Py_Is(x, y) #else #define __Pyx_Py_Is(x, y) ((x) == (y)) #endif #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) #else #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) #endif #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) #else #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) #endif #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) #else #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) #endif #define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) #else #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) #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 Py_TPFLAGS_SEQUENCE #define Py_TPFLAGS_SEQUENCE 0 #endif #ifndef Py_TPFLAGS_MAPPING #define Py_TPFLAGS_MAPPING 0 #endif #ifndef Py_TPFLAGS_IMMUTABLETYPE #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8) #endif #ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7) #endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif #ifndef METH_FASTCALL #ifndef METH_FASTCALL #define METH_FASTCALL 0x80 #endif typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames); #else #if PY_VERSION_HEX >= 0x030d00A4 # define __Pyx_PyCFunctionFast PyCFunctionFast # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords #else # define __Pyx_PyCFunctionFast _PyCFunctionFast # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif #endif #if CYTHON_METH_FASTCALL #define __Pyx_METH_FASTCALL METH_FASTCALL #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords #else #define __Pyx_METH_FASTCALL METH_VARARGS #define __Pyx_PyCFunction_FastCall PyCFunction #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords #endif #if CYTHON_VECTORCALL #define __pyx_vectorcallfunc vectorcallfunc #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) #else #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) #endif #if PY_VERSION_HEX >= 0x030900B1 #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func) #else #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func) #endif #define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func) #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth) #elif !CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func) #endif #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags) static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) { return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self; } #endif static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) { #if CYTHON_COMPILING_IN_LIMITED_API return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc; #else return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; #endif } #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc) #if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000) #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); #else #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) #define __Pyx_PyCMethod PyCMethod #endif #ifndef METH_METHOD #define METH_METHOD 0x200 #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_LIMITED_API #define __Pyx_PyFrame_SetLineNumber(frame, lineno) #elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno)) #elif CYTHON_COMPILING_IN_GRAAL #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno)) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif #if CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_PyThreadState_Current PyThreadState_Get() #elif !CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x030d00A1 #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked() #else #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() #endif #if CYTHON_USE_MODULE_STATE static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op) { void *result; result = PyModule_GetState(op); if (!result) Py_FatalError("Couldn't find the module state"); return result; } #define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o) #else #define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global) #endif #define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype) #define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype) #define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype) #define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype) #if CYTHON_USE_TYPE_SLOTS #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype) #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL) #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) #else #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\ ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\ (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\ __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL) #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype) #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype) #endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else #define __Pyx_PyDict_NewPresized(n) PyDict_New() #endif #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS #define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); if (res == NULL) PyErr_Clear(); return res; } #elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000 #define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError #define __Pyx_PyDict_GetItemStr PyDict_GetItem #else static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { #if CYTHON_COMPILING_IN_PYPY return PyDict_GetItem(dict, name); #else PyDictEntry *ep; PyDictObject *mp = (PyDictObject*) dict; long hash = ((PyStringObject *) name)->ob_shash; assert(hash != -1); ep = (mp->ma_lookup)(mp, name, hash); if (ep == NULL) { return NULL; } return ep->me_value; #endif } #define __Pyx_PyDict_GetItemStr PyDict_GetItem #endif #if CYTHON_USE_TYPE_SLOTS #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) #else #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) #endif #define __Pyx_PyObject_GetIterNextFunc(iterator) __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc) #if CYTHON_USE_TYPE_SPECS #define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ PyTypeObject *type = Py_TYPE((PyObject*)obj);\ assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ PyObject_GC_Del(obj);\ Py_DECREF(type);\ } #else #define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) #endif #if CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) #define __Pyx_PyUnicode_DATA(u) ((void*)u) #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) #else #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_READY(op) (0) #else #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) #endif #define __Pyx_PyUnicode_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) ((int)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, (Py_UCS4) ch) #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) #else #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) #endif #endif #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 #if !defined(PyUnicode_DecodeUnicodeEscape) #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) #endif #if !defined(PyUnicode_Contains) #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) #endif #if !defined(PyByteArray_Check) #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) #endif #if !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif #endif #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 #define __Pyx_PySequence_ListKeepNew(obj)\ (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj)) #elif CYTHON_COMPILING_IN_CPYTHON #define __Pyx_PySequence_ListKeepNew(obj)\ (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) #else #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) #endif #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) #else #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) #endif enum __Pyx_ReferenceSharing { __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check __Pyx_ReferenceSharing_OwnStrongReference, __Pyx_ReferenceSharing_FunctionArgument, __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar }; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000 #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\ (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\ (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\ (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0))) #elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1) #else #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0) #endif #if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) #else #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i) #endif #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) #else #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i)) #endif #else #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i)) #endif #if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\ __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i)) #else #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i) #endif #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result) #elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { *result = PyObject_GetItem(dict, key); if (*result == NULL) { if (PyErr_ExceptionMatches(PyExc_KeyError)) { PyErr_Clear(); return 0; } return -1; } return 1; } #else static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { *result = PyDict_GetItemWithError(dict, key); if (*result == NULL) { return PyErr_Occurred() ? -1 : 0; } Py_INCREF(*result); return 1; } #endif #if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST #define __Pyx_VISIT_CONST(obj) Py_VISIT(obj) #else #define __Pyx_VISIT_CONST(obj) #endif #if CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i) #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i) #else #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i) #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i) #endif #if CYTHON_ASSUME_SAFE_SIZE #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o) #else #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString) #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) #endif #define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t #define __Pyx_PyLong_AsHash_t __Pyx_PyIndex_AsSsize_t #if __PYX_LIMITED_VERSION_HEX >= 0x030A0000 #define __Pyx_PySendResult PySendResult #else typedef enum { PYGEN_RETURN = 0, PYGEN_ERROR = -1, PYGEN_NEXT = 1, } __Pyx_PySendResult; #endif #if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3 typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result); #else #define __Pyx_pyiter_sendfunc sendfunc #endif #if !CYTHON_USE_AM_SEND #define __PYX_HAS_PY_AM_SEND 0 #elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000 #define __PYX_HAS_PY_AM_SEND 1 #else #define __PYX_HAS_PY_AM_SEND 2 // our own backported implementation #endif #if __PYX_HAS_PY_AM_SEND < 2 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods #else typedef struct { unaryfunc am_await; unaryfunc am_aiter; unaryfunc am_anext; __Pyx_pyiter_sendfunc am_send; } __Pyx_PyAsyncMethodsStruct; #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s)) #endif #if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0 #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21) #else #define __Pyx_TPFLAGS_HAVE_AM_SEND (0) #endif #if PY_VERSION_HEX >= 0x03090000 #define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get() #else #define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp #endif #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000 #ifdef __cplusplus extern "C" #endif PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); #endif #if CYTHON_COMPILING_IN_LIMITED_API static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) { int value; PyObject *py_value = PyObject_GetAttrString(inspect, name); if (!py_value) return 0; value = (int) PyLong_AsLong(py_value); Py_DECREF(py_value); *write_to = value; return value != -1 || !PyErr_Occurred(); } static int __Pyx_init_co_variables(void) { PyObject *inspect; int result; inspect = PyImport_ImportModule("inspect"); result = #if !defined(CO_OPTIMIZED) __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) && #endif #if !defined(CO_NEWLOCALS) __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) && #endif #if !defined(CO_VARARGS) __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) && #endif #if !defined(CO_VARKEYWORDS) __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) && #endif #if !defined(CO_ASYNC_GENERATOR) __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) && #endif #if !defined(CO_GENERATOR) __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) && #endif #if !defined(CO_COROUTINE) __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) && #endif 1; Py_DECREF(inspect); return result ? 0 : -1; } #else static int __Pyx_init_co_variables(void) { return 0; // It's a limited API-only feature } #endif /* MathInitCode */ #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) #ifndef _USE_MATH_DEFINES #define _USE_MATH_DEFINES #endif #endif #include #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) #define __Pyx_truncl trunc #else #define __Pyx_truncl truncl #endif #ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME #define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0 #endif #ifndef CYTHON_CLINE_IN_TRACEBACK #define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME #endif #if CYTHON_CLINE_IN_TRACEBACK #define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; } #else #define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; } #endif #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } #ifdef CYTHON_EXTERN_C #undef __PYX_EXTERN_C #define __PYX_EXTERN_C CYTHON_EXTERN_C #elif defined(__PYX_EXTERN_C) #ifdef _MSC_VER #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") #else #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. #endif #else #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #define __PYX_HAVE__planarity__classic__planarity #define __PYX_HAVE_API__planarity__classic__planarity /* Early includes */ #include #include #include "../c/graphLib/lowLevelUtils/appconst.h" #include "../c/graphLib/graph.h" #include "../c/graphLib/graphDFSUtils.h" #include "../c/graphLib/io/graphIO.h" #include "../c/graphLib/planarityRelated/graphPlanarity.h" #include "../c/graphLib/planarityRelated/graphOuterplanarity.h" #include "../c/graphLib/planarityRelated/graphDrawPlanar.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) #define CYTHON_WITHOUT_ASSERTIONS #endif #ifdef CYTHON_FREETHREADING_COMPATIBLE #if CYTHON_FREETHREADING_COMPATIBLE #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_NOT_USED #else #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED #endif #else #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED #endif #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 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))) ) static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { return (size_t) i < (size_t) limit; } #if defined (__cplusplus) && __cplusplus >= 201103L #include #define __Pyx_sst_abs(value) std::abs(value) #elif SIZEOF_INT >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) abs(value) #elif SIZEOF_LONG >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) labs(value) #elif defined (_MSC_VER) #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define __Pyx_sst_abs(value) llabs(value) #elif defined (__GNUC__) #define __Pyx_sst_abs(value) __builtin_llabs(value) #else #define __Pyx_sst_abs(value) ((value<0) ? -value : value) #endif static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*); #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 CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s) #else #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AsString(s)) #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s) #endif #define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) #define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) { #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef) return Py_NewRef(obj); #else Py_INCREF(obj); return obj; #endif } static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) { #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef) return Py_XNewRef(obj); #else Py_XINCREF(obj); return obj; #endif } static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b); static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x); #define __Pyx_PySequence_Tuple(obj)\ (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t); static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x) #else #define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x) #endif #define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x)) #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) #if CYTHON_USE_PYLONG_INTERNALS #if PY_VERSION_HEX >= 0x030C00A7 #ifndef _PyLong_SIGN_MASK #define _PyLong_SIGN_MASK 3 #endif #ifndef _PyLong_NON_SIZE_BITS #define _PyLong_NON_SIZE_BITS 3 #endif #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) #define __Pyx_PyLong_SignedDigitCount(x)\ ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) #else #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) #endif typedef Py_ssize_t __Pyx_compact_pylong; typedef size_t __Pyx_compact_upylong; #else #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) #define __Pyx_PyLong_CompactValue(x)\ ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) typedef sdigit __Pyx_compact_pylong; typedef digit __Pyx_compact_upylong; #endif #if PY_VERSION_HEX >= 0x030C00A5 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) #else #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) #endif #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) #elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL) #else #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #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__ */ /* PretendToInitialize */ #ifdef __cplusplus #if __cplusplus > 201103L #include #endif template static void __Pyx_pretend_to_initialize(T* ptr) { #if __cplusplus > 201103L if ((std::is_trivially_default_constructible::value)) #endif *ptr = T(); (void)ptr; } #else static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } #endif #if !CYTHON_USE_MODULE_STATE static PyObject *__pyx_m = NULL; #endif static int __pyx_lineno; static int __pyx_clineno = 0; static const char * const __pyx_cfilenm = __FILE__; static const char *__pyx_filename; /* #### Code section: filename_table ### */ static const char* const __pyx_f[] = { "planarity/classic/planarity.pyx", "", }; /* #### Code section: utility_code_proto_before_types ### */ /* Atomics.proto (used by UnpackUnboundCMethod) */ #include #ifndef CYTHON_ATOMICS #define CYTHON_ATOMICS 1 #endif #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS #define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #define __pyx_atomic_int_type int #define __pyx_nonatomic_int_type int #if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ (__STDC_VERSION__ >= 201112L) &&\ !defined(__STDC_NO_ATOMICS__)) #include #elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ (__cplusplus >= 201103L) ||\ (defined(_MSC_VER) && _MSC_VER >= 1700))) #include #endif #if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ (__STDC_VERSION__ >= 201112L) &&\ !defined(__STDC_NO_ATOMICS__) &&\ ATOMIC_INT_LOCK_FREE == 2) #undef __pyx_atomic_int_type #define __pyx_atomic_int_type atomic_int #define __pyx_atomic_ptr_type atomic_uintptr_t #define __pyx_nonatomic_ptr_type uintptr_t #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel) #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg) #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) #define __pyx_atomic_load(value) atomic_load(value) #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value) #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed) #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire) #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) #pragma message ("Using standard C atomics") #elif defined(__PYX_DEBUG_ATOMICS) #warning "Using standard C atomics" #endif #elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ (__cplusplus >= 201103L) ||\ \ (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ ATOMIC_INT_LOCK_FREE == 2) #undef __pyx_atomic_int_type #define __pyx_atomic_int_type std::atomic_int #define __pyx_atomic_ptr_type std::atomic_uintptr_t #define __pyx_nonatomic_ptr_type uintptr_t #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel) #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg) #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) #define __pyx_atomic_load(value) std::atomic_load(value) #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value) #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed) #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire) #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) #pragma message ("Using standard C++ atomics") #elif defined(__PYX_DEBUG_ATOMICS) #warning "Using standard C++ atomics" #endif #elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ (__GNUC_MINOR__ > 1 ||\ (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) #define __pyx_atomic_ptr_type void* #define __pyx_nonatomic_ptr_type void* #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1) #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1) #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1) #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg) static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired); int result = old == *expected; *expected = old; return result; } #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0) #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value) #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0) #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0) #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value) static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired); int result = old == *expected; *expected = old; return result; } #ifdef __PYX_DEBUG_ATOMICS #warning "Using GNU atomics" #endif #elif CYTHON_ATOMICS && defined(_MSC_VER) #include #undef __pyx_atomic_int_type #define __pyx_atomic_int_type long #define __pyx_atomic_ptr_type void* #undef __pyx_nonatomic_int_type #define __pyx_nonatomic_int_type long #define __pyx_nonatomic_ptr_type void* #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer) #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1) #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1) #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1) #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg) static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected); int result = old == *expected; *expected = old; return result; } #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0) #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value) #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0) #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value) static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected); int result = old == *expected; *expected = old; return result; } #ifdef __PYX_DEBUG_ATOMICS #pragma message ("Using MSVC atomics") #endif #else #undef CYTHON_ATOMICS #define CYTHON_ATOMICS 0 #ifdef __PYX_DEBUG_ATOMICS #warning "Not using atomics" #endif #endif /* CriticalSectionsDefinition.proto (used by CriticalSections) */ #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #define __Pyx_PyCriticalSection void* #define __Pyx_PyCriticalSection2 void* #define __Pyx_PyCriticalSection_End(cs) #define __Pyx_PyCriticalSection2_End(cs) #else #define __Pyx_PyCriticalSection PyCriticalSection #define __Pyx_PyCriticalSection2 PyCriticalSection2 #define __Pyx_PyCriticalSection_End PyCriticalSection_End #define __Pyx_PyCriticalSection2_End PyCriticalSection2_End #endif /* CriticalSections.proto (used by ParseKeywordsImpl) */ #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs) #define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs) #else #define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin #define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin #endif #if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_BEGIN_CRITICAL_SECTION(o) { #define __Pyx_END_CRITICAL_SECTION() } #else #define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION #define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION #endif /* IncludeStructmemberH.proto (used by FixUpExtensionType) */ #include /* #### Code section: numeric_typedefs ### */ /* #### Code section: complex_type_declarations ### */ /* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ struct __pyx_obj_9planarity_7classic_9planarity_PGraph; /* "planarity/classic/planarity.pyx":12 * * * cdef class PGraph: # <<<<<<<<<<<<<< * cdef cplanarity.graphP theGraph * cdef dict nodemap */ struct __pyx_obj_9planarity_7classic_9planarity_PGraph { PyObject_HEAD graphP theGraph; PyObject *nodemap; PyObject *reverse_nodemap; int embedding; }; /* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, Py_ssize_t); void (*DECREF)(void*, PyObject*, Py_ssize_t); void (*GOTREF)(void*, PyObject*, Py_ssize_t); void (*GIVEREF)(void*, PyObject*, Py_ssize_t); void* (*SetupContext)(const char*, Py_ssize_t, 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; #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__));\ } #define __Pyx_RefNannyFinishContextNogil() {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ __Pyx_RefNannyFinishContext();\ PyGILState_Release(__pyx_gilstate_save);\ } #define __Pyx_RefNannyFinishContextNogil() {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ __Pyx_RefNannyFinishContext();\ PyGILState_Release(__pyx_gilstate_save);\ } #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); else {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContextNogil() #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_Py_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; Py_XDECREF(tmp);\ } while (0) #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) /* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); #else #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) #endif /* PyThreadStateGet.proto (used by PyErrFetchRestore) */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; #if PY_VERSION_HEX >= 0x030C00A6 #define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) #else #define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) #endif #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign #define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) #define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() #endif /* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) #else #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) #endif #else #define __Pyx_PyErr_Clear() PyErr_Clear() #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif /* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif /* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); /* TupleAndListFromArray.proto (used by fastcall) */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); #endif #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); #endif /* IncludeStringH.proto (used by BytesEquals) */ #include /* BytesEquals.proto (used by UnicodeEquals) */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /* UnicodeEquals.proto (used by fastcall) */ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /* fastcall.proto */ #if CYTHON_AVOID_BORROWED_REFS #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i) #elif CYTHON_ASSUME_SAFE_MACROS #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i)) #else #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i)) #endif #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) #define __Pyx_KwValues_VARARGS(args, nargs) NULL #define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) #define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) #if CYTHON_METH_FASTCALL #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i]) #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds) #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues); #else #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) #endif #else #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS #endif #define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) #if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start) #else #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) #endif /* py_dict_items.proto (used by OwnedDictNext) */ static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); /* CallCFunction.proto (used by CallUnboundCMethod0) */ #define __Pyx_CallCFunction(cfunc, self, args)\ ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args) #define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\ ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs) #define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\ ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs) #define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\ ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames) /* PyObjectCall.proto (used by PyObjectFastCall) */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); #else #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif /* PyObjectCallMethO.proto (used by PyObjectFastCall) */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif /* PyObjectFastCall.proto (used by PyObjectCallOneArg) */ #define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs); /* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); /* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */ typedef struct { PyObject *type; PyObject **method_name; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS __pyx_atomic_int_type initialized; #endif PyCFunction func; PyObject *method; int flag; } __Pyx_CachedCFunction; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) { #if !CYTHON_ATOMICS return 1; #else __pyx_nonatomic_int_type expected = 0; if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) { return 0; } return expected; #endif } static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) { #if CYTHON_ATOMICS __pyx_atomic_store(&cfunc->initialized, 2); #endif } #else #define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2 #define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc) #endif /* CallUnboundCMethod0.proto */ CYTHON_UNUSED static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); #else #define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self) #endif /* py_dict_values.proto (used by OwnedDictNext) */ static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); /* OwnedDictNext.proto (used by ParseKeywordsImpl) */ #if CYTHON_AVOID_BORROWED_REFS static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue); #else CYTHON_INLINE static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue); #endif /* RaiseDoubleKeywords.proto (used by ParseKeywordsImpl) */ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /* ParseKeywordsImpl.export */ static int __Pyx_ParseKeywordsTuple( PyObject *kwds, PyObject * const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs ); static int __Pyx_ParseKeywordDictToDict( PyObject *kwds, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name ); static int __Pyx_ParseKeywordDict( PyObject *kwds, PyObject ** const argnames[], PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs ); /* CallUnboundCMethod2.proto */ CYTHON_UNUSED static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2); #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2); #else #define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) #endif /* ParseKeywords.proto */ static CYTHON_INLINE int __Pyx_ParseKeywords( PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs ); /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /* HasAttr.proto */ #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n) #else static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); #endif /* PyObjectFastCallMethod.proto */ #if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 #define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL) #else static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf); #endif /* IterFinish.proto (used by dict_iter) */ static CYTHON_INLINE int __Pyx_IterFinish(void); /* PyObjectCallNoArg.proto (used by PyObjectCallMethod0) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); /* PyObjectGetMethod.proto (used by PyObjectCallMethod0) */ #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); #endif /* PyObjectCallMethod0.proto (used by dict_iter) */ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); /* RaiseNeedMoreValuesToUnpack.proto (used by UnpackTuple2) */ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); /* RaiseTooManyValuesToUnpack.proto (used by UnpackItemEndCheck) */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); /* UnpackItemEndCheck.proto (used by UnpackTuple2) */ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /* RaiseNoneIterError.proto (used by UnpackTupleError) */ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); /* UnpackTupleError.proto (used by UnpackTuple2) */ static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /* UnpackTuple2.proto (used by dict_iter) */ static CYTHON_INLINE int __Pyx_unpack_tuple2( PyObject* tuple, PyObject** value1, PyObject** value2, int is_tuple, int has_known_size, int decref_tuple); static CYTHON_INLINE int __Pyx_unpack_tuple2_exact( PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple); static int __Pyx_unpack_tuple2_generic( PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple); /* dict_iter.proto */ static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name, Py_ssize_t* p_orig_length, int* p_is_dict); static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos, PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict); /* pyfrozenset_new.proto (used by PySetContains) */ static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it); /* PySetContains.proto */ static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq); /* ListCompAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { PyListObject* L = (PyListObject*) list; Py_ssize_t len = Py_SIZE(list); if (likely(L->allocated > len)) { Py_INCREF(x); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 L->ob_item[len] = x; #else PyList_SET_ITEM(list, len, x); #endif __Pyx_SET_SIZE(list, len + 1); return 0; } return PyList_Append(list, x); } #else #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) #endif /* GetTopmostException.proto (used by SaveResetException) */ #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); #endif /* SaveResetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); #else #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) #endif /* GetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); #endif /* PyRuntimeError_Check.proto */ #define __Pyx_PyExc_RuntimeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_RuntimeError) /* RaiseException.export */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /* PyRange_Check.proto */ #if CYTHON_COMPILING_IN_PYPY && !defined(PyRange_Check) #define PyRange_Check(obj) __Pyx_TypeCheck((obj), &PyRange_Type) #endif /* PyLongBinop.proto */ #if !CYTHON_COMPILING_IN_PYPY static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); #else #define __Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) #endif /* DictGetItem.proto */ #if !CYTHON_COMPILING_IN_PYPY static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); #define __Pyx_PyObject_Dict_GetItem(obj, name)\ (likely(PyDict_CheckExact(obj)) ?\ __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) #else #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) #endif /* PyDictVersioning.proto (used by GetModuleGlobalName) */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ (version_var) = __PYX_GET_DICT_VERSION(dict);\ (cache_var) = (value); #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\ } else {\ (VAR) = __pyx_dict_cached_value = (LOOKUP);\ __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ }\ } static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); #else #define __PYX_GET_DICT_VERSION(dict) (0) #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); #endif /* GetModuleGlobalName.proto */ #if CYTHON_USE_DICT_VERSIONS #define __Pyx_GetModuleGlobalName(var, name) do {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\ (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ } while(0) #define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ PY_UINT64_T __pyx_dict_version;\ PyObject *__pyx_dict_cached_value;\ (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ } while(0) static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); #else #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif /* PyObject_Unicode.proto */ #define __Pyx_PyObject_Unicode(obj)\ (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj)) /* JoinPyUnicode.export */ static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength, Py_UCS4 max_char); /* RejectKeywords.export */ static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); /* PyObjectVectorCallKwBuilder.proto (used by PyObjectVectorCallMethodKwBuilder) */ CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); #if CYTHON_VECTORCALL #if PY_VERSION_HEX >= 0x03090000 #define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall #else #define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall #endif #define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n) static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n); #else #define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict #define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n) #define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value) #define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value) #endif /* PyObjectVectorCallMethodKwBuilder.proto */ #if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 #define __Pyx_Object_VectorcallMethod_CallFromBuilder PyObject_VectorcallMethod #else static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames); #endif /* ListAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { PyListObject* L = (PyListObject*) list; Py_ssize_t len = Py_SIZE(list); if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { Py_INCREF(x); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 L->ob_item[len] = x; #else PyList_SET_ITEM(list, len, x); #endif __Pyx_SET_SIZE(list, len + 1); return 0; } return PyList_Append(list, x); } #else #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) #endif /* decode_c_string_utf16.proto (used by decode_c_bytes) */ static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { int byteorder = 0; return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); } static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { int byteorder = -1; return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); } static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { int byteorder = 1; return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); } /* decode_c_bytes.proto (used by decode_bytes) */ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); /* decode_bytes.proto */ static CYTHON_INLINE PyObject* __Pyx_decode_bytes( PyObject* string, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { char* as_c_string; Py_ssize_t size; #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE as_c_string = PyBytes_AS_STRING(string); size = PyBytes_GET_SIZE(string); #else if (PyBytes_AsStringAndSize(string, &as_c_string, &size) < 0) { return NULL; } #endif return __Pyx_decode_c_bytes( as_c_string, size, start, stop, encoding, errors, decode_func); } /* PyTypeError_Check.proto */ #define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError) /* AllocateExtensionType.proto */ static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final); /* CallTypeTraverse.proto */ #if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) #define __Pyx_call_type_traverse(o, always_call, visit, arg) 0 #else static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg); #endif /* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */ #if CYTHON_COMPILING_IN_LIMITED_API static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp); #endif /* SetItemOnTypeDict.proto (used by FixUpExtensionType) */ static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v); #define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v) /* FixUpExtensionType.proto */ static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); /* ValidateBasesTuple.proto (used by PyType_Ready) */ #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); #endif /* PyType_Ready.proto */ CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); /* DelItemOnTypeDict.proto (used by SetupReduce) */ static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k); #define __Pyx_DelItemOnTypeDict(tp, k) __Pyx__DelItemOnTypeDict((PyTypeObject*)tp, k) /* SetupReduce.proto */ static int __Pyx_setup_reduce(PyObject* type_obj); /* ImportImpl.export */ static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level); /* Import.proto */ static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level); /* dict_setdefault.proto (used by FetchCommonType) */ static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value); /* AddModuleRef.proto (used by FetchSharedCythonModule) */ #if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\ __PYX_LIMITED_VERSION_HEX < 0x030d0000) static PyObject *__Pyx_PyImport_AddModuleRef(const char *name); #else #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) #endif /* FetchSharedCythonModule.proto (used by FetchCommonType) */ static PyObject *__Pyx_FetchSharedCythonABIModule(void); /* FetchCommonType.proto (used by CommonTypesMetaclass) */ static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases); /* CommonTypesMetaclass.proto (used by CythonFunctionShared) */ static int __pyx_CommonTypesMetaclass_init(PyObject *module); #define __Pyx_CommonTypesMetaclass_USED /* PyMethodNew.proto (used by CythonFunctionShared) */ static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ); /* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */ #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); #endif /* CythonFunctionShared.proto (used by CythonFunction) */ #define __Pyx_CyFunction_USED #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 #define __Pyx_CYFUNCTION_CCLASS 0x04 #define __Pyx_CYFUNCTION_COROUTINE 0x08 #define __Pyx_CyFunction_GetClosure(f)\ (((__pyx_CyFunctionObject *) (f))->func_closure) #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_CyFunction_GetClassObj(f)\ (((__pyx_CyFunctionObject *) (f))->func_classobj) #else #define __Pyx_CyFunction_GetClassObj(f)\ ((PyObject*) ((PyCMethodObject *) (f))->mm_class) #endif #define __Pyx_CyFunction_SetClassObj(f, classobj)\ __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) #define __Pyx_CyFunction_Defaults(type, f)\ ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) typedef struct { #if CYTHON_COMPILING_IN_LIMITED_API PyObject_HEAD PyObject *func; #elif PY_VERSION_HEX < 0x030900B1 PyCFunctionObject func; #else PyCMethodObject func; #endif #if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL __pyx_vectorcallfunc func_vectorcall; #endif #if CYTHON_COMPILING_IN_LIMITED_API PyObject *func_weakreflist; #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API PyObject *func_dict; #endif PyObject *func_name; PyObject *func_qualname; PyObject *func_doc; PyObject *func_globals; PyObject *func_code; PyObject *func_closure; #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API PyObject *func_classobj; #endif PyObject *defaults; int flags; PyObject *defaults_tuple; PyObject *defaults_kwdict; PyObject *(*defaults_getter)(PyObject *); PyObject *func_annotations; PyObject *func_is_coroutine; } __pyx_CyFunctionObject; #undef __Pyx_CyOrPyCFunction_Check #define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType) #define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type) #define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType) static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)); #undef __Pyx_IsSameCFunction #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc) static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject *globals, PyObject* code); static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type); static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, PyObject *tuple); static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, PyObject *dict); static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, PyObject *dict); static int __pyx_CyFunction_init(PyObject *module); #if CYTHON_METH_FASTCALL static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); #if CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) #else #define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) #endif #endif /* CythonFunction.proto */ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject *globals, PyObject* code); /* CLineInTraceback.proto (used by AddTraceback) */ #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #else #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) #endif /* CodeObjectCache.proto (used by AddTraceback) */ #if CYTHON_COMPILING_IN_LIMITED_API typedef PyObject __Pyx_CachedCodeObjectType; #else typedef PyCodeObject __Pyx_CachedCodeObjectType; #endif typedef struct { __Pyx_CachedCodeObjectType* code_object; int code_line; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_atomic_int_type accessor_count; #endif }; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object); /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* GCCDiagnostics.proto */ #if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) #define __Pyx_HAS_GCC_DIAGNOSTIC #endif /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value); /* FormatTypeName.proto */ #if CYTHON_COMPILING_IN_LIMITED_API typedef PyObject *__Pyx_TypeName; #define __Pyx_FMT_TYPENAME "%U" #define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName #else static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp); #endif #else // !LIMITED_API typedef const char *__Pyx_TypeName; #define __Pyx_FMT_TYPENAME "%.200s" #define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name) #define __Pyx_DECREF_TypeName(obj) #endif /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); /* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) { return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2); } #endif #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) #ifdef PyExceptionInstance_Check #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj) #else #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException) #endif /* GetRuntimeVersion.proto */ #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 static unsigned long __Pyx_cached_runtime_version = 0; static void __Pyx_init_runtime_version(void); #else #define __Pyx_init_runtime_version() #endif static unsigned long __Pyx_get_runtime_version(void); /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); /* DecompressString.proto */ static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo); /* MultiPhaseInitModuleState.proto */ #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE static PyObject *__Pyx_State_FindModule(void*); static int __Pyx_State_AddModule(PyObject* module, void*); static int __Pyx_State_RemoveModule(void*); #elif CYTHON_USE_MODULE_STATE #define __Pyx_State_FindModule PyState_FindModule #define __Pyx_State_AddModule PyState_AddModule #define __Pyx_State_RemoveModule PyState_RemoveModule #endif /* #### Code section: module_declarations ### */ /* CythonABIVersion.proto */ #if CYTHON_COMPILING_IN_LIMITED_API #if CYTHON_METH_FASTCALL #define __PYX_FASTCALL_ABI_SUFFIX "_fastcall" #else #define __PYX_FASTCALL_ABI_SUFFIX #endif #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX #else #define __PYX_LIMITED_ABI_SUFFIX #endif #if __PYX_HAS_PY_AM_SEND == 1 #define __PYX_AM_SEND_ABI_SUFFIX #elif __PYX_HAS_PY_AM_SEND == 2 #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport" #else #define __PYX_AM_SEND_ABI_SUFFIX "noamsend" #endif #ifndef __PYX_MONITORING_ABI_SUFFIX #define __PYX_MONITORING_ABI_SUFFIX #endif #if CYTHON_USE_TP_FINALIZE #define __PYX_TP_FINALIZE_ABI_SUFFIX #else #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize" #endif #if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED) #define __PYX_FREELISTS_ABI_SUFFIX #else #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists" #endif #define CYTHON_ABI __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." /* Module declarations from "libc.string" */ /* Module declarations from "libc.stdlib" */ /* Module declarations from "planarity.classic" */ /* Module declarations from "planarity.classic.cplanarity" */ /* Module declarations from "planarity.classic.planarity" */ /* #### Code section: typeinfo ### */ /* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "planarity.classic.planarity" extern int __pyx_module_is_main_planarity__classic__planarity; int __pyx_module_is_main_planarity__classic__planarity = 0; /* Implementation of "planarity.classic.planarity" */ /* #### Code section: global_var ### */ static PyObject *__pyx_builtin_zip; /* #### Code section: string_decls ### */ static const char __pyx_k_Wrapper_for_Boyer_s_c_planarity[] = "\nWrapper for Boyer's (c) planarity algorithms.\n"; /* #### Code section: decls ### */ static int __pyx_pf_9planarity_7classic_9planarity_6PGraph___init__(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self, PyObject *__pyx_v_graph); /* proto */ static void __pyx_pf_9planarity_7classic_9planarity_6PGraph_2__dealloc__(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_4embed_planar(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_6embed_drawplanar(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_8is_planar(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_10kuratowski_edges(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_12nodes(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self, PyObject *__pyx_v_include_drawplanar_vertex_info); /* proto */ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self, PyObject *__pyx_v_include_drawplanar_edge_info); /* proto */ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_16ascii(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_18write(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self, PyObject *__pyx_v_path); /* proto */ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_20mapping(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_tp_new_9planarity_7classic_9planarity_PGraph(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ /* #### Code section: late_includes ### */ /* #### Code section: module_state ### */ /* SmallCodeConfig */ #ifndef CYTHON_SMALL_CODE #if defined(__clang__) #define CYTHON_SMALL_CODE #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) #define CYTHON_SMALL_CODE __attribute__((cold)) #else #define CYTHON_SMALL_CODE #endif #endif typedef struct { PyObject *__pyx_d; PyObject *__pyx_b; PyObject *__pyx_cython_runtime; PyObject *__pyx_empty_tuple; PyObject *__pyx_empty_bytes; PyObject *__pyx_empty_unicode; PyObject *__pyx_type_9planarity_7classic_9planarity_PGraph; PyTypeObject *__pyx_ptype_9planarity_7classic_9planarity_PGraph; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; PyObject *__pyx_tuple[1]; PyObject *__pyx_codeobj_tab[11]; PyObject *__pyx_string_tab[102]; PyObject *__pyx_number_tab[1]; /* #### Code section: module_state_contents ### */ /* CommonTypesMetaclass.module_state_decls */ PyTypeObject *__pyx_CommonTypesMetaclassType; /* CachedMethodType.module_state_decls */ #if CYTHON_COMPILING_IN_LIMITED_API PyObject *__Pyx_CachedMethodType; #endif /* CythonFunctionShared.module_state_decls */ PyTypeObject *__pyx_CyFunctionType; /* CodeObjectCache.module_state_decls */ struct __Pyx_CodeObjectCache __pyx_code_cache; /* #### Code section: module_state_end ### */ } __pyx_mstatetype; #if CYTHON_USE_MODULE_STATE #ifdef __cplusplus namespace { extern struct PyModuleDef __pyx_moduledef; } /* anonymous namespace */ #else static struct PyModuleDef __pyx_moduledef; #endif #define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef))) #define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef)) #else static __pyx_mstatetype __pyx_mstate_global_static = #ifdef __cplusplus {}; #else {0}; #endif static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static; #endif /* #### Code section: constant_name_defines ### */ #define __pyx_kp_u_ __pyx_string_tab[0] #define __pyx_kp_u_Unknown_input_type __pyx_string_tab[1] #define __pyx_kp_u__2 __pyx_string_tab[2] #define __pyx_kp_u_disable __pyx_string_tab[3] #define __pyx_kp_u_enable __pyx_string_tab[4] #define __pyx_kp_u_gc __pyx_string_tab[5] #define __pyx_kp_u_ignoring_parallel_edge __pyx_string_tab[6] #define __pyx_kp_u_isenabled __pyx_string_tab[7] #define __pyx_kp_u_planarity_Unknown_error __pyx_string_tab[8] #define __pyx_kp_u_planarity_classic_planarity_pyx __pyx_string_tab[9] #define __pyx_kp_u_planarity_failed_adding_edge __pyx_string_tab[10] #define __pyx_kp_u_planarity_failed_to_extend_graph __pyx_string_tab[11] #define __pyx_kp_u_planarity_failed_to_extend_graph_2 __pyx_string_tab[12] #define __pyx_kp_u_planarity_failed_to_initialize_g __pyx_string_tab[13] #define __pyx_kp_u_planarity_graph_not_planar __pyx_string_tab[14] #define __pyx_kp_u_self_theGraph_cannot_be_converte __pyx_string_tab[15] #define __pyx_kp_u_stringsource __pyx_string_tab[16] #define __pyx_n_u_PGraph __pyx_string_tab[17] #define __pyx_n_u_PGraph___reduce_cython __pyx_string_tab[18] #define __pyx_n_u_PGraph___setstate_cython __pyx_string_tab[19] #define __pyx_n_u_PGraph_ascii __pyx_string_tab[20] #define __pyx_n_u_PGraph_edges __pyx_string_tab[21] #define __pyx_n_u_PGraph_embed_drawplanar __pyx_string_tab[22] #define __pyx_n_u_PGraph_embed_planar __pyx_string_tab[23] #define __pyx_n_u_PGraph_is_planar __pyx_string_tab[24] #define __pyx_n_u_PGraph_kuratowski_edges __pyx_string_tab[25] #define __pyx_n_u_PGraph_mapping __pyx_string_tab[26] #define __pyx_n_u_PGraph_nodes __pyx_string_tab[27] #define __pyx_n_u_PGraph_write __pyx_string_tab[28] #define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[29] #define __pyx_n_u_ascii __pyx_string_tab[30] #define __pyx_n_u_asyncio_coroutines __pyx_string_tab[31] #define __pyx_n_u_bpath __pyx_string_tab[32] #define __pyx_n_u_cline_in_traceback __pyx_string_tab[33] #define __pyx_n_u_drawplanar_edge_info __pyx_string_tab[34] #define __pyx_n_u_drawplanar_vertex_info __pyx_string_tab[35] #define __pyx_n_u_e __pyx_string_tab[36] #define __pyx_n_u_edge_end __pyx_string_tab[37] #define __pyx_n_u_edge_position __pyx_string_tab[38] #define __pyx_n_u_edge_start __pyx_string_tab[39] #define __pyx_n_u_edges __pyx_string_tab[40] #define __pyx_n_u_embed_drawplanar __pyx_string_tab[41] #define __pyx_n_u_embed_planar __pyx_string_tab[42] #define __pyx_n_u_encode __pyx_string_tab[43] #define __pyx_n_u_extend __pyx_string_tab[44] #define __pyx_n_u_first __pyx_string_tab[45] #define __pyx_n_u_func __pyx_string_tab[46] #define __pyx_n_u_getstate __pyx_string_tab[47] #define __pyx_n_u_graph __pyx_string_tab[48] #define __pyx_n_u_include_drawplanar_edge_info __pyx_string_tab[49] #define __pyx_n_u_include_drawplanar_vertex_info __pyx_string_tab[50] #define __pyx_n_u_is_coroutine __pyx_string_tab[51] #define __pyx_n_u_is_edge __pyx_string_tab[52] #define __pyx_n_u_is_planar __pyx_string_tab[53] #define __pyx_n_u_items __pyx_string_tab[54] #define __pyx_n_u_keys __pyx_string_tab[55] #define __pyx_n_u_kuratowski_edges __pyx_string_tab[56] #define __pyx_n_u_last __pyx_string_tab[57] #define __pyx_n_u_main __pyx_string_tab[58] #define __pyx_n_u_mapping __pyx_string_tab[59] #define __pyx_n_u_module __pyx_string_tab[60] #define __pyx_n_u_name __pyx_string_tab[61] #define __pyx_n_u_nbr __pyx_string_tab[62] #define __pyx_n_u_nodes __pyx_string_tab[63] #define __pyx_n_u_path __pyx_string_tab[64] #define __pyx_n_u_planarity_classic_planarity __pyx_string_tab[65] #define __pyx_n_u_pop __pyx_string_tab[66] #define __pyx_n_u_py_bytes __pyx_string_tab[67] #define __pyx_n_u_pyx_state __pyx_string_tab[68] #define __pyx_n_u_qualname __pyx_string_tab[69] #define __pyx_n_u_r __pyx_string_tab[70] #define __pyx_n_u_reduce __pyx_string_tab[71] #define __pyx_n_u_reduce_cython __pyx_string_tab[72] #define __pyx_n_u_reduce_ex __pyx_string_tab[73] #define __pyx_n_u_s __pyx_string_tab[74] #define __pyx_n_u_self __pyx_string_tab[75] #define __pyx_n_u_set_name __pyx_string_tab[76] #define __pyx_n_u_setdefault __pyx_string_tab[77] #define __pyx_n_u_setstate __pyx_string_tab[78] #define __pyx_n_u_setstate_cython __pyx_string_tab[79] #define __pyx_n_u_status __pyx_string_tab[80] #define __pyx_n_u_test __pyx_string_tab[81] #define __pyx_n_u_update __pyx_string_tab[82] #define __pyx_n_u_v __pyx_string_tab[83] #define __pyx_n_u_values __pyx_string_tab[84] #define __pyx_n_u_vertex_end __pyx_string_tab[85] #define __pyx_n_u_vertex_position __pyx_string_tab[86] #define __pyx_n_u_vertex_start __pyx_string_tab[87] #define __pyx_n_u_warn __pyx_string_tab[88] #define __pyx_n_u_warnings __pyx_string_tab[89] #define __pyx_n_u_write __pyx_string_tab[90] #define __pyx_n_u_zip __pyx_string_tab[91] #define __pyx_kp_b_iso88591_1_a_a_at1_Qd_E_avQ_4_4_A_q_Kq_4 __pyx_string_tab[92] #define __pyx_kp_b_iso88591_31_at1_Qd_a_a_E_awa_q_J_4_Z_DAT __pyx_string_tab[93] #define __pyx_kp_b_iso88591_A_4AT_7_q_aq_9AT_78_7_q_aq_4q __pyx_string_tab[94] #define __pyx_kp_b_iso88591_A_4_Q_31D_7_q_aq_9AT_67_4q __pyx_string_tab[95] #define __pyx_kp_b_iso88591_A_4z_1_M_4vQ_1_aq __pyx_string_tab[96] #define __pyx_kp_b_iso88591_A_M_D_1_q __pyx_string_tab[97] #define __pyx_kp_b_iso88591_A_d_4 __pyx_string_tab[98] #define __pyx_kp_b_iso88591_A_q_Q_8_1A_AQ_xwaq __pyx_string_tab[99] #define __pyx_kp_b_iso88591_A_t1 __pyx_string_tab[100] #define __pyx_kp_b_iso88591_Q __pyx_string_tab[101] #define __pyx_int_1 __pyx_number_tab[0] /* #### Code section: module_state_clear ### */ #if CYTHON_USE_MODULE_STATE static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m); if (!clear_module_state) return 0; Py_CLEAR(clear_module_state->__pyx_d); Py_CLEAR(clear_module_state->__pyx_b); Py_CLEAR(clear_module_state->__pyx_cython_runtime); Py_CLEAR(clear_module_state->__pyx_empty_tuple); Py_CLEAR(clear_module_state->__pyx_empty_bytes); Py_CLEAR(clear_module_state->__pyx_empty_unicode); #if CYTHON_PEP489_MULTI_PHASE_INIT __Pyx_State_RemoveModule(NULL); #endif Py_CLEAR(clear_module_state->__pyx_ptype_9planarity_7classic_9planarity_PGraph); Py_CLEAR(clear_module_state->__pyx_type_9planarity_7classic_9planarity_PGraph); for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); } for (int i=0; i<11; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } for (int i=0; i<102; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); } /* #### Code section: module_state_clear_contents ### */ /* CommonTypesMetaclass.module_state_clear */ Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType); /* CythonFunctionShared.module_state_clear */ Py_CLEAR(clear_module_state->__pyx_CyFunctionType); /* #### Code section: module_state_clear_end ### */ return 0; } #endif /* #### Code section: module_state_traverse ### */ #if CYTHON_USE_MODULE_STATE static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m); if (!traverse_module_state) return 0; Py_VISIT(traverse_module_state->__pyx_d); Py_VISIT(traverse_module_state->__pyx_b); Py_VISIT(traverse_module_state->__pyx_cython_runtime); __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple); __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes); __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode); Py_VISIT(traverse_module_state->__pyx_ptype_9planarity_7classic_9planarity_PGraph); Py_VISIT(traverse_module_state->__pyx_type_9planarity_7classic_9planarity_PGraph); for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); } for (int i=0; i<11; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } for (int i=0; i<102; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); } /* #### Code section: module_state_traverse_contents ### */ /* CommonTypesMetaclass.module_state_traverse */ Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType); /* CythonFunctionShared.module_state_traverse */ Py_VISIT(traverse_module_state->__pyx_CyFunctionType); /* #### Code section: module_state_traverse_end ### */ return 0; } #endif /* #### Code section: module_code ### */ /* "planarity/classic/planarity.pyx":17 * cdef dict reverse_nodemap * cdef int embedding * def __init__(self,graph): # <<<<<<<<<<<<<< * # guess input type * if hasattr(graph,'nodes'): */ /* Python wrapper */ static int __pyx_pw_9planarity_7classic_9planarity_6PGraph_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_9planarity_7classic_9planarity_6PGraph_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_graph = 0; CYTHON_UNUSED Py_ssize_t __pyx_nargs; CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; #endif __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_graph,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 17, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 17, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__init__", 0) < (0)) __PYX_ERR(0, 17, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, i); __PYX_ERR(0, 17, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 17, __pyx_L3_error) } __pyx_v_graph = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 17, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.classic.planarity.PGraph.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_7classic_9planarity_6PGraph___init__(((struct __pyx_obj_9planarity_7classic_9planarity_PGraph *)__pyx_v_self), __pyx_v_graph); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_9planarity_7classic_9planarity_6PGraph___init__(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self, PyObject *__pyx_v_graph) { PyObject *__pyx_v_nodes = NULL; PyObject *__pyx_v_edges = NULL; PyObject *__pyx_v_seen = NULL; PyObject *__pyx_v_node = NULL; PyObject *__pyx_v_adj = NULL; PyObject *__pyx_v_nbrs = NULL; Py_ssize_t __pyx_v_l; PyObject *__pyx_v_n = NULL; int __pyx_v_status; PyObject *__pyx_v_u = NULL; PyObject *__pyx_v_v = NULL; PyObject *__pyx_7genexpr__pyx_v_n = NULL; PyObject *__pyx_8genexpr1__pyx_v_sublist = NULL; PyObject *__pyx_8genexpr1__pyx_v_node = NULL; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; Py_ssize_t __pyx_t_5; Py_ssize_t __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; int __pyx_t_9; Py_ssize_t __pyx_t_10; PyObject *(*__pyx_t_11)(PyObject *); PyObject *__pyx_t_12 = NULL; PyObject *__pyx_t_13 = NULL; PyObject *__pyx_t_14 = NULL; int __pyx_t_15; PyObject *__pyx_t_16 = NULL; PyObject *__pyx_t_17 = NULL; PyObject *__pyx_t_18 = NULL; PyObject *(*__pyx_t_19)(PyObject *); PyObject *__pyx_t_20 = NULL; PyObject *(*__pyx_t_21)(PyObject *); int __pyx_t_22; PyObject *__pyx_t_23[4]; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); /* "planarity/classic/planarity.pyx":19 * def __init__(self,graph): * # guess input type * if hasattr(graph,'nodes'): # <<<<<<<<<<<<<< * # NetworkX graph * nodes=list(graph.nodes()) */ __pyx_t_1 = __Pyx_HasAttr(__pyx_v_graph, __pyx_mstate_global->__pyx_n_u_nodes); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 19, __pyx_L1_error) if (__pyx_t_1) { /* "planarity/classic/planarity.pyx":21 * if hasattr(graph,'nodes'): * # NetworkX graph * nodes=list(graph.nodes()) # <<<<<<<<<<<<<< * edges=list(graph.edges()) * elif hasattr(graph,'keys'): */ __pyx_t_3 = __pyx_v_graph; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_nodes, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_3 = __Pyx_PySequence_ListKeepNew(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_nodes = __pyx_t_3; __pyx_t_3 = 0; /* "planarity/classic/planarity.pyx":22 * # NetworkX graph * nodes=list(graph.nodes()) * edges=list(graph.edges()) # <<<<<<<<<<<<<< * elif hasattr(graph,'keys'): * # adjacency dict of dicts|sets|lists */ __pyx_t_2 = __pyx_v_graph; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_edges, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_edges = __pyx_t_2; __pyx_t_2 = 0; /* "planarity/classic/planarity.pyx":19 * def __init__(self,graph): * # guess input type * if hasattr(graph,'nodes'): # <<<<<<<<<<<<<< * # NetworkX graph * nodes=list(graph.nodes()) */ goto __pyx_L3; } /* "planarity/classic/planarity.pyx":23 * nodes=list(graph.nodes()) * edges=list(graph.edges()) * elif hasattr(graph,'keys'): # <<<<<<<<<<<<<< * # adjacency dict of dicts|sets|lists * nodes=graph.keys() */ __pyx_t_1 = __Pyx_HasAttr(__pyx_v_graph, __pyx_mstate_global->__pyx_n_u_keys); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 23, __pyx_L1_error) if (__pyx_t_1) { /* "planarity/classic/planarity.pyx":25 * elif hasattr(graph,'keys'): * # adjacency dict of dicts|sets|lists * nodes=graph.keys() # <<<<<<<<<<<<<< * edges=[] * seen=set() */ __pyx_t_3 = __pyx_v_graph; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_keys, __pyx_callargs+__pyx_t_4, (1-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_v_nodes = __pyx_t_2; __pyx_t_2 = 0; /* "planarity/classic/planarity.pyx":26 * # adjacency dict of dicts|sets|lists * nodes=graph.keys() * edges=[] # <<<<<<<<<<<<<< * seen=set() * for node,adj in graph.items(): */ __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_edges = __pyx_t_2; __pyx_t_2 = 0; /* "planarity/classic/planarity.pyx":27 * nodes=graph.keys() * edges=[] * seen=set() # <<<<<<<<<<<<<< * for node,adj in graph.items(): * nbrs=[n for n in adj if n not in seen] */ __pyx_t_2 = PySet_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_seen = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; /* "planarity/classic/planarity.pyx":28 * edges=[] * seen=set() * for node,adj in graph.items(): # <<<<<<<<<<<<<< * nbrs=[n for n in adj if n not in seen] * l=len(nbrs) */ __pyx_t_5 = 0; if (unlikely(__pyx_v_graph == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); __PYX_ERR(0, 28, __pyx_L1_error) } __pyx_t_3 = __Pyx_dict_iterator(__pyx_v_graph, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_6), (&__pyx_t_7)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = __pyx_t_3; __pyx_t_3 = 0; while (1) { __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_6, &__pyx_t_5, &__pyx_t_3, &__pyx_t_8, NULL, __pyx_t_7); if (unlikely(__pyx_t_9 == 0)) break; if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF_SET(__pyx_v_node, __pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF_SET(__pyx_v_adj, __pyx_t_8); __pyx_t_8 = 0; /* "planarity/classic/planarity.pyx":29 * seen=set() * for node,adj in graph.items(): * nbrs=[n for n in adj if n not in seen] # <<<<<<<<<<<<<< * l=len(nbrs) * edges.extend(zip([node]*l,nbrs)) */ { /* enter inner scope */ __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 29, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_8); if (likely(PyList_CheckExact(__pyx_v_adj)) || PyTuple_CheckExact(__pyx_v_adj)) { __pyx_t_3 = __pyx_v_adj; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; __pyx_t_11 = NULL; } else { __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_adj); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L8_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 29, __pyx_L8_error) } for (;;) { if (likely(!__pyx_t_11)) { if (likely(PyList_CheckExact(__pyx_t_3))) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 29, __pyx_L8_error) #endif if (__pyx_t_10 >= __pyx_temp) break; } __pyx_t_12 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_10, __Pyx_ReferenceSharing_OwnStrongReference); ++__pyx_t_10; } else { { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 29, __pyx_L8_error) #endif if (__pyx_t_10 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_12 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10)); #else __pyx_t_12 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_10); #endif ++__pyx_t_10; } if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 29, __pyx_L8_error) } else { __pyx_t_12 = __pyx_t_11(__pyx_t_3); if (unlikely(!__pyx_t_12)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 29, __pyx_L8_error) PyErr_Clear(); } break; } } __Pyx_GOTREF(__pyx_t_12); __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_n, __pyx_t_12); __pyx_t_12 = 0; __pyx_t_1 = (__Pyx_PySet_ContainsTF(__pyx_7genexpr__pyx_v_n, __pyx_v_seen, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 29, __pyx_L8_error) if (__pyx_t_1) { if (unlikely(__Pyx_ListComp_Append(__pyx_t_8, (PyObject*)__pyx_7genexpr__pyx_v_n))) __PYX_ERR(0, 29, __pyx_L8_error) } } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_7genexpr__pyx_v_n); __pyx_7genexpr__pyx_v_n = 0; goto __pyx_L13_exit_scope; __pyx_L8_error:; __Pyx_XDECREF(__pyx_7genexpr__pyx_v_n); __pyx_7genexpr__pyx_v_n = 0; goto __pyx_L1_error; __pyx_L13_exit_scope:; } /* exit inner scope */ __Pyx_XDECREF_SET(__pyx_v_nbrs, ((PyObject*)__pyx_t_8)); __pyx_t_8 = 0; /* "planarity/classic/planarity.pyx":30 * for node,adj in graph.items(): * nbrs=[n for n in adj if n not in seen] * l=len(nbrs) # <<<<<<<<<<<<<< * edges.extend(zip([node]*l,nbrs)) * seen.add(node) */ __pyx_t_10 = __Pyx_PyList_GET_SIZE(__pyx_v_nbrs); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 30, __pyx_L1_error) __pyx_v_l = __pyx_t_10; /* "planarity/classic/planarity.pyx":31 * nbrs=[n for n in adj if n not in seen] * l=len(nbrs) * edges.extend(zip([node]*l,nbrs)) # <<<<<<<<<<<<<< * seen.add(node) * else: */ __pyx_t_3 = __pyx_v_edges; __Pyx_INCREF(__pyx_t_3); __pyx_t_13 = NULL; __pyx_t_14 = PyList_New(1 * ((__pyx_v_l<0) ? 0:__pyx_v_l)); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < __pyx_v_l; __pyx_temp++) { __Pyx_INCREF(__pyx_v_node); __Pyx_GIVEREF(__pyx_v_node); if (__Pyx_PyList_SET_ITEM(__pyx_t_14, __pyx_temp, __pyx_v_node) != (0)) __PYX_ERR(0, 31, __pyx_L1_error); } } __pyx_t_4 = 1; { PyObject *__pyx_callargs[3] = {__pyx_t_13, __pyx_t_14, __pyx_v_nbrs}; __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); } __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_12}; __pyx_t_8 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_extend, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; /* "planarity/classic/planarity.pyx":32 * l=len(nbrs) * edges.extend(zip([node]*l,nbrs)) * seen.add(node) # <<<<<<<<<<<<<< * else: * # edge list (list of lists|tuples) */ __pyx_t_15 = PySet_Add(__pyx_v_seen, __pyx_v_node); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 32, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/classic/planarity.pyx":23 * nodes=list(graph.nodes()) * edges=list(graph.edges()) * elif hasattr(graph,'keys'): # <<<<<<<<<<<<<< * # adjacency dict of dicts|sets|lists * nodes=graph.keys() */ goto __pyx_L3; } /* "planarity/classic/planarity.pyx":35 * else: * # edge list (list of lists|tuples) * try: # <<<<<<<<<<<<<< * nodes=set([node for sublist in graph for node in sublist]) * except: */ /*else*/ { { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); /*try:*/ { /* "planarity/classic/planarity.pyx":36 * # edge list (list of lists|tuples) * try: * nodes=set([node for sublist in graph for node in sublist]) # <<<<<<<<<<<<<< * except: * raise RuntimeError("Unknown input type") */ { /* enter inner scope */ __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L22_error) __Pyx_GOTREF(__pyx_t_2); if (likely(PyList_CheckExact(__pyx_v_graph)) || PyTuple_CheckExact(__pyx_v_graph)) { __pyx_t_8 = __pyx_v_graph; __Pyx_INCREF(__pyx_t_8); __pyx_t_6 = 0; __pyx_t_11 = NULL; } else { __pyx_t_6 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_v_graph); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 36, __pyx_L22_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 36, __pyx_L22_error) } for (;;) { if (likely(!__pyx_t_11)) { if (likely(PyList_CheckExact(__pyx_t_8))) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_8); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 36, __pyx_L22_error) #endif if (__pyx_t_6 >= __pyx_temp) break; } __pyx_t_12 = __Pyx_PyList_GetItemRefFast(__pyx_t_8, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); ++__pyx_t_6; } else { { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_8); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 36, __pyx_L22_error) #endif if (__pyx_t_6 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_12 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_6)); #else __pyx_t_12 = __Pyx_PySequence_ITEM(__pyx_t_8, __pyx_t_6); #endif ++__pyx_t_6; } if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L22_error) } else { __pyx_t_12 = __pyx_t_11(__pyx_t_8); if (unlikely(!__pyx_t_12)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 36, __pyx_L22_error) PyErr_Clear(); } break; } } __Pyx_GOTREF(__pyx_t_12); __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_sublist, __pyx_t_12); __pyx_t_12 = 0; if (likely(PyList_CheckExact(__pyx_8genexpr1__pyx_v_sublist)) || PyTuple_CheckExact(__pyx_8genexpr1__pyx_v_sublist)) { __pyx_t_12 = __pyx_8genexpr1__pyx_v_sublist; __Pyx_INCREF(__pyx_t_12); __pyx_t_5 = 0; __pyx_t_19 = NULL; } else { __pyx_t_5 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_8genexpr1__pyx_v_sublist); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 36, __pyx_L22_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_19 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_12); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 36, __pyx_L22_error) } for (;;) { if (likely(!__pyx_t_19)) { if (likely(PyList_CheckExact(__pyx_t_12))) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_12); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 36, __pyx_L22_error) #endif if (__pyx_t_5 >= __pyx_temp) break; } __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_12, __pyx_t_5, __Pyx_ReferenceSharing_OwnStrongReference); ++__pyx_t_5; } else { { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_12); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 36, __pyx_L22_error) #endif if (__pyx_t_5 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_5)); #else __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_12, __pyx_t_5); #endif ++__pyx_t_5; } if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L22_error) } else { __pyx_t_3 = __pyx_t_19(__pyx_t_12); if (unlikely(!__pyx_t_3)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 36, __pyx_L22_error) PyErr_Clear(); } break; } } __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_node, __pyx_t_3); __pyx_t_3 = 0; if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_8genexpr1__pyx_v_node))) __PYX_ERR(0, 36, __pyx_L22_error) } __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_node); __pyx_8genexpr1__pyx_v_node = 0; __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_sublist); __pyx_8genexpr1__pyx_v_sublist = 0; goto __pyx_L29_exit_scope; __pyx_L22_error:; __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_node); __pyx_8genexpr1__pyx_v_node = 0; __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_sublist); __pyx_8genexpr1__pyx_v_sublist = 0; goto __pyx_L14_error; __pyx_L29_exit_scope:; } /* exit inner scope */ __pyx_t_8 = PySet_New(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 36, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_nodes = __pyx_t_8; __pyx_t_8 = 0; /* "planarity/classic/planarity.pyx":35 * else: * # edge list (list of lists|tuples) * try: # <<<<<<<<<<<<<< * nodes=set([node for sublist in graph for node in sublist]) * except: */ } __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0; __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; goto __pyx_L19_try_end; __pyx_L14_error:; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; /* "planarity/classic/planarity.pyx":37 * try: * nodes=set([node for sublist in graph for node in sublist]) * except: # <<<<<<<<<<<<<< * raise RuntimeError("Unknown input type") * edges=graph */ /*except:*/ { __Pyx_AddTraceback("planarity.classic.planarity.PGraph.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_2, &__pyx_t_12) < 0) __PYX_ERR(0, 37, __pyx_L16_except_error) __Pyx_XGOTREF(__pyx_t_8); __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_12); /* "planarity/classic/planarity.pyx":38 * nodes=set([node for sublist in graph for node in sublist]) * except: * raise RuntimeError("Unknown input type") # <<<<<<<<<<<<<< * edges=graph * n=len(nodes) */ __pyx_t_14 = NULL; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_mstate_global->__pyx_kp_u_Unknown_input_type}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L16_except_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 38, __pyx_L16_except_error) } /* "planarity/classic/planarity.pyx":35 * else: * # edge list (list of lists|tuples) * try: # <<<<<<<<<<<<<< * nodes=set([node for sublist in graph for node in sublist]) * except: */ __pyx_L16_except_error:; __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18); goto __pyx_L1_error; __pyx_L19_try_end:; } /* "planarity/classic/planarity.pyx":39 * except: * raise RuntimeError("Unknown input type") * edges=graph # <<<<<<<<<<<<<< * n=len(nodes) * self.nodemap=dict(zip(nodes,range(1,n+1))) */ __Pyx_INCREF(__pyx_v_graph); __pyx_v_edges = __pyx_v_graph; } __pyx_L3:; /* "planarity/classic/planarity.pyx":40 * raise RuntimeError("Unknown input type") * edges=graph * n=len(nodes) # <<<<<<<<<<<<<< * self.nodemap=dict(zip(nodes,range(1,n+1))) * self.reverse_nodemap=dict(zip(range(1,n+1),nodes)) */ __pyx_t_6 = PyObject_Length(__pyx_v_nodes); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 40, __pyx_L1_error) __pyx_t_12 = PyLong_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_v_n = __pyx_t_12; __pyx_t_12 = 0; /* "planarity/classic/planarity.pyx":41 * edges=graph * n=len(nodes) * self.nodemap=dict(zip(nodes,range(1,n+1))) # <<<<<<<<<<<<<< * self.reverse_nodemap=dict(zip(range(1,n+1),nodes)) * self.theGraph = cplanarity.gp_New() */ __pyx_t_2 = NULL; __pyx_t_3 = NULL; __pyx_t_13 = NULL; __pyx_t_20 = __Pyx_PyLong_AddObjC(__pyx_v_n, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); __pyx_t_4 = 1; { PyObject *__pyx_callargs[3] = {__pyx_t_13, __pyx_mstate_global->__pyx_int_1, __pyx_t_20}; __pyx_t_14 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); } __pyx_t_4 = 1; { PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_nodes, __pyx_t_14}; __pyx_t_8 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); } __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_8}; __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)(&PyDict_Type), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); } __Pyx_GIVEREF(__pyx_t_12); __Pyx_GOTREF(__pyx_v_self->nodemap); __Pyx_DECREF(__pyx_v_self->nodemap); __pyx_v_self->nodemap = ((PyObject*)__pyx_t_12); __pyx_t_12 = 0; /* "planarity/classic/planarity.pyx":42 * n=len(nodes) * self.nodemap=dict(zip(nodes,range(1,n+1))) * self.reverse_nodemap=dict(zip(range(1,n+1),nodes)) # <<<<<<<<<<<<<< * self.theGraph = cplanarity.gp_New() * cdef int status */ __pyx_t_8 = NULL; __pyx_t_14 = NULL; __pyx_t_20 = NULL; __pyx_t_13 = __Pyx_PyLong_AddObjC(__pyx_v_n, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_4 = 1; { PyObject *__pyx_callargs[3] = {__pyx_t_20, __pyx_mstate_global->__pyx_int_1, __pyx_t_13}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(&PyRange_Type), __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_4 = 1; { PyObject *__pyx_callargs[3] = {__pyx_t_14, __pyx_t_3, __pyx_v_nodes}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_builtin_zip, __pyx_callargs+__pyx_t_4, (3-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_2}; __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)(&PyDict_Type), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); } __Pyx_GIVEREF(__pyx_t_12); __Pyx_GOTREF(__pyx_v_self->reverse_nodemap); __Pyx_DECREF(__pyx_v_self->reverse_nodemap); __pyx_v_self->reverse_nodemap = ((PyObject*)__pyx_t_12); __pyx_t_12 = 0; /* "planarity/classic/planarity.pyx":43 * self.nodemap=dict(zip(nodes,range(1,n+1))) * self.reverse_nodemap=dict(zip(range(1,n+1),nodes)) * self.theGraph = cplanarity.gp_New() # <<<<<<<<<<<<<< * cdef int status * status = cplanarity.gp_EnsureVertexCapacity(self.theGraph, n) */ __pyx_v_self->theGraph = gp_New(); /* "planarity/classic/planarity.pyx":45 * self.theGraph = cplanarity.gp_New() * cdef int status * status = cplanarity.gp_EnsureVertexCapacity(self.theGraph, n) # <<<<<<<<<<<<<< * if status != cplanarity.OK: * raise RuntimeError("planarity: failed to initialize graph") */ __pyx_t_7 = __Pyx_PyLong_As_int(__pyx_v_n); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L1_error) __pyx_v_status = gp_EnsureVertexCapacity(__pyx_v_self->theGraph, __pyx_t_7); /* "planarity/classic/planarity.pyx":46 * cdef int status * status = cplanarity.gp_EnsureVertexCapacity(self.theGraph, n) * if status != cplanarity.OK: # <<<<<<<<<<<<<< * raise RuntimeError("planarity: failed to initialize graph") * # add the edges and check return */ __pyx_t_1 = (__pyx_v_status != OK); if (unlikely(__pyx_t_1)) { /* "planarity/classic/planarity.pyx":47 * status = cplanarity.gp_EnsureVertexCapacity(self.theGraph, n) * if status != cplanarity.OK: * raise RuntimeError("planarity: failed to initialize graph") # <<<<<<<<<<<<<< * # add the edges and check return * seen = set() */ __pyx_t_2 = NULL; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_planarity_failed_to_initialize_g}; __pyx_t_12 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); } __Pyx_Raise(__pyx_t_12, 0, 0, 0); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __PYX_ERR(0, 47, __pyx_L1_error) /* "planarity/classic/planarity.pyx":46 * cdef int status * status = cplanarity.gp_EnsureVertexCapacity(self.theGraph, n) * if status != cplanarity.OK: # <<<<<<<<<<<<<< * raise RuntimeError("planarity: failed to initialize graph") * # add the edges and check return */ } /* "planarity/classic/planarity.pyx":49 * raise RuntimeError("planarity: failed to initialize graph") * # add the edges and check return * seen = set() # <<<<<<<<<<<<<< * for u,v in edges: * if (u,v) not in seen and (v,u) not in seen: */ __pyx_t_12 = PySet_New(0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_XDECREF_SET(__pyx_v_seen, ((PyObject*)__pyx_t_12)); __pyx_t_12 = 0; /* "planarity/classic/planarity.pyx":50 * # add the edges and check return * seen = set() * for u,v in edges: # <<<<<<<<<<<<<< * if (u,v) not in seen and (v,u) not in seen: * status = cplanarity.gp_DynamicAddEdge(self.theGraph, */ if (likely(PyList_CheckExact(__pyx_v_edges)) || PyTuple_CheckExact(__pyx_v_edges)) { __pyx_t_12 = __pyx_v_edges; __Pyx_INCREF(__pyx_t_12); __pyx_t_6 = 0; __pyx_t_11 = NULL; } else { __pyx_t_6 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_v_edges); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_11 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 50, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_11)) { if (likely(PyList_CheckExact(__pyx_t_12))) { { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_12); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 50, __pyx_L1_error) #endif if (__pyx_t_6 >= __pyx_temp) break; } __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_12, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference); ++__pyx_t_6; } else { { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_12); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 50, __pyx_L1_error) #endif if (__pyx_t_6 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_6)); #else __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_12, __pyx_t_6); #endif ++__pyx_t_6; } if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) } else { __pyx_t_2 = __pyx_t_11(__pyx_t_12); if (unlikely(!__pyx_t_2)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 50, __pyx_L1_error) PyErr_Clear(); } break; } } __Pyx_GOTREF(__pyx_t_2); if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 50, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); __Pyx_INCREF(__pyx_t_8); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); } else { __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_8); __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_XGOTREF(__pyx_t_3); } #else __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; __pyx_t_14 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_21 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_14); index = 0; __pyx_t_8 = __pyx_t_21(__pyx_t_14); if (unlikely(!__pyx_t_8)) goto __pyx_L35_unpacking_failed; __Pyx_GOTREF(__pyx_t_8); index = 1; __pyx_t_3 = __pyx_t_21(__pyx_t_14); if (unlikely(!__pyx_t_3)) goto __pyx_L35_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); if (__Pyx_IternextUnpackEndCheck(__pyx_t_21(__pyx_t_14), 2) < (0)) __PYX_ERR(0, 50, __pyx_L1_error) __pyx_t_21 = NULL; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; goto __pyx_L36_unpacking_done; __pyx_L35_unpacking_failed:; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_21 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 50, __pyx_L1_error) __pyx_L36_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_u, __pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_3); __pyx_t_3 = 0; /* "planarity/classic/planarity.pyx":51 * seen = set() * for u,v in edges: * if (u,v) not in seen and (v,u) not in seen: # <<<<<<<<<<<<<< * status = cplanarity.gp_DynamicAddEdge(self.theGraph, * self.nodemap[u], 0, */ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_u); __Pyx_GIVEREF(__pyx_v_u); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_u) != (0)) __PYX_ERR(0, 51, __pyx_L1_error); __Pyx_INCREF(__pyx_v_v); __Pyx_GIVEREF(__pyx_v_v); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_v) != (0)) __PYX_ERR(0, 51, __pyx_L1_error); __pyx_t_22 = (__Pyx_PySet_ContainsTF(__pyx_t_2, __pyx_v_seen, Py_NE)); if (unlikely((__pyx_t_22 < 0))) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_22) { } else { __pyx_t_1 = __pyx_t_22; goto __pyx_L38_bool_binop_done; } __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_v); __Pyx_GIVEREF(__pyx_v_v); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_v) != (0)) __PYX_ERR(0, 51, __pyx_L1_error); __Pyx_INCREF(__pyx_v_u); __Pyx_GIVEREF(__pyx_v_u); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_u) != (0)) __PYX_ERR(0, 51, __pyx_L1_error); __pyx_t_22 = (__Pyx_PySet_ContainsTF(__pyx_t_2, __pyx_v_seen, Py_NE)); if (unlikely((__pyx_t_22 < 0))) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_22; __pyx_L38_bool_binop_done:; if (__pyx_t_1) { /* "planarity/classic/planarity.pyx":53 * if (u,v) not in seen and (v,u) not in seen: * status = cplanarity.gp_DynamicAddEdge(self.theGraph, * self.nodemap[u], 0, # <<<<<<<<<<<<<< * self.nodemap[v], 0) * if status != cplanarity.OK: */ if (unlikely(__pyx_v_self->nodemap == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 53, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->nodemap, __pyx_v_u); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/classic/planarity.pyx":54 * status = cplanarity.gp_DynamicAddEdge(self.theGraph, * self.nodemap[u], 0, * self.nodemap[v], 0) # <<<<<<<<<<<<<< * if status != cplanarity.OK: * cplanarity.gp_Free(&self.theGraph) */ if (unlikely(__pyx_v_self->nodemap == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 54, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->nodemap, __pyx_v_v); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_9 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/classic/planarity.pyx":52 * for u,v in edges: * if (u,v) not in seen and (v,u) not in seen: * status = cplanarity.gp_DynamicAddEdge(self.theGraph, # <<<<<<<<<<<<<< * self.nodemap[u], 0, * self.nodemap[v], 0) */ __pyx_v_status = gp_DynamicAddEdge(__pyx_v_self->theGraph, __pyx_t_7, 0, __pyx_t_9, 0); /* "planarity/classic/planarity.pyx":55 * self.nodemap[u], 0, * self.nodemap[v], 0) * if status != cplanarity.OK: # <<<<<<<<<<<<<< * cplanarity.gp_Free(&self.theGraph) * raise RuntimeError("planarity: failed adding edge.") */ __pyx_t_1 = (__pyx_v_status != OK); if (unlikely(__pyx_t_1)) { /* "planarity/classic/planarity.pyx":56 * self.nodemap[v], 0) * if status != cplanarity.OK: * cplanarity.gp_Free(&self.theGraph) # <<<<<<<<<<<<<< * raise RuntimeError("planarity: failed adding edge.") * seen.add((u,v)) */ gp_Free((&__pyx_v_self->theGraph)); /* "planarity/classic/planarity.pyx":57 * if status != cplanarity.OK: * cplanarity.gp_Free(&self.theGraph) * raise RuntimeError("planarity: failed adding edge.") # <<<<<<<<<<<<<< * seen.add((u,v)) * else: */ __pyx_t_3 = NULL; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_planarity_failed_adding_edge}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 57, __pyx_L1_error) /* "planarity/classic/planarity.pyx":55 * self.nodemap[u], 0, * self.nodemap[v], 0) * if status != cplanarity.OK: # <<<<<<<<<<<<<< * cplanarity.gp_Free(&self.theGraph) * raise RuntimeError("planarity: failed adding edge.") */ } /* "planarity/classic/planarity.pyx":58 * cplanarity.gp_Free(&self.theGraph) * raise RuntimeError("planarity: failed adding edge.") * seen.add((u,v)) # <<<<<<<<<<<<<< * else: * warnings.warn('ignoring parallel edge %s-%s'%(str(u),str(v))) */ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_u); __Pyx_GIVEREF(__pyx_v_u); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_u) != (0)) __PYX_ERR(0, 58, __pyx_L1_error); __Pyx_INCREF(__pyx_v_v); __Pyx_GIVEREF(__pyx_v_v); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_v) != (0)) __PYX_ERR(0, 58, __pyx_L1_error); __pyx_t_15 = PySet_Add(__pyx_v_seen, __pyx_t_2); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/classic/planarity.pyx":51 * seen = set() * for u,v in edges: * if (u,v) not in seen and (v,u) not in seen: # <<<<<<<<<<<<<< * status = cplanarity.gp_DynamicAddEdge(self.theGraph, * self.nodemap[u], 0, */ goto __pyx_L37; } /* "planarity/classic/planarity.pyx":60 * seen.add((u,v)) * else: * warnings.warn('ignoring parallel edge %s-%s'%(str(u),str(v))) # <<<<<<<<<<<<<< * self.embedding=cplanarity.NOTOK * */ /*else*/ { __pyx_t_3 = NULL; __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_warnings); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_warn); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyObject_Unicode(__pyx_v_u); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_13 = __Pyx_PyObject_Unicode(__pyx_v_v); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_23[0] = __pyx_mstate_global->__pyx_kp_u_ignoring_parallel_edge; __pyx_t_23[1] = __pyx_t_8; __pyx_t_23[2] = __pyx_mstate_global->__pyx_kp_u_; __pyx_t_23[3] = __pyx_t_13; __pyx_t_20 = __Pyx_PyUnicode_Join(__pyx_t_23, 4, 23 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 1 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_13), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_13)); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_4 = 1; #if CYTHON_UNPACK_METHODS if (unlikely(PyMethod_Check(__pyx_t_14))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_14); assert(__pyx_t_3); PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_14); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx__function); __Pyx_DECREF_SET(__pyx_t_14, __pyx__function); __pyx_t_4 = 0; } #endif { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_20}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)__pyx_t_14, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_L37:; /* "planarity/classic/planarity.pyx":50 * # add the edges and check return * seen = set() * for u,v in edges: # <<<<<<<<<<<<<< * if (u,v) not in seen and (v,u) not in seen: * status = cplanarity.gp_DynamicAddEdge(self.theGraph, */ } __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; /* "planarity/classic/planarity.pyx":61 * else: * warnings.warn('ignoring parallel edge %s-%s'%(str(u),str(v))) * self.embedding=cplanarity.NOTOK # <<<<<<<<<<<<<< * * */ __pyx_v_self->embedding = NOTOK; /* "planarity/classic/planarity.pyx":17 * cdef dict reverse_nodemap * cdef int embedding * def __init__(self,graph): # <<<<<<<<<<<<<< * # guess input type * if hasattr(graph,'nodes'): */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_14); __Pyx_XDECREF(__pyx_t_20); __Pyx_AddTraceback("planarity.classic.planarity.PGraph.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_nodes); __Pyx_XDECREF(__pyx_v_edges); __Pyx_XDECREF(__pyx_v_seen); __Pyx_XDECREF(__pyx_v_node); __Pyx_XDECREF(__pyx_v_adj); __Pyx_XDECREF(__pyx_v_nbrs); __Pyx_XDECREF(__pyx_v_n); __Pyx_XDECREF(__pyx_v_u); __Pyx_XDECREF(__pyx_v_v); __Pyx_XDECREF(__pyx_7genexpr__pyx_v_n); __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_sublist); __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_node); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/classic/planarity.pyx":64 * * * def __dealloc__(self): # <<<<<<<<<<<<<< * cplanarity.gp_Free(&self.theGraph) * */ /* Python wrapper */ static void __pyx_pw_9planarity_7classic_9planarity_6PGraph_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_9planarity_7classic_9planarity_6PGraph_3__dealloc__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_pf_9planarity_7classic_9planarity_6PGraph_2__dealloc__(((struct __pyx_obj_9planarity_7classic_9planarity_PGraph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_9planarity_7classic_9planarity_6PGraph_2__dealloc__(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self) { /* "planarity/classic/planarity.pyx":65 * * def __dealloc__(self): * cplanarity.gp_Free(&self.theGraph) # <<<<<<<<<<<<<< * * */ gp_Free((&__pyx_v_self->theGraph)); /* "planarity/classic/planarity.pyx":64 * * * def __dealloc__(self): # <<<<<<<<<<<<<< * cplanarity.gp_Free(&self.theGraph) * */ /* function exit code */ } /* "planarity/classic/planarity.pyx":68 * * * def embed_planar(self): # <<<<<<<<<<<<<< * if self.embedding != 0: * return */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_5embed_planar(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_7classic_9planarity_6PGraph_4embed_planar, "PGraph.embed_planar(self)"); static PyMethodDef __pyx_mdef_9planarity_7classic_9planarity_6PGraph_5embed_planar = {"embed_planar", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_5embed_planar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_4embed_planar}; static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_5embed_planar(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("embed_planar (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("embed_planar", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("embed_planar", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_7classic_9planarity_6PGraph_4embed_planar(((struct __pyx_obj_9planarity_7classic_9planarity_PGraph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_4embed_planar(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self) { int __pyx_v_status; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("embed_planar", 0); /* "planarity/classic/planarity.pyx":69 * * def embed_planar(self): * if self.embedding != 0: # <<<<<<<<<<<<<< * return * */ __pyx_t_1 = (__pyx_v_self->embedding != 0); if (__pyx_t_1) { /* "planarity/classic/planarity.pyx":70 * def embed_planar(self): * if self.embedding != 0: * return # <<<<<<<<<<<<<< * * status = cplanarity.gp_ExtendWith_Planarity(self.theGraph) */ __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; /* "planarity/classic/planarity.pyx":69 * * def embed_planar(self): * if self.embedding != 0: # <<<<<<<<<<<<<< * return * */ } /* "planarity/classic/planarity.pyx":72 * return * * status = cplanarity.gp_ExtendWith_Planarity(self.theGraph) # <<<<<<<<<<<<<< * if status != cplanarity.OK: * raise RuntimeError("planarity: failed to extend graph with planarity structures.") */ __pyx_v_status = gp_ExtendWith_Planarity(__pyx_v_self->theGraph); /* "planarity/classic/planarity.pyx":73 * * status = cplanarity.gp_ExtendWith_Planarity(self.theGraph) * if status != cplanarity.OK: # <<<<<<<<<<<<<< * raise RuntimeError("planarity: failed to extend graph with planarity structures.") * self.embedding = cplanarity.gp_Embed(self.theGraph, */ __pyx_t_1 = (__pyx_v_status != OK); if (unlikely(__pyx_t_1)) { /* "planarity/classic/planarity.pyx":74 * status = cplanarity.gp_ExtendWith_Planarity(self.theGraph) * if status != cplanarity.OK: * raise RuntimeError("planarity: failed to extend graph with planarity structures.") # <<<<<<<<<<<<<< * self.embedding = cplanarity.gp_Embed(self.theGraph, * cplanarity.EMBEDFLAGS_PLANAR) */ __pyx_t_3 = NULL; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_planarity_failed_to_extend_graph}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 74, __pyx_L1_error) /* "planarity/classic/planarity.pyx":73 * * status = cplanarity.gp_ExtendWith_Planarity(self.theGraph) * if status != cplanarity.OK: # <<<<<<<<<<<<<< * raise RuntimeError("planarity: failed to extend graph with planarity structures.") * self.embedding = cplanarity.gp_Embed(self.theGraph, */ } /* "planarity/classic/planarity.pyx":75 * if status != cplanarity.OK: * raise RuntimeError("planarity: failed to extend graph with planarity structures.") * self.embedding = cplanarity.gp_Embed(self.theGraph, # <<<<<<<<<<<<<< * cplanarity.EMBEDFLAGS_PLANAR) * cplanarity.gp_SortVertices(self.theGraph) */ __pyx_v_self->embedding = gp_Embed(__pyx_v_self->theGraph, EMBEDFLAGS_PLANAR); /* "planarity/classic/planarity.pyx":77 * self.embedding = cplanarity.gp_Embed(self.theGraph, * cplanarity.EMBEDFLAGS_PLANAR) * cplanarity.gp_SortVertices(self.theGraph) # <<<<<<<<<<<<<< * * */ gp_SortVertices(__pyx_v_self->theGraph); /* "planarity/classic/planarity.pyx":68 * * * def embed_planar(self): # <<<<<<<<<<<<<< * if self.embedding != 0: * return */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("planarity.classic.planarity.PGraph.embed_planar", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/classic/planarity.pyx":80 * * * def embed_drawplanar(self): # <<<<<<<<<<<<<< * status = cplanarity.gp_ExtendWith_DrawPlanar(self.theGraph) * if status != cplanarity.OK: */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_7embed_drawplanar(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_7classic_9planarity_6PGraph_6embed_drawplanar, "PGraph.embed_drawplanar(self)"); static PyMethodDef __pyx_mdef_9planarity_7classic_9planarity_6PGraph_7embed_drawplanar = {"embed_drawplanar", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_7embed_drawplanar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_6embed_drawplanar}; static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_7embed_drawplanar(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("embed_drawplanar (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("embed_drawplanar", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("embed_drawplanar", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_7classic_9planarity_6PGraph_6embed_drawplanar(((struct __pyx_obj_9planarity_7classic_9planarity_PGraph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_6embed_drawplanar(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self) { int __pyx_v_status; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("embed_drawplanar", 0); /* "planarity/classic/planarity.pyx":81 * * def embed_drawplanar(self): * status = cplanarity.gp_ExtendWith_DrawPlanar(self.theGraph) # <<<<<<<<<<<<<< * if status != cplanarity.OK: * raise RuntimeError("planarity: failed to extend graph with drawplanar structures.") */ __pyx_v_status = gp_ExtendWith_DrawPlanar(__pyx_v_self->theGraph); /* "planarity/classic/planarity.pyx":82 * def embed_drawplanar(self): * status = cplanarity.gp_ExtendWith_DrawPlanar(self.theGraph) * if status != cplanarity.OK: # <<<<<<<<<<<<<< * raise RuntimeError("planarity: failed to extend graph with drawplanar structures.") * status = cplanarity.gp_Embed(self.theGraph, */ __pyx_t_1 = (__pyx_v_status != OK); if (unlikely(__pyx_t_1)) { /* "planarity/classic/planarity.pyx":83 * status = cplanarity.gp_ExtendWith_DrawPlanar(self.theGraph) * if status != cplanarity.OK: * raise RuntimeError("planarity: failed to extend graph with drawplanar structures.") # <<<<<<<<<<<<<< * status = cplanarity.gp_Embed(self.theGraph, * cplanarity.EMBEDFLAGS_DRAWPLANAR) */ __pyx_t_3 = NULL; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_planarity_failed_to_extend_graph_2}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 83, __pyx_L1_error) /* "planarity/classic/planarity.pyx":82 * def embed_drawplanar(self): * status = cplanarity.gp_ExtendWith_DrawPlanar(self.theGraph) * if status != cplanarity.OK: # <<<<<<<<<<<<<< * raise RuntimeError("planarity: failed to extend graph with drawplanar structures.") * status = cplanarity.gp_Embed(self.theGraph, */ } /* "planarity/classic/planarity.pyx":84 * if status != cplanarity.OK: * raise RuntimeError("planarity: failed to extend graph with drawplanar structures.") * status = cplanarity.gp_Embed(self.theGraph, # <<<<<<<<<<<<<< * cplanarity.EMBEDFLAGS_DRAWPLANAR) * if status == cplanarity.NONEMBEDDABLE: */ __pyx_v_status = gp_Embed(__pyx_v_self->theGraph, EMBEDFLAGS_DRAWPLANAR); /* "planarity/classic/planarity.pyx":86 * status = cplanarity.gp_Embed(self.theGraph, * cplanarity.EMBEDFLAGS_DRAWPLANAR) * if status == cplanarity.NONEMBEDDABLE: # <<<<<<<<<<<<<< * raise RuntimeError("planarity: graph not planar.") * cplanarity.gp_SortVertices(self.theGraph) */ __pyx_t_1 = (__pyx_v_status == NONEMBEDDABLE); if (unlikely(__pyx_t_1)) { /* "planarity/classic/planarity.pyx":87 * cplanarity.EMBEDFLAGS_DRAWPLANAR) * if status == cplanarity.NONEMBEDDABLE: * raise RuntimeError("planarity: graph not planar.") # <<<<<<<<<<<<<< * cplanarity.gp_SortVertices(self.theGraph) * */ __pyx_t_3 = NULL; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_planarity_graph_not_planar}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 87, __pyx_L1_error) /* "planarity/classic/planarity.pyx":86 * status = cplanarity.gp_Embed(self.theGraph, * cplanarity.EMBEDFLAGS_DRAWPLANAR) * if status == cplanarity.NONEMBEDDABLE: # <<<<<<<<<<<<<< * raise RuntimeError("planarity: graph not planar.") * cplanarity.gp_SortVertices(self.theGraph) */ } /* "planarity/classic/planarity.pyx":88 * if status == cplanarity.NONEMBEDDABLE: * raise RuntimeError("planarity: graph not planar.") * cplanarity.gp_SortVertices(self.theGraph) # <<<<<<<<<<<<<< * * */ gp_SortVertices(__pyx_v_self->theGraph); /* "planarity/classic/planarity.pyx":80 * * * def embed_drawplanar(self): # <<<<<<<<<<<<<< * status = cplanarity.gp_ExtendWith_DrawPlanar(self.theGraph) * if status != cplanarity.OK: */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("planarity.classic.planarity.PGraph.embed_drawplanar", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/classic/planarity.pyx":91 * * * def is_planar(self): # <<<<<<<<<<<<<< * """Return True if graph is planar.""" * self.embed_planar() */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_9is_planar(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_7classic_9planarity_6PGraph_8is_planar, "PGraph.is_planar(self)\n\nReturn True if graph is planar."); static PyMethodDef __pyx_mdef_9planarity_7classic_9planarity_6PGraph_9is_planar = {"is_planar", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_9is_planar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_8is_planar}; static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_9is_planar(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_planar (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("is_planar", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("is_planar", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_7classic_9planarity_6PGraph_8is_planar(((struct __pyx_obj_9planarity_7classic_9planarity_PGraph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_8is_planar(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; size_t __pyx_t_3; int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("is_planar", 0); /* "planarity/classic/planarity.pyx":93 * def is_planar(self): * """Return True if graph is planar.""" * self.embed_planar() # <<<<<<<<<<<<<< * if self.embedding == cplanarity.NONEMBEDDABLE: * return False */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_embed_planar, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "planarity/classic/planarity.pyx":94 * """Return True if graph is planar.""" * self.embed_planar() * if self.embedding == cplanarity.NONEMBEDDABLE: # <<<<<<<<<<<<<< * return False * return True */ __pyx_t_4 = (__pyx_v_self->embedding == NONEMBEDDABLE); if (__pyx_t_4) { /* "planarity/classic/planarity.pyx":95 * self.embed_planar() * if self.embedding == cplanarity.NONEMBEDDABLE: * return False # <<<<<<<<<<<<<< * return True * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_False); __pyx_r = Py_False; goto __pyx_L0; /* "planarity/classic/planarity.pyx":94 * """Return True if graph is planar.""" * self.embed_planar() * if self.embedding == cplanarity.NONEMBEDDABLE: # <<<<<<<<<<<<<< * return False * return True */ } /* "planarity/classic/planarity.pyx":96 * if self.embedding == cplanarity.NONEMBEDDABLE: * return False * return True # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_True); __pyx_r = Py_True; goto __pyx_L0; /* "planarity/classic/planarity.pyx":91 * * * def is_planar(self): # <<<<<<<<<<<<<< * """Return True if graph is planar.""" * self.embed_planar() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.classic.planarity.PGraph.is_planar", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/classic/planarity.pyx":99 * * * def kuratowski_edges(self): # <<<<<<<<<<<<<< * if self.is_planar(): * return [] */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_11kuratowski_edges(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_7classic_9planarity_6PGraph_10kuratowski_edges, "PGraph.kuratowski_edges(self)"); static PyMethodDef __pyx_mdef_9planarity_7classic_9planarity_6PGraph_11kuratowski_edges = {"kuratowski_edges", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_11kuratowski_edges, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_10kuratowski_edges}; static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_11kuratowski_edges(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("kuratowski_edges (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("kuratowski_edges", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("kuratowski_edges", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_7classic_9planarity_6PGraph_10kuratowski_edges(((struct __pyx_obj_9planarity_7classic_9planarity_PGraph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_10kuratowski_edges(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; size_t __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("kuratowski_edges", 0); /* "planarity/classic/planarity.pyx":100 * * def kuratowski_edges(self): * if self.is_planar(): # <<<<<<<<<<<<<< * return [] * elif self.embedding == cplanarity.NONEMBEDDABLE: */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_is_planar, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_4) { /* "planarity/classic/planarity.pyx":101 * def kuratowski_edges(self): * if self.is_planar(): * return [] # <<<<<<<<<<<<<< * elif self.embedding == cplanarity.NONEMBEDDABLE: * return self.edges(include_drawplanar_edge_info=False) */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/classic/planarity.pyx":100 * * def kuratowski_edges(self): * if self.is_planar(): # <<<<<<<<<<<<<< * return [] * elif self.embedding == cplanarity.NONEMBEDDABLE: */ } /* "planarity/classic/planarity.pyx":102 * if self.is_planar(): * return [] * elif self.embedding == cplanarity.NONEMBEDDABLE: # <<<<<<<<<<<<<< * return self.edges(include_drawplanar_edge_info=False) * else: */ __pyx_t_4 = (__pyx_v_self->embedding == NONEMBEDDABLE); if (likely(__pyx_t_4)) { /* "planarity/classic/planarity.pyx":103 * return [] * elif self.embedding == cplanarity.NONEMBEDDABLE: * return self.edges(include_drawplanar_edge_info=False) # <<<<<<<<<<<<<< * else: * raise RuntimeError("planarity: Unknown error.") */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_2, NULL}; __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_include_drawplanar_edge_info, Py_False, __pyx_t_5, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 103, __pyx_L1_error) __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_edges, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/classic/planarity.pyx":102 * if self.is_planar(): * return [] * elif self.embedding == cplanarity.NONEMBEDDABLE: # <<<<<<<<<<<<<< * return self.edges(include_drawplanar_edge_info=False) * else: */ } /* "planarity/classic/planarity.pyx":105 * return self.edges(include_drawplanar_edge_info=False) * else: * raise RuntimeError("planarity: Unknown error.") # <<<<<<<<<<<<<< * * */ /*else*/ { __pyx_t_5 = NULL; __pyx_t_3 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_planarity_Unknown_error}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_3, (2-__pyx_t_3) | (__pyx_t_3*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 105, __pyx_L1_error) } /* "planarity/classic/planarity.pyx":99 * * * def kuratowski_edges(self): # <<<<<<<<<<<<<< * if self.is_planar(): * return [] */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("planarity.classic.planarity.PGraph.kuratowski_edges", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/classic/planarity.pyx":108 * * * def nodes(self, include_drawplanar_vertex_info=False): # <<<<<<<<<<<<<< * first=cplanarity.gp_LowerBoundVertices(self.theGraph) * last=cplanarity.gp_UpperBoundVertices(self.theGraph) */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_13nodes(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_7classic_9planarity_6PGraph_12nodes, "PGraph.nodes(self, include_drawplanar_vertex_info=False)"); static PyMethodDef __pyx_mdef_9planarity_7classic_9planarity_6PGraph_13nodes = {"nodes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_13nodes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_12nodes}; static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_13nodes(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_include_drawplanar_vertex_info = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("nodes (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_include_drawplanar_vertex_info,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 108, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 108, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "nodes", 0) < (0)) __PYX_ERR(0, 108, __pyx_L3_error) if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False)); } else { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 108, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False)); } __pyx_v_include_drawplanar_vertex_info = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("nodes", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 108, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.classic.planarity.PGraph.nodes", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_7classic_9planarity_6PGraph_12nodes(((struct __pyx_obj_9planarity_7classic_9planarity_PGraph *)__pyx_v_self), __pyx_v_include_drawplanar_vertex_info); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_12nodes(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self, PyObject *__pyx_v_include_drawplanar_vertex_info) { int __pyx_v_first; int __pyx_v_last; PyObject *__pyx_v_r = NULL; PyObject *__pyx_v_nodes = NULL; int __pyx_v_v; PyObject *__pyx_v_drawplanar_vertex_info = NULL; int __pyx_v_vertex_position; int __pyx_v_vertex_start; int __pyx_v_vertex_end; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; size_t __pyx_t_11; PyObject *__pyx_t_12 = NULL; int __pyx_t_13; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("nodes", 0); /* "planarity/classic/planarity.pyx":109 * * def nodes(self, include_drawplanar_vertex_info=False): * first=cplanarity.gp_LowerBoundVertices(self.theGraph) # <<<<<<<<<<<<<< * last=cplanarity.gp_UpperBoundVertices(self.theGraph) * r=self.reverse_nodemap */ __pyx_v_first = gp_LowerBoundVertices(__pyx_v_self->theGraph); /* "planarity/classic/planarity.pyx":110 * def nodes(self, include_drawplanar_vertex_info=False): * first=cplanarity.gp_LowerBoundVertices(self.theGraph) * last=cplanarity.gp_UpperBoundVertices(self.theGraph) # <<<<<<<<<<<<<< * r=self.reverse_nodemap * nodes=[] */ __pyx_v_last = gp_UpperBoundVertices(__pyx_v_self->theGraph); /* "planarity/classic/planarity.pyx":111 * first=cplanarity.gp_LowerBoundVertices(self.theGraph) * last=cplanarity.gp_UpperBoundVertices(self.theGraph) * r=self.reverse_nodemap # <<<<<<<<<<<<<< * nodes=[] * */ __pyx_t_1 = __pyx_v_self->reverse_nodemap; __Pyx_INCREF(__pyx_t_1); __pyx_v_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "planarity/classic/planarity.pyx":112 * last=cplanarity.gp_UpperBoundVertices(self.theGraph) * r=self.reverse_nodemap * nodes=[] # <<<<<<<<<<<<<< * * for v in range(first, last): */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_nodes = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "planarity/classic/planarity.pyx":114 * nodes=[] * * for v in range(first, last): # <<<<<<<<<<<<<< * if include_drawplanar_vertex_info: * drawplanar_vertex_info = {} */ __pyx_t_2 = __pyx_v_last; __pyx_t_3 = __pyx_t_2; for (__pyx_t_4 = __pyx_v_first; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_v = __pyx_t_4; /* "planarity/classic/planarity.pyx":115 * * for v in range(first, last): * if include_drawplanar_vertex_info: # <<<<<<<<<<<<<< * drawplanar_vertex_info = {} * */ __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_include_drawplanar_vertex_info); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 115, __pyx_L1_error) if (__pyx_t_5) { /* "planarity/classic/planarity.pyx":116 * for v in range(first, last): * if include_drawplanar_vertex_info: * drawplanar_vertex_info = {} # <<<<<<<<<<<<<< * * vertex_position=cplanarity.gp_DrawPlanar_GetVertexPosition(self.theGraph, v) */ __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_drawplanar_vertex_info, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; /* "planarity/classic/planarity.pyx":118 * drawplanar_vertex_info = {} * * vertex_position=cplanarity.gp_DrawPlanar_GetVertexPosition(self.theGraph, v) # <<<<<<<<<<<<<< * vertex_start=cplanarity.gp_DrawPlanar_GetVertexStart(self.theGraph, v) * vertex_end=cplanarity.gp_DrawPlanar_GetVertexEnd(self.theGraph, v) */ __pyx_v_vertex_position = gp_DrawPlanar_GetVertexPosition(__pyx_v_self->theGraph, __pyx_v_v); /* "planarity/classic/planarity.pyx":119 * * vertex_position=cplanarity.gp_DrawPlanar_GetVertexPosition(self.theGraph, v) * vertex_start=cplanarity.gp_DrawPlanar_GetVertexStart(self.theGraph, v) # <<<<<<<<<<<<<< * vertex_end=cplanarity.gp_DrawPlanar_GetVertexEnd(self.theGraph, v) * */ __pyx_v_vertex_start = gp_DrawPlanar_GetVertexStart(__pyx_v_self->theGraph, __pyx_v_v); /* "planarity/classic/planarity.pyx":120 * vertex_position=cplanarity.gp_DrawPlanar_GetVertexPosition(self.theGraph, v) * vertex_start=cplanarity.gp_DrawPlanar_GetVertexStart(self.theGraph, v) * vertex_end=cplanarity.gp_DrawPlanar_GetVertexEnd(self.theGraph, v) # <<<<<<<<<<<<<< * * if (vertex_position > -1 and vertex_start > -1 and vertex_end > -1): */ __pyx_v_vertex_end = gp_DrawPlanar_GetVertexEnd(__pyx_v_self->theGraph, __pyx_v_v); /* "planarity/classic/planarity.pyx":122 * vertex_end=cplanarity.gp_DrawPlanar_GetVertexEnd(self.theGraph, v) * * if (vertex_position > -1 and vertex_start > -1 and vertex_end > -1): # <<<<<<<<<<<<<< * drawplanar_vertex_info.update( * vertex_position=vertex_position, */ __pyx_t_6 = (__pyx_v_vertex_position > -1L); if (__pyx_t_6) { } else { __pyx_t_5 = __pyx_t_6; goto __pyx_L7_bool_binop_done; } __pyx_t_6 = (__pyx_v_vertex_start > -1L); if (__pyx_t_6) { } else { __pyx_t_5 = __pyx_t_6; goto __pyx_L7_bool_binop_done; } __pyx_t_6 = (__pyx_v_vertex_end > -1L); __pyx_t_5 = __pyx_t_6; __pyx_L7_bool_binop_done:; if (__pyx_t_5) { /* "planarity/classic/planarity.pyx":123 * * if (vertex_position > -1 and vertex_start > -1 and vertex_end > -1): * drawplanar_vertex_info.update( # <<<<<<<<<<<<<< * vertex_position=vertex_position, * vertex_start=vertex_start, */ __pyx_t_7 = __pyx_v_drawplanar_vertex_info; __Pyx_INCREF(__pyx_t_7); /* "planarity/classic/planarity.pyx":124 * if (vertex_position > -1 and vertex_start > -1 and vertex_end > -1): * drawplanar_vertex_info.update( * vertex_position=vertex_position, # <<<<<<<<<<<<<< * vertex_start=vertex_start, * vertex_end=vertex_end, */ __pyx_t_8 = __Pyx_PyLong_From_int(__pyx_v_vertex_position); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); /* "planarity/classic/planarity.pyx":125 * drawplanar_vertex_info.update( * vertex_position=vertex_position, * vertex_start=vertex_start, # <<<<<<<<<<<<<< * vertex_end=vertex_end, * ) */ __pyx_t_9 = __Pyx_PyLong_From_int(__pyx_v_vertex_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); /* "planarity/classic/planarity.pyx":126 * vertex_position=vertex_position, * vertex_start=vertex_start, * vertex_end=vertex_end, # <<<<<<<<<<<<<< * ) * */ __pyx_t_10 = __Pyx_PyLong_From_int(__pyx_v_vertex_end); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = 0; { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_7, NULL}; __pyx_t_12 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_vertex_position, __pyx_t_8, __pyx_t_12, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 123, __pyx_L1_error) if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_vertex_start, __pyx_t_9, __pyx_t_12, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 123, __pyx_L1_error) if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_vertex_end, __pyx_t_10, __pyx_t_12, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 123, __pyx_L1_error) __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_11, (1-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_12); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "planarity/classic/planarity.pyx":122 * vertex_end=cplanarity.gp_DrawPlanar_GetVertexEnd(self.theGraph, v) * * if (vertex_position > -1 and vertex_start > -1 and vertex_end > -1): # <<<<<<<<<<<<<< * drawplanar_vertex_info.update( * vertex_position=vertex_position, */ } /* "planarity/classic/planarity.pyx":129 * ) * * nodes.append((r[v], drawplanar_vertex_info)) # <<<<<<<<<<<<<< * else: * nodes.append((r[v])) */ if (unlikely(__pyx_v_r == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 129, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_r, __pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_12); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_12) != (0)) __PYX_ERR(0, 129, __pyx_L1_error); __Pyx_INCREF(__pyx_v_drawplanar_vertex_info); __Pyx_GIVEREF(__pyx_v_drawplanar_vertex_info); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_drawplanar_vertex_info) != (0)) __PYX_ERR(0, 129, __pyx_L1_error); __pyx_t_12 = 0; __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_nodes, __pyx_t_1); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "planarity/classic/planarity.pyx":115 * * for v in range(first, last): * if include_drawplanar_vertex_info: # <<<<<<<<<<<<<< * drawplanar_vertex_info = {} * */ goto __pyx_L5; } /* "planarity/classic/planarity.pyx":131 * nodes.append((r[v], drawplanar_vertex_info)) * else: * nodes.append((r[v])) # <<<<<<<<<<<<<< * return nodes * */ /*else*/ { if (unlikely(__pyx_v_r == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 131, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_r, __pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_nodes, __pyx_t_12); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } __pyx_L5:; } /* "planarity/classic/planarity.pyx":132 * else: * nodes.append((r[v])) * return nodes # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_nodes); __pyx_r = __pyx_v_nodes; goto __pyx_L0; /* "planarity/classic/planarity.pyx":108 * * * def nodes(self, include_drawplanar_vertex_info=False): # <<<<<<<<<<<<<< * first=cplanarity.gp_LowerBoundVertices(self.theGraph) * last=cplanarity.gp_UpperBoundVertices(self.theGraph) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_12); __Pyx_AddTraceback("planarity.classic.planarity.PGraph.nodes", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_r); __Pyx_XDECREF(__pyx_v_nodes); __Pyx_XDECREF(__pyx_v_drawplanar_vertex_info); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/classic/planarity.pyx":135 * * * def edges(self, include_drawplanar_edge_info=False): # <<<<<<<<<<<<<< * edges=[] * r=self.reverse_nodemap */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_15edges(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_7classic_9planarity_6PGraph_14edges, "PGraph.edges(self, include_drawplanar_edge_info=False)"); static PyMethodDef __pyx_mdef_9planarity_7classic_9planarity_6PGraph_15edges = {"edges", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_15edges, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_14edges}; static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_15edges(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_include_drawplanar_edge_info = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("edges (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_include_drawplanar_edge_info,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 135, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 135, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "edges", 0) < (0)) __PYX_ERR(0, 135, __pyx_L3_error) if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False)); } else { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 135, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_False)); } __pyx_v_include_drawplanar_edge_info = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("edges", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 135, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.classic.planarity.PGraph.edges", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(((struct __pyx_obj_9planarity_7classic_9planarity_PGraph *)__pyx_v_self), __pyx_v_include_drawplanar_edge_info); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_14edges(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self, PyObject *__pyx_v_include_drawplanar_edge_info) { PyObject *__pyx_v_edges = NULL; PyObject *__pyx_v_r = NULL; int __pyx_v_first; int __pyx_v_last; int __pyx_v_v; int __pyx_v_e; int __pyx_v_is_edge; int __pyx_v_nbr; PyObject *__pyx_v_drawplanar_edge_info = NULL; int __pyx_v_edge_position; int __pyx_v_edge_start; int __pyx_v_edge_end; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; size_t __pyx_t_11; PyObject *__pyx_t_12 = NULL; int __pyx_t_13; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("edges", 0); /* "planarity/classic/planarity.pyx":136 * * def edges(self, include_drawplanar_edge_info=False): * edges=[] # <<<<<<<<<<<<<< * r=self.reverse_nodemap * first=cplanarity.gp_LowerBoundVertices(self.theGraph) */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_edges = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "planarity/classic/planarity.pyx":137 * def edges(self, include_drawplanar_edge_info=False): * edges=[] * r=self.reverse_nodemap # <<<<<<<<<<<<<< * first=cplanarity.gp_LowerBoundVertices(self.theGraph) * last=cplanarity.gp_UpperBoundVertices(self.theGraph) */ __pyx_t_1 = __pyx_v_self->reverse_nodemap; __Pyx_INCREF(__pyx_t_1); __pyx_v_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "planarity/classic/planarity.pyx":138 * edges=[] * r=self.reverse_nodemap * first=cplanarity.gp_LowerBoundVertices(self.theGraph) # <<<<<<<<<<<<<< * last=cplanarity.gp_UpperBoundVertices(self.theGraph) * */ __pyx_v_first = gp_LowerBoundVertices(__pyx_v_self->theGraph); /* "planarity/classic/planarity.pyx":139 * r=self.reverse_nodemap * first=cplanarity.gp_LowerBoundVertices(self.theGraph) * last=cplanarity.gp_UpperBoundVertices(self.theGraph) # <<<<<<<<<<<<<< * * for v in range(first,last): */ __pyx_v_last = gp_UpperBoundVertices(__pyx_v_self->theGraph); /* "planarity/classic/planarity.pyx":141 * last=cplanarity.gp_UpperBoundVertices(self.theGraph) * * for v in range(first,last): # <<<<<<<<<<<<<< * e = cplanarity.gp_GetFirstEdge(self.theGraph, v) * is_edge = cplanarity.gp_IsEdge(self.theGraph, e) */ __pyx_t_2 = __pyx_v_last; __pyx_t_3 = __pyx_t_2; for (__pyx_t_4 = __pyx_v_first; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_v = __pyx_t_4; /* "planarity/classic/planarity.pyx":142 * * for v in range(first,last): * e = cplanarity.gp_GetFirstEdge(self.theGraph, v) # <<<<<<<<<<<<<< * is_edge = cplanarity.gp_IsEdge(self.theGraph, e) * while is_edge > 0: */ __pyx_v_e = gp_GetFirstEdge(__pyx_v_self->theGraph, __pyx_v_v); /* "planarity/classic/planarity.pyx":143 * for v in range(first,last): * e = cplanarity.gp_GetFirstEdge(self.theGraph, v) * is_edge = cplanarity.gp_IsEdge(self.theGraph, e) # <<<<<<<<<<<<<< * while is_edge > 0: * nbr = cplanarity.gp_GetNeighbor(self.theGraph, e) */ __pyx_v_is_edge = gp_IsEdge(__pyx_v_self->theGraph, __pyx_v_e); /* "planarity/classic/planarity.pyx":144 * e = cplanarity.gp_GetFirstEdge(self.theGraph, v) * is_edge = cplanarity.gp_IsEdge(self.theGraph, e) * while is_edge > 0: # <<<<<<<<<<<<<< * nbr = cplanarity.gp_GetNeighbor(self.theGraph, e) * if nbr > v: */ while (1) { __pyx_t_5 = (__pyx_v_is_edge > 0); if (!__pyx_t_5) break; /* "planarity/classic/planarity.pyx":145 * is_edge = cplanarity.gp_IsEdge(self.theGraph, e) * while is_edge > 0: * nbr = cplanarity.gp_GetNeighbor(self.theGraph, e) # <<<<<<<<<<<<<< * if nbr > v: * if include_drawplanar_edge_info: */ __pyx_v_nbr = gp_GetNeighbor(__pyx_v_self->theGraph, __pyx_v_e); /* "planarity/classic/planarity.pyx":146 * while is_edge > 0: * nbr = cplanarity.gp_GetNeighbor(self.theGraph, e) * if nbr > v: # <<<<<<<<<<<<<< * if include_drawplanar_edge_info: * drawplanar_edge_info = {} */ __pyx_t_5 = (__pyx_v_nbr > __pyx_v_v); if (__pyx_t_5) { /* "planarity/classic/planarity.pyx":147 * nbr = cplanarity.gp_GetNeighbor(self.theGraph, e) * if nbr > v: * if include_drawplanar_edge_info: # <<<<<<<<<<<<<< * drawplanar_edge_info = {} * */ __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_include_drawplanar_edge_info); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 147, __pyx_L1_error) if (__pyx_t_5) { /* "planarity/classic/planarity.pyx":148 * if nbr > v: * if include_drawplanar_edge_info: * drawplanar_edge_info = {} # <<<<<<<<<<<<<< * * edge_position=cplanarity.gp_DrawPlanar_GetEdgePosition(self.theGraph, e) */ __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_drawplanar_edge_info, ((PyObject*)__pyx_t_1)); __pyx_t_1 = 0; /* "planarity/classic/planarity.pyx":150 * drawplanar_edge_info = {} * * edge_position=cplanarity.gp_DrawPlanar_GetEdgePosition(self.theGraph, e) # <<<<<<<<<<<<<< * edge_start=cplanarity.gp_DrawPlanar_GetEdgeStart(self.theGraph, e) * edge_end=cplanarity.gp_DrawPlanar_GetEdgeEnd(self.theGraph, e) */ __pyx_v_edge_position = gp_DrawPlanar_GetEdgePosition(__pyx_v_self->theGraph, __pyx_v_e); /* "planarity/classic/planarity.pyx":151 * * edge_position=cplanarity.gp_DrawPlanar_GetEdgePosition(self.theGraph, e) * edge_start=cplanarity.gp_DrawPlanar_GetEdgeStart(self.theGraph, e) # <<<<<<<<<<<<<< * edge_end=cplanarity.gp_DrawPlanar_GetEdgeEnd(self.theGraph, e) * */ __pyx_v_edge_start = gp_DrawPlanar_GetEdgeStart(__pyx_v_self->theGraph, __pyx_v_e); /* "planarity/classic/planarity.pyx":152 * edge_position=cplanarity.gp_DrawPlanar_GetEdgePosition(self.theGraph, e) * edge_start=cplanarity.gp_DrawPlanar_GetEdgeStart(self.theGraph, e) * edge_end=cplanarity.gp_DrawPlanar_GetEdgeEnd(self.theGraph, e) # <<<<<<<<<<<<<< * * if (edge_position > -1 and edge_start > -1 and edge_end > -1): */ __pyx_v_edge_end = gp_DrawPlanar_GetEdgeEnd(__pyx_v_self->theGraph, __pyx_v_e); /* "planarity/classic/planarity.pyx":154 * edge_end=cplanarity.gp_DrawPlanar_GetEdgeEnd(self.theGraph, e) * * if (edge_position > -1 and edge_start > -1 and edge_end > -1): # <<<<<<<<<<<<<< * drawplanar_edge_info.update( * edge_position=edge_position, */ __pyx_t_6 = (__pyx_v_edge_position > -1L); if (__pyx_t_6) { } else { __pyx_t_5 = __pyx_t_6; goto __pyx_L10_bool_binop_done; } __pyx_t_6 = (__pyx_v_edge_start > -1L); if (__pyx_t_6) { } else { __pyx_t_5 = __pyx_t_6; goto __pyx_L10_bool_binop_done; } __pyx_t_6 = (__pyx_v_edge_end > -1L); __pyx_t_5 = __pyx_t_6; __pyx_L10_bool_binop_done:; if (__pyx_t_5) { /* "planarity/classic/planarity.pyx":155 * * if (edge_position > -1 and edge_start > -1 and edge_end > -1): * drawplanar_edge_info.update( # <<<<<<<<<<<<<< * edge_position=edge_position, * edge_start=edge_start, */ __pyx_t_7 = __pyx_v_drawplanar_edge_info; __Pyx_INCREF(__pyx_t_7); /* "planarity/classic/planarity.pyx":156 * if (edge_position > -1 and edge_start > -1 and edge_end > -1): * drawplanar_edge_info.update( * edge_position=edge_position, # <<<<<<<<<<<<<< * edge_start=edge_start, * edge_end=edge_end, */ __pyx_t_8 = __Pyx_PyLong_From_int(__pyx_v_edge_position); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); /* "planarity/classic/planarity.pyx":157 * drawplanar_edge_info.update( * edge_position=edge_position, * edge_start=edge_start, # <<<<<<<<<<<<<< * edge_end=edge_end, * ) */ __pyx_t_9 = __Pyx_PyLong_From_int(__pyx_v_edge_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); /* "planarity/classic/planarity.pyx":158 * edge_position=edge_position, * edge_start=edge_start, * edge_end=edge_end, # <<<<<<<<<<<<<< * ) * */ __pyx_t_10 = __Pyx_PyLong_From_int(__pyx_v_edge_end); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = 0; { PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_7, NULL}; __pyx_t_12 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_edge_position, __pyx_t_8, __pyx_t_12, __pyx_callargs+1, 0) < (0)) __PYX_ERR(0, 155, __pyx_L1_error) if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_edge_start, __pyx_t_9, __pyx_t_12, __pyx_callargs+1, 1) < (0)) __PYX_ERR(0, 155, __pyx_L1_error) if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_edge_end, __pyx_t_10, __pyx_t_12, __pyx_callargs+1, 2) < (0)) __PYX_ERR(0, 155, __pyx_L1_error) __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder((PyObject*)__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_11, (1-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_12); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "planarity/classic/planarity.pyx":154 * edge_end=cplanarity.gp_DrawPlanar_GetEdgeEnd(self.theGraph, e) * * if (edge_position > -1 and edge_start > -1 and edge_end > -1): # <<<<<<<<<<<<<< * drawplanar_edge_info.update( * edge_position=edge_position, */ } /* "planarity/classic/planarity.pyx":161 * ) * * edges.append((r[v], r[nbr], drawplanar_edge_info)) # <<<<<<<<<<<<<< * else: * edges.append((r[v],r[nbr])) */ if (unlikely(__pyx_v_r == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 161, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_r, __pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_v_r == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 161, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_nbr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_10 = __Pyx_PyDict_GetItem(__pyx_v_r, __pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_12); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_12) != (0)) __PYX_ERR(0, 161, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_10); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_10) != (0)) __PYX_ERR(0, 161, __pyx_L1_error); __Pyx_INCREF(__pyx_v_drawplanar_edge_info); __Pyx_GIVEREF(__pyx_v_drawplanar_edge_info); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_drawplanar_edge_info) != (0)) __PYX_ERR(0, 161, __pyx_L1_error); __pyx_t_12 = 0; __pyx_t_10 = 0; __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_edges, __pyx_t_1); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "planarity/classic/planarity.pyx":147 * nbr = cplanarity.gp_GetNeighbor(self.theGraph, e) * if nbr > v: * if include_drawplanar_edge_info: # <<<<<<<<<<<<<< * drawplanar_edge_info = {} * */ goto __pyx_L8; } /* "planarity/classic/planarity.pyx":163 * edges.append((r[v], r[nbr], drawplanar_edge_info)) * else: * edges.append((r[v],r[nbr])) # <<<<<<<<<<<<<< * * e=cplanarity.gp_GetNextEdge(self.theGraph,e) */ /*else*/ { if (unlikely(__pyx_v_r == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 163, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_10 = __Pyx_PyDict_GetItem(__pyx_v_r, __pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_v_r == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 163, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_nbr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_r, __pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_10); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10) != (0)) __PYX_ERR(0, 163, __pyx_L1_error); __Pyx_GIVEREF(__pyx_t_12); if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_12) != (0)) __PYX_ERR(0, 163, __pyx_L1_error); __pyx_t_10 = 0; __pyx_t_12 = 0; __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_edges, __pyx_t_1); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __pyx_L8:; /* "planarity/classic/planarity.pyx":146 * while is_edge > 0: * nbr = cplanarity.gp_GetNeighbor(self.theGraph, e) * if nbr > v: # <<<<<<<<<<<<<< * if include_drawplanar_edge_info: * drawplanar_edge_info = {} */ } /* "planarity/classic/planarity.pyx":165 * edges.append((r[v],r[nbr])) * * e=cplanarity.gp_GetNextEdge(self.theGraph,e) # <<<<<<<<<<<<<< * is_edge=cplanarity.gp_IsEdge(self.theGraph, e) * */ __pyx_v_e = gp_GetNextEdge(__pyx_v_self->theGraph, __pyx_v_e); /* "planarity/classic/planarity.pyx":166 * * e=cplanarity.gp_GetNextEdge(self.theGraph,e) * is_edge=cplanarity.gp_IsEdge(self.theGraph, e) # <<<<<<<<<<<<<< * * return edges */ __pyx_v_is_edge = gp_IsEdge(__pyx_v_self->theGraph, __pyx_v_e); } } /* "planarity/classic/planarity.pyx":168 * is_edge=cplanarity.gp_IsEdge(self.theGraph, e) * * return edges # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_edges); __pyx_r = __pyx_v_edges; goto __pyx_L0; /* "planarity/classic/planarity.pyx":135 * * * def edges(self, include_drawplanar_edge_info=False): # <<<<<<<<<<<<<< * edges=[] * r=self.reverse_nodemap */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_12); __Pyx_AddTraceback("planarity.classic.planarity.PGraph.edges", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_edges); __Pyx_XDECREF(__pyx_v_r); __Pyx_XDECREF(__pyx_v_drawplanar_edge_info); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/classic/planarity.pyx":171 * * * def ascii(self): # <<<<<<<<<<<<<< * cdef char* s = NULL * self.embed_drawplanar() */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_17ascii(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_7classic_9planarity_6PGraph_16ascii, "PGraph.ascii(self)"); static PyMethodDef __pyx_mdef_9planarity_7classic_9planarity_6PGraph_17ascii = {"ascii", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_17ascii, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_16ascii}; static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_17ascii(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("ascii (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("ascii", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("ascii", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_7classic_9planarity_6PGraph_16ascii(((struct __pyx_obj_9planarity_7classic_9planarity_PGraph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_16ascii(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self) { char *__pyx_v_s; CYTHON_UNUSED int __pyx_v_status; PyObject *__pyx_v_py_bytes = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; size_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("ascii", 0); /* "planarity/classic/planarity.pyx":172 * * def ascii(self): * cdef char* s = NULL # <<<<<<<<<<<<<< * self.embed_drawplanar() * status = cplanarity.gp_DrawPlanar_RenderToString(self.theGraph, &s) */ __pyx_v_s = NULL; /* "planarity/classic/planarity.pyx":173 * def ascii(self): * cdef char* s = NULL * self.embed_drawplanar() # <<<<<<<<<<<<<< * status = cplanarity.gp_DrawPlanar_RenderToString(self.theGraph, &s) * py_bytes = s[:] */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_embed_drawplanar, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "planarity/classic/planarity.pyx":174 * cdef char* s = NULL * self.embed_drawplanar() * status = cplanarity.gp_DrawPlanar_RenderToString(self.theGraph, &s) # <<<<<<<<<<<<<< * py_bytes = s[:] * free(s) */ __pyx_v_status = gp_DrawPlanar_RenderToString(__pyx_v_self->theGraph, (&__pyx_v_s)); /* "planarity/classic/planarity.pyx":175 * self.embed_drawplanar() * status = cplanarity.gp_DrawPlanar_RenderToString(self.theGraph, &s) * py_bytes = s[:] # <<<<<<<<<<<<<< * free(s) * return py_bytes.decode('ascii') */ __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_s + 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_py_bytes = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "planarity/classic/planarity.pyx":176 * status = cplanarity.gp_DrawPlanar_RenderToString(self.theGraph, &s) * py_bytes = s[:] * free(s) # <<<<<<<<<<<<<< * return py_bytes.decode('ascii') * */ free(__pyx_v_s); /* "planarity/classic/planarity.pyx":177 * py_bytes = s[:] * free(s) * return py_bytes.decode('ascii') # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_decode_bytes(__pyx_v_py_bytes, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/classic/planarity.pyx":171 * * * def ascii(self): # <<<<<<<<<<<<<< * cdef char* s = NULL * self.embed_drawplanar() */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.classic.planarity.PGraph.ascii", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_py_bytes); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/classic/planarity.pyx":180 * * * def write(self,path): # <<<<<<<<<<<<<< * bpath=path.encode() * status=cplanarity.gp_Write(self.theGraph, bpath, */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_19write(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_7classic_9planarity_6PGraph_18write, "PGraph.write(self, path)"); static PyMethodDef __pyx_mdef_9planarity_7classic_9planarity_6PGraph_19write = {"write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_19write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_18write}; static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_19write(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_path = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("write (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_path,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 180, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 180, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "write", 0) < (0)) __PYX_ERR(0, 180, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, i); __PYX_ERR(0, 180, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 180, __pyx_L3_error) } __pyx_v_path = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 180, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.classic.planarity.PGraph.write", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_7classic_9planarity_6PGraph_18write(((struct __pyx_obj_9planarity_7classic_9planarity_PGraph *)__pyx_v_self), __pyx_v_path); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_18write(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self, PyObject *__pyx_v_path) { PyObject *__pyx_v_bpath = NULL; CYTHON_UNUSED int __pyx_v_status; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; size_t __pyx_t_3; char *__pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("write", 0); /* "planarity/classic/planarity.pyx":181 * * def write(self,path): * bpath=path.encode() # <<<<<<<<<<<<<< * status=cplanarity.gp_Write(self.theGraph, bpath, * cplanarity.WRITE_ADJLIST) */ __pyx_t_2 = __pyx_v_path; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_encode, __pyx_callargs+__pyx_t_3, (1-__pyx_t_3) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_bpath = __pyx_t_1; __pyx_t_1 = 0; /* "planarity/classic/planarity.pyx":182 * def write(self,path): * bpath=path.encode() * status=cplanarity.gp_Write(self.theGraph, bpath, # <<<<<<<<<<<<<< * cplanarity.WRITE_ADJLIST) * */ __pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_bpath); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L1_error) /* "planarity/classic/planarity.pyx":183 * bpath=path.encode() * status=cplanarity.gp_Write(self.theGraph, bpath, * cplanarity.WRITE_ADJLIST) # <<<<<<<<<<<<<< * * def mapping(self): */ __pyx_v_status = gp_Write(__pyx_v_self->theGraph, __pyx_t_4, WRITE_ADJLIST); /* "planarity/classic/planarity.pyx":180 * * * def write(self,path): # <<<<<<<<<<<<<< * bpath=path.encode() * status=cplanarity.gp_Write(self.theGraph, bpath, */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.classic.planarity.PGraph.write", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_bpath); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/classic/planarity.pyx":185 * cplanarity.WRITE_ADJLIST) * * def mapping(self): # <<<<<<<<<<<<<< * return self.reverse_nodemap */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_21mapping(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_7classic_9planarity_6PGraph_20mapping, "PGraph.mapping(self)"); static PyMethodDef __pyx_mdef_9planarity_7classic_9planarity_6PGraph_21mapping = {"mapping", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_21mapping, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_20mapping}; static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_21mapping(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("mapping (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("mapping", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("mapping", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_7classic_9planarity_6PGraph_20mapping(((struct __pyx_obj_9planarity_7classic_9planarity_PGraph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_20mapping(struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("mapping", 0); /* "planarity/classic/planarity.pyx":186 * * def mapping(self): * return self.reverse_nodemap # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->reverse_nodemap); __pyx_r = __pyx_v_self->reverse_nodemap; goto __pyx_L0; /* "planarity/classic/planarity.pyx":185 * cplanarity.WRITE_ADJLIST) * * def mapping(self): # <<<<<<<<<<<<<< * return self.reverse_nodemap */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError, "self.theGraph cannot be converted to a Python object for pickling" * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_23__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_7classic_9planarity_6PGraph_22__reduce_cython__, "PGraph.__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_9planarity_7classic_9planarity_6PGraph_23__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_23__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_22__reduce_cython__}; static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_23__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_7classic_9planarity_6PGraph_22__reduce_cython__(((struct __pyx_obj_9planarity_7classic_9planarity_PGraph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_22__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError, "self.theGraph cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError, "self.theGraph cannot be converted to a Python object for pickling" */ __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_theGraph_cannot_be_converte, 0, 0); __PYX_ERR(1, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError, "self.theGraph cannot be converted to a Python object for pickling" * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("planarity.classic.planarity.PGraph.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError, "self.theGraph cannot be converted to a Python object for pickling" * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "self.theGraph cannot be converted to a Python object for pickling" */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_25__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_7classic_9planarity_6PGraph_24__setstate_cython__, "PGraph.__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_9planarity_7classic_9planarity_6PGraph_25__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_25__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_24__setstate_cython__}; static PyObject *__pyx_pw_9planarity_7classic_9planarity_6PGraph_25__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) } __pyx_v___pyx_state = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.classic.planarity.PGraph.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_7classic_9planarity_6PGraph_24__setstate_cython__(((struct __pyx_obj_9planarity_7classic_9planarity_PGraph *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_7classic_9planarity_6PGraph_24__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_7classic_9planarity_PGraph *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError, "self.theGraph cannot be converted to a Python object for pickling" * def __setstate_cython__(self, __pyx_state): * raise TypeError, "self.theGraph cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<< */ __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_self_theGraph_cannot_be_converte, 0, 0); __PYX_ERR(1, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError, "self.theGraph cannot be converted to a Python object for pickling" * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "self.theGraph cannot be converted to a Python object for pickling" */ /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("planarity.classic.planarity.PGraph.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* #### Code section: module_exttypes ### */ static PyObject *__pyx_tp_new_9planarity_7classic_9planarity_PGraph(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_9planarity_7classic_9planarity_PGraph *p; PyObject *o; o = __Pyx_AllocateExtensionType(t, 0); if (unlikely(!o)) return 0; p = ((struct __pyx_obj_9planarity_7classic_9planarity_PGraph *)o); p->nodemap = ((PyObject*)Py_None); Py_INCREF(Py_None); p->reverse_nodemap = ((PyObject*)Py_None); Py_INCREF(Py_None); return o; } static void __pyx_tp_dealloc_9planarity_7classic_9planarity_PGraph(PyObject *o) { struct __pyx_obj_9planarity_7classic_9planarity_PGraph *p = (struct __pyx_obj_9planarity_7classic_9planarity_PGraph *)o; #if CYTHON_USE_TP_FINALIZE if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) { if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9planarity_7classic_9planarity_PGraph) { if (PyObject_CallFinalizerFromDealloc(o)) return; } } #endif PyObject_GC_UnTrack(o); { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); __pyx_pw_9planarity_7classic_9planarity_6PGraph_3__dealloc__(o); __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->nodemap); Py_CLEAR(p->reverse_nodemap); PyTypeObject *tp = Py_TYPE(o); #if CYTHON_USE_TYPE_SLOTS (*tp->tp_free)(o); #else { freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); if (tp_free) tp_free(o); } #endif #if CYTHON_USE_TYPE_SPECS Py_DECREF(tp); #endif } static int __pyx_tp_traverse_9planarity_7classic_9planarity_PGraph(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_9planarity_7classic_9planarity_PGraph *p = (struct __pyx_obj_9planarity_7classic_9planarity_PGraph *)o; { e = __Pyx_call_type_traverse(o, 1, v, a); if (e) return e; } if (p->nodemap) { e = (*v)(p->nodemap, a); if (e) return e; } if (p->reverse_nodemap) { e = (*v)(p->reverse_nodemap, a); if (e) return e; } return 0; } static int __pyx_tp_clear_9planarity_7classic_9planarity_PGraph(PyObject *o) { PyObject* tmp; struct __pyx_obj_9planarity_7classic_9planarity_PGraph *p = (struct __pyx_obj_9planarity_7classic_9planarity_PGraph *)o; tmp = ((PyObject*)p->nodemap); p->nodemap = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->reverse_nodemap); p->reverse_nodemap = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyMethodDef __pyx_methods_9planarity_7classic_9planarity_PGraph[] = { {"embed_planar", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_5embed_planar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_4embed_planar}, {"embed_drawplanar", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_7embed_drawplanar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_6embed_drawplanar}, {"is_planar", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_9is_planar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_8is_planar}, {"kuratowski_edges", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_11kuratowski_edges, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_10kuratowski_edges}, {"nodes", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_13nodes, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_12nodes}, {"edges", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_15edges, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_14edges}, {"ascii", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_17ascii, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_16ascii}, {"write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_19write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_18write}, {"mapping", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_21mapping, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_20mapping}, {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_23__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_22__reduce_cython__}, {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_7classic_9planarity_6PGraph_25__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_7classic_9planarity_6PGraph_24__setstate_cython__}, {0, 0, 0, 0} }; #if CYTHON_USE_TYPE_SPECS static PyType_Slot __pyx_type_9planarity_7classic_9planarity_PGraph_slots[] = { {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9planarity_7classic_9planarity_PGraph}, {Py_tp_doc, (void *)PyDoc_STR("PGraph(graph)")}, {Py_tp_traverse, (void *)__pyx_tp_traverse_9planarity_7classic_9planarity_PGraph}, {Py_tp_clear, (void *)__pyx_tp_clear_9planarity_7classic_9planarity_PGraph}, {Py_tp_methods, (void *)__pyx_methods_9planarity_7classic_9planarity_PGraph}, {Py_tp_init, (void *)__pyx_pw_9planarity_7classic_9planarity_6PGraph_1__init__}, {Py_tp_new, (void *)__pyx_tp_new_9planarity_7classic_9planarity_PGraph}, {0, 0}, }; static PyType_Spec __pyx_type_9planarity_7classic_9planarity_PGraph_spec = { "planarity.classic.planarity.PGraph", sizeof(struct __pyx_obj_9planarity_7classic_9planarity_PGraph), 0, Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, __pyx_type_9planarity_7classic_9planarity_PGraph_slots, }; #else static PyTypeObject __pyx_type_9planarity_7classic_9planarity_PGraph = { PyVarObject_HEAD_INIT(0, 0) "planarity.classic.planarity.""PGraph", /*tp_name*/ sizeof(struct __pyx_obj_9planarity_7classic_9planarity_PGraph), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_9planarity_7classic_9planarity_PGraph, /*tp_dealloc*/ 0, /*tp_vectorcall_offset*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_as_async*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ PyDoc_STR("PGraph(graph)"), /*tp_doc*/ __pyx_tp_traverse_9planarity_7classic_9planarity_PGraph, /*tp_traverse*/ __pyx_tp_clear_9planarity_7classic_9planarity_PGraph, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_9planarity_7classic_9planarity_PGraph, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ #endif __pyx_pw_9planarity_7classic_9planarity_6PGraph_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_9planarity_7classic_9planarity_PGraph, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ #else NULL, /*tp_finalize*/ #endif #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 0, /*tp_vectorcall*/ #endif #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030C0000 0, /*tp_watched*/ #endif #if PY_VERSION_HEX >= 0x030d00A4 0, /*tp_versions_used*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; #endif static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; /* #### Code section: initfunc_declarations ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/ /* #### Code section: init_module ### */ static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); /*--- Global init code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); /*--- Variable export code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); /*--- Function export code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ #if CYTHON_USE_TYPE_SPECS __pyx_mstate->__pyx_ptype_9planarity_7classic_9planarity_PGraph = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9planarity_7classic_9planarity_PGraph_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9planarity_7classic_9planarity_PGraph)) __PYX_ERR(0, 12, __pyx_L1_error) if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9planarity_7classic_9planarity_PGraph_spec, __pyx_mstate->__pyx_ptype_9planarity_7classic_9planarity_PGraph) < (0)) __PYX_ERR(0, 12, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_9planarity_7classic_9planarity_PGraph = &__pyx_type_9planarity_7classic_9planarity_PGraph; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9planarity_7classic_9planarity_PGraph) < (0)) __PYX_ERR(0, 12, __pyx_L1_error) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9planarity_7classic_9planarity_PGraph); #endif #if !CYTHON_COMPILING_IN_LIMITED_API if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_9planarity_7classic_9planarity_PGraph->tp_dictoffset && __pyx_mstate->__pyx_ptype_9planarity_7classic_9planarity_PGraph->tp_getattro == PyObject_GenericGetAttr)) { __pyx_mstate->__pyx_ptype_9planarity_7classic_9planarity_PGraph->tp_getattro = PyObject_GenericGetAttr; } #endif if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_PGraph, (PyObject *) __pyx_mstate->__pyx_ptype_9planarity_7classic_9planarity_PGraph) < (0)) __PYX_ERR(0, 12, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_9planarity_7classic_9planarity_PGraph) < (0)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); /*--- Variable import code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); /*--- Function import code ---*/ __Pyx_RefNannyFinishContext(); return 0; } #if CYTHON_PEP489_MULTI_PHASE_INIT static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ static int __pyx_pymod_exec_planarity(PyObject* module); /*proto*/ static PyModuleDef_Slot __pyx_moduledef_slots[] = { {Py_mod_create, (void*)__pyx_pymod_create}, {Py_mod_exec, (void*)__pyx_pymod_exec_planarity}, #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING {Py_mod_gil, __Pyx_FREETHREADING_COMPATIBLE}, #endif #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, #endif {0, NULL} }; #endif #ifdef __cplusplus namespace { struct PyModuleDef __pyx_moduledef = #else static struct PyModuleDef __pyx_moduledef = #endif { PyModuleDef_HEAD_INIT, "planarity", __pyx_k_Wrapper_for_Boyer_s_c_planarity, /* m_doc */ #if CYTHON_USE_MODULE_STATE sizeof(__pyx_mstatetype), /* m_size */ #else (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */ #endif __pyx_methods /* m_methods */, #if CYTHON_PEP489_MULTI_PHASE_INIT __pyx_moduledef_slots, /* m_slots */ #else NULL, /* m_reload */ #endif #if CYTHON_USE_MODULE_STATE __pyx_m_traverse, /* m_traverse */ __pyx_m_clear, /* m_clear */ NULL /* m_free */ #else NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ #endif }; #ifdef __cplusplus } /* anonymous namespace */ #endif /* PyModInitFuncType */ #ifndef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #else #ifdef __cplusplus #define __Pyx_PyMODINIT_FUNC extern "C" PyObject * #else #define __Pyx_PyMODINIT_FUNC PyObject * #endif #endif __Pyx_PyMODINIT_FUNC PyInit_planarity(void) CYTHON_SMALL_CODE; /*proto*/ __Pyx_PyMODINIT_FUNC PyInit_planarity(void) #if CYTHON_PEP489_MULTI_PHASE_INIT { return PyModuleDef_Init(&__pyx_moduledef); } /* ModuleCreationPEP489 */ #if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) { { PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think if (!module) { PyErr_Clear(); // just try the 3.8-3.12 version module = PyImport_ImportModule("_xxsubinterpreters"); if (!module) goto bad; } PyObject *current = PyObject_CallMethod(module, "get_current", NULL); Py_DECREF(module); if (!current) goto bad; if (PyTuple_Check(current)) { PyObject *new_current = PySequence_GetItem(current, 0); Py_DECREF(current); current = new_current; if (!new_current) goto bad; } long long as_c_int = PyLong_AsLongLong(current); Py_DECREF(current); return as_c_int; } bad: PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n"); return -1; } #endif #if !CYTHON_USE_MODULE_STATE static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { static PY_INT64_T main_interpreter_id = -1; #if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); #elif CYTHON_COMPILING_IN_GRAAL PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); #elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId(); #elif CYTHON_COMPILING_IN_LIMITED_API PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get()); #else PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); #endif if (unlikely(current_id == -1)) { return -1; } if (main_interpreter_id == -1) { main_interpreter_id = current_id; return 0; } else if (unlikely(main_interpreter_id != current_id)) { PyErr_SetString( PyExc_ImportError, "Interpreter change detected - this module can only be loaded into one interpreter per process."); return -1; } return 0; } #endif static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { if (allow_none || value != Py_None) { result = PyDict_SetItemString(moddict, to_name, value); } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Clear(); } else { result = -1; } return result; } static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; CYTHON_UNUSED_VAR(def); #if !CYTHON_USE_MODULE_STATE if (__Pyx_check_single_interpreter()) return NULL; #endif if (__pyx_m) return __Pyx_NewRef(__pyx_m); modname = PyObject_GetAttrString(spec, "name"); if (unlikely(!modname)) goto bad; module = PyModule_NewObject(modname); Py_DECREF(modname); if (unlikely(!module)) goto bad; moddict = PyModule_GetDict(module); if (unlikely(!moddict)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; return module; bad: Py_XDECREF(module); return NULL; } static CYTHON_SMALL_CODE int __pyx_pymod_exec_planarity(PyObject *__pyx_pyinit_module) #endif { int stringtab_initialized = 0; #if CYTHON_USE_MODULE_STATE int pystate_addmodule_run = 0; #endif __pyx_mstatetype *__pyx_mstate = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannyDeclarations #if CYTHON_PEP489_MULTI_PHASE_INIT if (__pyx_m) { if (__pyx_m == __pyx_pyinit_module) return 0; PyErr_SetString(PyExc_RuntimeError, "Module 'planarity' has already been imported. Re-initialisation is not supported."); return -1; } #else if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif /*--- Module creation code ---*/ #if CYTHON_PEP489_MULTI_PHASE_INIT __pyx_t_1 = __pyx_pyinit_module; Py_INCREF(__pyx_t_1); #else __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) #endif #if CYTHON_USE_MODULE_STATE { int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef); __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "planarity" pseudovariable */ if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) pystate_addmodule_run = 1; } #else __pyx_m = __pyx_t_1; #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED); #endif __pyx_mstate = __pyx_mstate_global; CYTHON_UNUSED_VAR(__pyx_t_1); __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_mstate->__pyx_d); __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) /* ImportRefnannyAPI */ #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("PyInit_planarity", 0); __Pyx_init_runtime_version(); if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Library function declarations ---*/ /*--- Initialize various global constants etc. ---*/ if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) stringtab_initialized = 1; if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error) if (__pyx_module_is_main_planarity__classic__planarity) { if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) } { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "planarity.classic.planarity")) { if (unlikely((PyDict_SetItemString(modules, "planarity.classic.planarity", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) } } /*--- Builtin init code ---*/ if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Global type/function init code ---*/ (void)__Pyx_modinit_global_init_code(__pyx_mstate); (void)__Pyx_modinit_variable_export_code(__pyx_mstate); (void)__Pyx_modinit_function_export_code(__pyx_mstate); if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) (void)__Pyx_modinit_type_import_code(__pyx_mstate); (void)__Pyx_modinit_variable_import_code(__pyx_mstate); (void)__Pyx_modinit_function_import_code(__pyx_mstate); /*--- Execution code ---*/ /* "planarity/classic/planarity.pyx":7 * """ * from libc.stdlib cimport free * import warnings # <<<<<<<<<<<<<< * * from planarity.classic cimport cplanarity */ __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_warnings, 0, 0, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) __pyx_t_2 = __pyx_t_1; __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_warnings, __pyx_t_2) < (0)) __PYX_ERR(0, 7, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/classic/planarity.pyx":68 * * * def embed_planar(self): # <<<<<<<<<<<<<< * if self.embedding != 0: * return */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_5embed_planar, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_embed_planar, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_embed_planar, __pyx_t_2) < (0)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/classic/planarity.pyx":80 * * * def embed_drawplanar(self): # <<<<<<<<<<<<<< * status = cplanarity.gp_ExtendWith_DrawPlanar(self.theGraph) * if status != cplanarity.OK: */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_7embed_drawplanar, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_embed_drawplanar, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_embed_drawplanar, __pyx_t_2) < (0)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/classic/planarity.pyx":91 * * * def is_planar(self): # <<<<<<<<<<<<<< * """Return True if graph is planar.""" * self.embed_planar() */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_9is_planar, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_is_planar, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_is_planar, __pyx_t_2) < (0)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/classic/planarity.pyx":99 * * * def kuratowski_edges(self): # <<<<<<<<<<<<<< * if self.is_planar(): * return [] */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_11kuratowski_edges, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_kuratowski_edges, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_kuratowski_edges, __pyx_t_2) < (0)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/classic/planarity.pyx":108 * * * def nodes(self, include_drawplanar_vertex_info=False): # <<<<<<<<<<<<<< * first=cplanarity.gp_LowerBoundVertices(self.theGraph) * last=cplanarity.gp_UpperBoundVertices(self.theGraph) */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_13nodes, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_nodes, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[0]); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_nodes, __pyx_t_2) < (0)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/classic/planarity.pyx":135 * * * def edges(self, include_drawplanar_edge_info=False): # <<<<<<<<<<<<<< * edges=[] * r=self.reverse_nodemap */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_15edges, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_edges, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[0]); if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_edges, __pyx_t_2) < (0)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/classic/planarity.pyx":171 * * * def ascii(self): # <<<<<<<<<<<<<< * cdef char* s = NULL * self.embed_drawplanar() */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_17ascii, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_ascii, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_ascii, __pyx_t_2) < (0)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/classic/planarity.pyx":180 * * * def write(self,path): # <<<<<<<<<<<<<< * bpath=path.encode() * status=cplanarity.gp_Write(self.theGraph, bpath, */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_19write, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_write, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_write, __pyx_t_2) < (0)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/classic/planarity.pyx":185 * cplanarity.WRITE_ADJLIST) * * def mapping(self): # <<<<<<<<<<<<<< * return self.reverse_nodemap */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_21mapping, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph_mapping, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 185, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_7classic_9planarity_PGraph, __pyx_mstate_global->__pyx_n_u_mapping, __pyx_t_2) < (0)) __PYX_ERR(0, 185, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError, "self.theGraph cannot be converted to a Python object for pickling" * def __setstate_cython__(self, __pyx_state): */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_23__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_2) < (0)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError, "self.theGraph cannot be converted to a Python object for pickling" * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "self.theGraph cannot be converted to a Python object for pickling" */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_7classic_9planarity_6PGraph_25__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_PGraph___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_planarity_classic_planarity, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < (0)) __PYX_ERR(1, 3, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/classic/planarity.pyx":1 * #!python # <<<<<<<<<<<<<< * #cython: embedsignature=True * """ */ __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_2) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { if (__pyx_mstate->__pyx_d && stringtab_initialized) { __Pyx_AddTraceback("init planarity.classic.planarity", __pyx_clineno, __pyx_lineno, __pyx_filename); } #if !CYTHON_USE_MODULE_STATE Py_CLEAR(__pyx_m); #else Py_DECREF(__pyx_m); if (pystate_addmodule_run) { PyObject *tp, *value, *tb; PyErr_Fetch(&tp, &value, &tb); PyState_RemoveModule(&__pyx_moduledef); PyErr_Restore(tp, value, tb); } #endif } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init planarity.classic.planarity"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if CYTHON_PEP489_MULTI_PHASE_INIT return (__pyx_m != NULL) ? 0 : -1; #else return __pyx_m; #endif } /* #### Code section: pystring_table ### */ /* #### Code section: cached_builtins ### */ static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 31, __pyx_L1_error) /* Cached unbound methods */ __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items; __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type; __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop; __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type; __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values; return 0; __pyx_L1_error:; return -1; } /* #### Code section: cached_constants ### */ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "planarity/classic/planarity.pyx":108 * * * def nodes(self, include_drawplanar_vertex_info=False): # <<<<<<<<<<<<<< * first=cplanarity.gp_LowerBoundVertices(self.theGraph) * last=cplanarity.gp_UpperBoundVertices(self.theGraph) */ __pyx_mstate_global->__pyx_tuple[0] = PyTuple_Pack(1, Py_False); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]); __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]); #if CYTHON_IMMORTAL_CONSTANTS { PyObject **table = __pyx_mstate->__pyx_tuple; for (Py_ssize_t i=0; i<1; ++i) { #if PY_VERSION_HEX >= 0x030F0000 PyUnstable_SetImmortal(table[i]); #elif CYTHON_COMPILING_IN_CPYTHON_FREETHREADING if ((PY_SSIZE_T_MAX <= _Py_IMMORTAL_REFCNT_LOCAL)) break; #if PY_VERSION_HEX < 0x030E0000 if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1) #else if (PyUnstable_Object_IsUniquelyReferenced(table[i])) #endif { Py_SET_REFCNT(table[i], ((Py_ssize_t)_Py_IMMORTAL_REFCNT_LOCAL + 1)); } #else if ((PY_SSIZE_T_MAX < _Py_IMMORTAL_INITIAL_REFCNT)) break; Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); #endif } } #endif __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } /* #### Code section: init_constants ### */ static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); { const struct { const unsigned int length: 9; } index[] = {{1},{18},{1},{7},{6},{2},{23},{9},{25},{31},{30},{60},{61},{37},{28},{65},{14},{6},{24},{26},{12},{12},{23},{19},{16},{23},{14},{12},{12},{20},{5},{18},{5},{18},{20},{22},{1},{8},{13},{10},{5},{16},{12},{6},{6},{5},{8},{12},{5},{28},{30},{13},{7},{9},{5},{4},{16},{4},{8},{7},{10},{8},{3},{5},{4},{27},{3},{8},{11},{12},{1},{10},{17},{13},{1},{4},{12},{10},{12},{19},{6},{8},{6},{1},{6},{10},{15},{12},{4},{8},{5},{3},{290},{193},{73},{72},{48},{30},{27},{56},{9},{9}}; #if (CYTHON_COMPRESS_STRINGS) == 3 && __PYX_LIMITED_VERSION_HEX >= 0x030e0000 /* compression: zstd (1178 bytes) */ const char* const cstring = "(\265/\375`\374\006\205$\000\306\271\307; \225\033\000\034\266\224^\217\032k)\303\031eh\303\014\345\201BD\032\311\2244y\226\204\300Z\256\224\346v\235\021t\276\010I0\277\342\361Q\336O.\000\277X\r\270\203\035B\353\003\250\000\247\000\305\000Z\207\035{\354\273\317\375\336\360\346\320\0243\277\367\205\243\222Cn\222\335w\224\333\326#.\324%\310I\033\350\303LT#\301M\016\371\035\016\210=\317F\233\014\301\\\3338\214\311C\376e\033s\177yrg$=b\355\365\326:\314\305\236\271\351C\223\373\016\202C^\353\300\241\022\363\033(\356\354\2172H\372\227(bPc\333\321\256|}\204\272w<\206\037/Nr\236A\223\235\327\034o<\226b\327`\276\211\031\034\3638b\216K\360\2665'\367M\207\267\235\363X\303]\213+\271\334y\320\233\345\326\340\326\221\033\267w\\\001\255\266u\301#@}\314;@\375\325\n;\265\245F\332\034\353z6Gld\224=\026K3\373{\273y\375hb[\026\373\275|\304f\256\274\267g\277\253\335]Y\222\345\213\327r\021\336y4E\362\336\255q\021\036\373.\343zQ\366\272\353\333\365\275Y4\307p\353{\273\3416m\367\372\316\265-\334\331s\354\373&\265\327\235,\363\021i\303\205\270\226C\314\375\335\372\216\341\220\307e\255\347\255\275Ir2|\221:\334\273\216m9\307\346\372P\277\034\355\262\327\\'\222\273,q\321\325\270\256#=\346&\256\353+\346ZQ\017k\310\251\315\361\020P?\031\013\261\3228\322\n\025\301\372r\203F\250~05@\242\365\223\2556\231zRs)N[R\036t\302\001@`i\245n\200\037\246v\200\037\374\271u`\005\211\3704\235V\007\247\335\365b\275\204^\310\236\344\250\026\252\r\032\321\372\355\320Z\010\037\255'\353\275t\264\035\255\357\323\323\002\371X>\223O\306\325\272Z\377\n\265B:\255\367a\237\rH\013\322\372\345\324\217\326\317\235\r\254\277B\371\031;\025T?\307\322\254\2475\247\"\244\240\352\313\320\nT\343L H\301\324\247`\223\324\230J\241r<\264\017\251?C\215N|.\2340\274\024\352G\261\212\352Lu5\264\r\250\017[\275\212\325W\263\263\203Gp\372&%\330\351u\347\321\214'\223\235>\223\017\210e\261&\226D\342\345Jr@\0352N\321\244\246\240\005\347K\315\017\306\236L\2641\265\006\2058W\006\037v*\244\220FDJR\213T\2332\261/\353\317\300\002M\342\305\322XJ\221V$""\220\214\374\225JKei\t\352\221C]\347\010\257\200\245\255\2625\006\321B\240\276L\351\233\026T?YzJs(F[P\236\223a\005K-Z\177\226b\264\276I\325he\250\034\254\2373kC\337I\317\2639\254\005\033\244\262T\236\272\244\027\254\226\205\323\002\365X=S\217\005\243\305P\375\2146C\365\201~\332$_\314G\341\233\341h9T?\325O}\214\352`\001\200\243\2501\035c\n\241\021\231\021I\222\302,\007 \204\030\246\312\356\"\302\246\004\rfhF\202\031m*\373\314\001\020\001\255\000R\226i\016\265\24513\26254x9\363}\342y\367\231h\324\0021\213G\302\215U\023\035\257t\362_\003\362\230\270\213\300\022\244|\201\353\260B}!\335A\350j*\032\220\002n\031\244o\360\002\227\3429+?\357\361\210\234\2444\252\326\222\257\340\177L\222\255rFq\317N\tN\224\202C\223\310\310\235r\302\351\235P\301\307\233Wn\"\247SoSR\031(T\252\263\021\243\231\364\215\317\207e\321\374w\271\2261\002\306\035.c\344\212*\331\334S\376\226\006G\210b\342[L\373HY\367Y\361\234$3S\\g\205\"\020\"\304\362\332\315\226\374\037\2442\301!_2\255\016%\344\337\203+s{N\227xo\023\024\351\027\264 \251\374\354_\263sx\2501x\330\365>=\202\247\351\252\0064\256\217O\030\234\244\377e\000N\370\341\256y_\312\311|~\332B\222g\223\224#=:\024\344F2\312~\314lL\020\r6\203\226\372\214+\306zD\264\2046I\201pi\205E\364\347J\237:\373\300\347\027<\366R\352\220\243\021R\016H\327\031n\177\327\254\254\367\340\026\025\254r\214\362\3372,X\341g\016t\347\023[Z\014\345\017"; PyObject *data = __Pyx_DecompressString(cstring, 1178, 3); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif #elif (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (1259 bytes) */ const char* const cstring = "BZh91AY&SY\257\322$\227\000\000\221\177\377\355\337\377\377~\377\355\377\376\333\376\373\277\377\377\370@@@@@@@@@@@@@\000@\000P\004]\335\026\264\210\226\203\203\203SQM=&\230\215\244z\236\215\004\320d\323\321\032\001\223@\000\006\200z\206\236\240\364\200\365\017P\323h\214\232\t$\021\211\031'\243R\237\206\244\364\230\325\014\230M\000\r\000\000\000\r\000h44\r\001\246\200\320CH&\215L\236@\247\246\241\2402\000\006\200\000\000\000\000\320\003C h\311\240\323T\323Q\014\324\032hz\200\007\250m@\014@\000\001\220\000\000\000\032\003A\221\352hp\000\000\000\000\000\000\0004\000\000\000\000\000\000\000\000\310\333A2o\340\370T\311\250\363\301Jzp+@'!D$ $B\024\217\326\244\037\313(\031\024\206n\"J\220\021\230ey\031\003\246\273\032\323ZAd\324!DLB\231\320lhZ\325R\272V\\c\"\233X\314X\210\014\347\231\232\350\332\311\363\271\313!><\262tr\336Y\374\315\037w\353\347\361?\266\206\223\010\200\307\021\027=\"\215\371\213\265\026 9\302\3259E\210\\\253\021\030\275\232\031.\311\026\326\030\257\302)\205\225\034\234'\357\232\313\335$\032 a~z\226\374>\331W\201\010\256\351\341=\030;J\035\031\005\2302\321\234\224\n\206f\02525\275^t+\020\016(\007\346e^+^\274}\216\031\336/\036\3537U\260\3632N\340\224\216\360\336`\233g\256\250\016Yg8\371\276\214\006\273\000J\3157\353\201\202uM\202\204\267\034CPw\354\203\347\013j\206\220\032)O\t\233\262\333\263\301dU\023>\303\255om\367\027\026\224\353\265\263\335\371e\216L\350\275\216\323\013\2779NG9\303\332,\316\276\267\314`\356\356U\226X\263\262\322\000pL\034\201q\207D\354\003C3\335\251Hqc7\302\002\034\341\305\032gc\030V\320\375\241p\1776\307\263\376It\322F\021\020VA\007e\204\273Fs\177$\326H#D\212\017\251\311r\316Z[\216\003or\240\367k\302\360\331\344\255X`\266\021\254\336\001\261DAZ\277.k\312Y\237CL\034\006\312\333\342\014\001vv\016\265t\302@\002\275\355J'\3240\306\340\021\252\254c\377V1\323U\254\247 \300f\021\014\362\003,\350\002j\264\014\246\003 Z\244K*^8\234p\201m\033\366i\032\023\\%3\214\2532\250\230\316~1@\231eV<{\365QA\207\315\221\374P\263T- \020)`>Z^\210\304\027""\247\266\265[Tj\2433\t0\314&\215\203\335\224\207\347\245r\221M\232w\250@.\302\024\035m\305\2221\335L\372\233$\250\273r\313\307\244[\215\260M\022\217\245\311\"#\365\344\201\022\221\204*\311&P\226\2468\000\244\211@\270\004\306j+\232\014D@\345\3330`G\023 T\236\230\214\356\303n\345\"2\010]\001k\205\270\205\306b\371\010<\356\272Fxp\343L\007\024)\246:4^ \214\315.m\361\220\303\256\335\206\276k\224\032\225\2240\315\005\227\320\330\210\034\210J0,T\353(\035S\n\277\\\026\211\002|\200\331\227^\204\004!\261L\223Tq\225\017%-Pf\005\261\261\211\305\241\240\310j\314\332 *T\207Ta\300\370Z\026\300\260\341\270\327+\332V\031\231\3573\014\303u\366\220\256\2538[{k\3569\032L\003_$Z:\265u\261\212\"\235\236(s\354\030\264\036WE@\310B\225\210\255\261\326\2709\337\356!\"\364\352r]\270\303J\342q\315\344\302\262\217\303\204t\360&eKU\036Vj\230\230`\337\230\217\002\351<\217\024u\203Tw\273*\231\307\211\263\255\210^\307Q|H\240a\362\277\210!\330\r\3522~\305\030\313\030o\032\023\006\010\355\322\357 \260x#\343\025j\0328\353\263g\232\0335\301\353\214\266}\216:\216\233M\2021\317\301\2261a\211\341\350D\235\264b\246\302!^\331w\" z*\234\332\217\204U\351\210\271\014,_U\325L%)4\016\206\022\020H38\324\2157\245A\324\240\201\341=\354\305\004\351\205Rh\"u\304\345;\252\215\274v\333\301\032\315l\310P\217\260\237\357\r\276\252W\001\020\351+6\034\207\343\372B\n\276\214\353\216\373t!\254*\n\260M&l\211x\270\212\247\321\021\250\216\303\210\355CR\004P}\t'\235\004\023\203\345Z\245OG\023\326\016xt\\M\000\3673\331t'wd\343\265\222U\326\365Cgb\205\260\300\326\201\253\t\224\341eb\367\177\305\334\221N\024$+\364\211%\300"; PyObject *data = __Pyx_DecompressString(cstring, 1259, 2); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (1151 bytes) */ const char* const cstring = "x\332\215S\317S\333F\024\256\247L\313\200\023l\342\024\023HF\2040\244P\014\236zJR\372\313)\235t\332\t\305@&m\231fg-\255a\213X\311\322\nc\270p\364QG\035u\324QG\035}\364Q\307=\372O\350\237\320\267\262\261M`\246\365\214\274\373~\354\267\337\373\336\333\265\267\354\204\031\r\246Pf:\\\341M\223|\257Q\033WuB\230\374?R\351\0213,\312\216\024\023[X\327\211\256\020\355\210(\324\356%h\246\216\031\266(o~\255\\\203\021\3132\254\302 \260\256\352\330\266\251\272>\360\024\314\346\371\310\271\032\246\000\244`M\223\367H\370\302\355(7\024r\316\t\323\224#\013\233\307J\203\362ce\220\246\330\334rT\356X\304\376\277g5\0137z\251\377y\2302\312)\326\351\005\351\001\214$\365\000\231\301\373\\\n6\321k\005~L^'\001\0253\031\253\022E5\330\031\261x\017\020+\273M~l0\305\250\376MT\256\324\014K1\251z\242\203\000\337\000\033Xl\303\261T\362\335n\202\323\373/ d\021\315Q\tR\223\323\010\r\3746\3416\307\374V\004\333*\245\375\275\024\326\276\336\237V\211\206\206\022\334p\337pQ\373\246}\342X\230\033\r\373\204\242Q\300Sl\232\300\272o1C\033D\032 \024\001B\315s\370\266\251\312\321\0164c\217\324\022n\330n2\225\032\005\325\260\014\207SF\354\252\211\371\261\nJ\020D\031\342\026VI\025\253'C\256\311\275\020\253\031#\276D\333\363\304K\2228t;YM\303\206\346\031,1@#\331\002\240\375\241\000\243\225\023\246\002\377\336\304\324\250es\204j\016S\021\374\216\256uFI\343)SuG#\350.rw\304FH\"\320uP3\354\345\261\201\324 \330\251}B\232\366\207b\303C\0022\247\030\204A}\305ach\216N$;\206OaeU+\321_\3528|r\375G8\034p\3230\315&\25269\261\021\202\007\211\372\205\325\035\254\367\200\254\301\274\241[\2237p@=\310\226C\237\014a\237\002\3544h\260\243\363\221\321Dw\214\251\264\034\270\037H@\252cj\020<;\303\272C\354\276X\320\203\376\356\272\223}3\351e\003[L~\362\301$\203vA\315x\254\030f\305\370\375\026\026\343\023\255gr\311\307\371B\200\003\036\026\305\370L<\263\026T\002-\\\350\216\247[?\271\017]\354\236y\025\221~\024?Z\t\026\202Rp\031-\210\264\342O\014\215i\367\271\367\324+\213\214\342O\005\365p,\3745\252\213\314\003\267\344Z^V\344f\334\272\310""\257\007\365n~#\336\330\351\340\016\217\367\337\307\357\221\310\257\305k?wR\235\\\3470\376\375\017\221_\215W\267\333\345\366Ag.>x\333\315\317{;\301b\260\007\274\266\"\265=\335.\265\233\361\356~\274\177 \3467\302O\303\272P\200\265PV\203\242P>\017\262\377|\362\321\354\023\357\235\377\312\307~=\030\013\312PF-,w\363\217\007\316\217\203\242tw3\363\336o\260\335\016'\200~\346\251\277\002\336\203p.*w\307\247Z\365x\354K\251\304\335\252\014D\003\001\207\n5<,\322pTd\200H7\263\022\257\374\322Y\350\224:\227\361\237\207\"\263\034/\017\353\022\231\245x\351\207v\252\235k\037\306\273\300%\027\347\236\371?\372V\220\013\376\212\026\243\275\210\267\267:j\\\331\023\271\225`\031z\225\177\036\244D~\311\257\210\374\242_\2042\263\237\271\357\274W\036\366\352\376\230_\356f\036\016\314\224\220\005\\\225\305\370\\__pyx_string_tab; Py_ssize_t pos = 0; for (int i = 0; i < 92; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); if (likely(string) && i >= 17) PyUnicode_InternInPlace(&string); if (unlikely(!string)) { Py_XDECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } stringtab[i] = string; pos += bytes_length; } for (int i = 92; i < 102; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); stringtab[i] = string; pos += bytes_length; if (unlikely(!string)) { Py_XDECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } } Py_XDECREF(data); for (Py_ssize_t i = 0; i < 102; i++) { if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { __PYX_ERR(0, 1, __pyx_L1_error) } } #if CYTHON_IMMORTAL_CONSTANTS { PyObject **table = stringtab + 92; for (Py_ssize_t i=0; i<10; ++i) { #if PY_VERSION_HEX >= 0x030F0000 PyUnstable_SetImmortal(table[i]); #elif CYTHON_COMPILING_IN_CPYTHON_FREETHREADING if ((PY_SSIZE_T_MAX <= _Py_IMMORTAL_REFCNT_LOCAL)) break; #if PY_VERSION_HEX < 0x030E0000 if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1) #else if (PyUnstable_Object_IsUniquelyReferenced(table[i])) #endif { Py_SET_REFCNT(table[i], ((Py_ssize_t)_Py_IMMORTAL_REFCNT_LOCAL + 1)); } #else if ((PY_SSIZE_T_MAX < _Py_IMMORTAL_INITIAL_REFCNT)) break; Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); #endif } } #endif } { PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 0; int8_t const cint_constants_1[] = {1}; for (int i = 0; i < 1; i++) { numbertab[i] = PyLong_FromLong(cint_constants_1[i - 0]); if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error) } } #if CYTHON_IMMORTAL_CONSTANTS { PyObject **table = __pyx_mstate->__pyx_number_tab; for (Py_ssize_t i=0; i<1; ++i) { #if PY_VERSION_HEX >= 0x030F0000 PyUnstable_SetImmortal(table[i]); #elif CYTHON_COMPILING_IN_CPYTHON_FREETHREADING if ((PY_SSIZE_T_MAX <= _Py_IMMORTAL_REFCNT_LOCAL)) break; #if PY_VERSION_HEX < 0x030E0000 if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1) #else if (PyUnstable_Object_IsUniquelyReferenced(table[i])) #endif { Py_SET_REFCNT(table[i], ((Py_ssize_t)_Py_IMMORTAL_REFCNT_LOCAL + 1)); } #else if ((PY_SSIZE_T_MAX < _Py_IMMORTAL_INITIAL_REFCNT)) break; Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); #endif } } #endif return 0; __pyx_L1_error:; return -1; } /* #### Code section: init_codeobjects ### */ typedef struct { unsigned int argcount : 2; unsigned int num_posonly_args : 1; unsigned int num_kwonly_args : 1; unsigned int nlocals : 4; unsigned int flags : 10; unsigned int first_line : 8; } __Pyx_PyCode_New_function_description; /* NewCodeObj.proto */ static PyObject* __Pyx_PyCode_New( const __Pyx_PyCode_New_function_description descr, PyObject * const *varnames, PyObject *filename, PyObject *funcname, PyObject *line_table, PyObject *tuple_dedup_map ); static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { PyObject* tuple_dedup_map = PyDict_New(); if (unlikely(!tuple_dedup_map)) return -1; { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 68}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_status}; __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_embed_planar, __pyx_mstate->__pyx_kp_b_iso88591_A_4_Q_31D_7_q_aq_9AT_67_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 80}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_status}; __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_embed_drawplanar, __pyx_mstate->__pyx_kp_b_iso88591_A_4AT_7_q_aq_9AT_78_7_q_aq_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 91}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_is_planar, __pyx_mstate->__pyx_kp_b_iso88591_A_M_D_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 99}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_kuratowski_edges, __pyx_mstate->__pyx_kp_b_iso88591_A_4z_1_M_4vQ_1_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 11, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 108}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_include_drawplanar_vertex_info, __pyx_mstate->__pyx_n_u_first, __pyx_mstate->__pyx_n_u_last, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_nodes, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_drawplanar_vertex_info, __pyx_mstate->__pyx_n_u_vertex_position, __pyx_mstate->__pyx_n_u_vertex_start, __pyx_mstate->__pyx_n_u_vertex_end}; __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_nodes, __pyx_mstate->__pyx_kp_b_iso88591_31_at1_Qd_a_a_E_awa_q_J_4_Z_DAT, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 14, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 135}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_include_drawplanar_edge_info, __pyx_mstate->__pyx_n_u_edges, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_first, __pyx_mstate->__pyx_n_u_last, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_is_edge, __pyx_mstate->__pyx_n_u_nbr, __pyx_mstate->__pyx_n_u_drawplanar_edge_info, __pyx_mstate->__pyx_n_u_edge_position, __pyx_mstate->__pyx_n_u_edge_start, __pyx_mstate->__pyx_n_u_edge_end}; __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_edges, __pyx_mstate->__pyx_kp_b_iso88591_1_a_a_at1_Qd_E_avQ_4_4_A_q_Kq_4, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 171}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_s, __pyx_mstate->__pyx_n_u_status, __pyx_mstate->__pyx_n_u_py_bytes}; __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_ascii, __pyx_mstate->__pyx_kp_b_iso88591_A_q_Q_8_1A_AQ_xwaq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 180}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_path, __pyx_mstate->__pyx_n_u_bpath, __pyx_mstate->__pyx_n_u_status}; __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_write, __pyx_mstate->__pyx_kp_b_iso88591_A_d_4, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 185}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_classic_planarity_pyx, __pyx_mstate->__pyx_n_u_mapping, __pyx_mstate->__pyx_kp_b_iso88591_A_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; } Py_DECREF(tuple_dedup_map); return 0; bad: Py_DECREF(tuple_dedup_map); return -1; } /* #### Code section: init_globals ### */ static int __Pyx_InitGlobals(void) { /* PythonCompatibility.init */ if (likely(__Pyx_init_co_variables() == 0)); else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) /* CommonTypesMetaclass.init */ if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) /* CachedMethodType.init */ #if CYTHON_COMPILING_IN_LIMITED_API { PyObject *typesModule=NULL; typesModule = PyImport_ImportModule("types"); if (typesModule) { __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType"); Py_DECREF(typesModule); } } // error handling follows #endif if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) /* CythonFunctionShared.init */ if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } /* #### Code section: cleanup_globals ### */ /* #### Code section: cleanup_module ### */ /* #### Code section: main_method ### */ /* #### Code section: utility_code_pragmas ### */ #ifdef _MSC_VER #pragma warning( push ) /* Warning 4127: conditional expression is constant * Cython uses constant conditional expressions to allow in inline functions to be optimized at * compile-time, so this warning is not useful */ #pragma warning( disable : 4127 ) #endif /* #### Code section: utility_code_def ### */ /* --- Runtime support code --- */ /* Refnanny */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule(modname); if (!m) goto end; p = PyObject_GetAttrString(m, "RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */ #if CYTHON_FAST_THREAD_STATE static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(tuple); for (i=0; i= 0x030C00A6 PyObject *current_exception = tstate->current_exception; if (unlikely(!current_exception)) return 0; exc_type = (PyObject*) Py_TYPE(current_exception); if (exc_type == err) return 1; #else exc_type = tstate->curexc_type; if (exc_type == err) return 1; if (unlikely(!exc_type)) return 0; #endif #if CYTHON_AVOID_BORROWED_REFS Py_INCREF(exc_type); #endif if (unlikely(PyTuple_Check(err))) { result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); } else { result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); } #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(exc_type); #endif return result; } #endif /* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { #if PY_VERSION_HEX >= 0x030C00A6 PyObject *tmp_value; assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); if (value) { #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) #endif PyException_SetTraceback(value, tb); } tmp_value = tstate->current_exception; tstate->current_exception = value; Py_XDECREF(tmp_value); Py_XDECREF(type); Py_XDECREF(tb); #else 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); #endif } static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { #if PY_VERSION_HEX >= 0x030C00A6 PyObject* exc_value; exc_value = tstate->current_exception; tstate->current_exception = 0; *value = exc_value; *type = NULL; *tb = NULL; if (exc_value) { *type = (PyObject*) Py_TYPE(exc_value); Py_INCREF(*type); #if CYTHON_COMPILING_IN_CPYTHON *tb = ((PyBaseExceptionObject*) exc_value)->traceback; Py_XINCREF(*tb); #else *tb = PyException_GetTraceback(exc_value); #endif } #else *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 } #endif /* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */ #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); return PyObject_GetAttr(obj, attr_name); } #endif /* PyObjectGetAttrStrNoError (used by GetBuiltinName) */ #if __PYX_LIMITED_VERSION_HEX < 0x030d0000 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) __Pyx_PyErr_Clear(); } #endif static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { PyObject *result; #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 (void) PyObject_GetOptionalAttr(obj, attr_name, &result); return result; #else #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); } #endif result = __Pyx_PyObject_GetAttrStr(obj, attr_name); if (unlikely(!result)) { __Pyx_PyObject_GetAttrStr_ClearAttributeError(); } return result; #endif } /* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name); if (unlikely(!result) && !PyErr_Occurred()) { PyErr_Format(PyExc_NameError, "name '%U' is not defined", name); } return result; } /* TupleAndListFromArray (used by fastcall) */ #if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL static CYTHON_INLINE PyObject * __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) { PyObject *res; Py_ssize_t i; if (n <= 0) { return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); } res = PyTuple_New(n); if (unlikely(res == NULL)) return NULL; for (i = 0; i < n; i++) { Py_INCREF(src[i]); if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { Py_DECREF(res); return NULL; } } return res; } #elif CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { PyObject *v; Py_ssize_t i; for (i = 0; i < length; i++) { v = dest[i] = src[i]; Py_INCREF(v); } } static CYTHON_INLINE PyObject * __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) { PyObject *res; if (n <= 0) { return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); } res = PyTuple_New(n); if (unlikely(res == NULL)) return NULL; __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); return res; } static CYTHON_INLINE PyObject * __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) { PyObject *res; if (n <= 0) { return PyList_New(0); } res = PyList_New(n); if (unlikely(res == NULL)) return NULL; __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); return res; } #endif /* BytesEquals (used by UnicodeEquals) */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\ !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) return PyObject_RichCompareBool(s1, s2, equals); #else if (s1 == s2) { return (equals == Py_EQ); } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { const char *ps1, *ps2; Py_ssize_t length = PyBytes_GET_SIZE(s1); if (length != PyBytes_GET_SIZE(s2)) return (equals == Py_NE); ps1 = PyBytes_AS_STRING(s1); ps2 = PyBytes_AS_STRING(s2); if (ps1[0] != ps2[0]) { return (equals == Py_NE); } else if (length == 1) { return (equals == Py_EQ); } else { int result; #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) Py_hash_t hash1, hash2; hash1 = ((PyBytesObject*)s1)->ob_shash; hash2 = ((PyBytesObject*)s2)->ob_shash; if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { return (equals == Py_NE); } #endif result = memcmp(ps1, ps2, (size_t)length); return (equals == Py_EQ) ? (result == 0) : (result != 0); } } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { return (equals == Py_NE); } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { return (equals == Py_NE); } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); Py_DECREF(py_result); return result; } #endif } /* UnicodeEquals (used by fastcall) */ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL return PyObject_RichCompareBool(s1, s2, equals); #else int s1_is_unicode, s2_is_unicode; if (s1 == s2) { goto return_eq; } s1_is_unicode = PyUnicode_CheckExact(s1); s2_is_unicode = PyUnicode_CheckExact(s2); if (s1_is_unicode & s2_is_unicode) { Py_ssize_t length, length2; int kind; void *data1, *data2; #if !CYTHON_COMPILING_IN_LIMITED_API if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) return -1; #endif length = __Pyx_PyUnicode_GET_LENGTH(s1); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(length < 0)) return -1; #endif length2 = __Pyx_PyUnicode_GET_LENGTH(s2); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(length2 < 0)) return -1; #endif if (length != length2) { goto return_ne; } #if CYTHON_USE_UNICODE_INTERNALS { Py_hash_t hash1, hash2; hash1 = ((PyASCIIObject*)s1)->hash; hash2 = ((PyASCIIObject*)s2)->hash; if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { goto return_ne; } } #endif kind = __Pyx_PyUnicode_KIND(s1); if (kind != __Pyx_PyUnicode_KIND(s2)) { goto return_ne; } data1 = __Pyx_PyUnicode_DATA(s1); data2 = __Pyx_PyUnicode_DATA(s2); if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { goto return_ne; } else if (length == 1) { goto return_eq; } else { int result = memcmp(data1, data2, (size_t)(length * kind)); return (equals == Py_EQ) ? (result == 0) : (result != 0); } } else if ((s1 == Py_None) & s2_is_unicode) { goto return_ne; } else if ((s2 == Py_None) & s1_is_unicode) { goto return_ne; } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); Py_DECREF(py_result); return result; } return_eq: return (equals == Py_EQ); return_ne: return (equals == Py_NE); #endif } /* fastcall */ #if CYTHON_METH_FASTCALL static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) { Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(n == -1)) return NULL; #endif for (i = 0; i < n; i++) { PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely(!namei)) return NULL; #endif if (s == namei) return kwvalues[i]; } for (i = 0; i < n; i++) { PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely(!namei)) return NULL; #endif int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ); if (unlikely(eq != 0)) { if (unlikely(eq < 0)) return NULL; return kwvalues[i]; } } return NULL; } #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { Py_ssize_t i, nkwargs; PyObject *dict; #if !CYTHON_ASSUME_SAFE_SIZE nkwargs = PyTuple_Size(kwnames); if (unlikely(nkwargs < 0)) return NULL; #else nkwargs = PyTuple_GET_SIZE(kwnames); #endif dict = PyDict_New(); if (unlikely(!dict)) return NULL; for (i=0; itp_call; if (unlikely(!call)) return PyObject_Call(func, arg, kw); if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) return NULL; result = (*call)(func, arg, kw); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* PyObjectCallMethO (used by PyObjectFastCall) */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { PyObject *self, *result; PyCFunction cfunc; cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); self = __Pyx_CyOrPyCFunction_GET_SELF(func); if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) return NULL; result = cfunc(self, arg); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* PyObjectFastCall (used by PyObjectCallOneArg) */ #if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) { PyObject *argstuple; PyObject *result = 0; size_t i; argstuple = PyTuple_New((Py_ssize_t)nargs); if (unlikely(!argstuple)) return NULL; for (i = 0; i < nargs; i++) { Py_INCREF(args[i]); if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad; } result = __Pyx_PyObject_Call(func, argstuple, kwargs); bad: Py_DECREF(argstuple); return result; } #endif #if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API #if PY_VERSION_HEX < 0x03090000 #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable) #elif CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) { PyTypeObject *tp = Py_TYPE(callable); #if defined(__Pyx_CyFunction_USED) if (__Pyx_CyFunction_CheckExact(callable)) { return __Pyx_CyFunction_func_vectorcall(callable); } #endif if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) { return NULL; } assert(PyCallable_Check(callable)); Py_ssize_t offset = tp->tp_vectorcall_offset; assert(offset > 0); vectorcallfunc ptr; memcpy(&ptr, (char *) callable + offset, sizeof(ptr)); return ptr; } #else #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable) #endif #endif static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) { Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); #if CYTHON_COMPILING_IN_CPYTHON if (nargs == 0 && kwargs == NULL) { if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) return __Pyx_PyObject_CallMethO(func, NULL); } else if (nargs == 1 && kwargs == NULL) { if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) return __Pyx_PyObject_CallMethO(func, args[0]); } #endif if (kwargs == NULL) { #if CYTHON_VECTORCALL #if CYTHON_COMPILING_IN_LIMITED_API return PyObject_Vectorcall(func, args, _nargs, NULL); #else vectorcallfunc f = __Pyx_PyVectorcall_Function(func); if (f) { return f(func, args, _nargs, NULL); } #endif #endif } if (nargs == 0) { return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs); } #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); #else return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); #endif } /* PyObjectCallOneArg (used by CallUnboundCMethod0) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *args[2] = {NULL, arg}; return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } /* UnpackUnboundCMethod (used by CallUnboundCMethod0) */ #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { PyObject *result; PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); if (unlikely(!selfless_args)) return NULL; result = PyObject_Call(method, selfless_args, kwargs); Py_DECREF(selfless_args); return result; } #elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000 static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { return _PyObject_Vectorcall (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames); } #else static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { return #if PY_VERSION_HEX < 0x03090000 _PyObject_Vectorcall #else PyObject_Vectorcall #endif (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames); } #endif static PyMethodDef __Pyx_UnboundCMethod_Def = { "CythonUnboundCMethod", __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall), #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 METH_VARARGS | METH_KEYWORDS, #else METH_FASTCALL | METH_KEYWORDS, #endif NULL }; static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { PyObject *method, *result=NULL; method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); if (unlikely(!method)) return -1; result = method; #if CYTHON_COMPILING_IN_CPYTHON if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) { PyMethodDescrObject *descr = (PyMethodDescrObject*) method; target->func = descr->d_method->ml_meth; target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); } else #endif #if CYTHON_COMPILING_IN_PYPY #else if (PyCFunction_Check(method)) #endif { PyObject *self; int self_found; #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY self = PyObject_GetAttrString(method, "__self__"); if (!self) { PyErr_Clear(); } #else self = PyCFunction_GET_SELF(method); #endif self_found = (self && self != Py_None); #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY Py_XDECREF(self); #endif if (self_found) { PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method); if (unlikely(!unbound_method)) return -1; Py_DECREF(method); result = unbound_method; } } #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING if (unlikely(target->method)) { Py_DECREF(result); } else #endif target->method = result; return 0; } /* CallUnboundCMethod0 */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); if (likely(was_initialized == 2 && cfunc->func)) { if (likely(cfunc->flag == METH_NOARGS)) return __Pyx_CallCFunction(cfunc, self, NULL); if (likely(cfunc->flag == METH_FASTCALL)) return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0); if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL); if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS))) return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL); if (cfunc->flag == METH_VARARGS) return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple); return __Pyx__CallUnboundCMethod0(cfunc, self); } #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING else if (unlikely(was_initialized == 1)) { __Pyx_CachedCFunction tmp_cfunc = { #ifndef __cplusplus 0 #endif }; tmp_cfunc.type = cfunc->type; tmp_cfunc.method_name = cfunc->method_name; return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self); } #endif PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self); __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); return result; } #endif static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { PyObject *result; if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; result = __Pyx_PyObject_CallOneArg(cfunc->method, self); return result; } /* py_dict_items (used by OwnedDictNext) */ static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) { return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d); } /* py_dict_values (used by OwnedDictNext) */ static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) { return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d); } /* OwnedDictNext (used by ParseKeywordsImpl) */ #if CYTHON_AVOID_BORROWED_REFS static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) { PyObject *next = NULL; if (!*ppos) { if (pvalue) { PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p); if (unlikely(!dictview)) goto bad; *ppos = PyObject_GetIter(dictview); Py_DECREF(dictview); } else { *ppos = PyObject_GetIter(p); } if (unlikely(!*ppos)) goto bad; } next = PyIter_Next(*ppos); if (!next) { if (PyErr_Occurred()) goto bad; return 0; } if (pkey && pvalue) { *pkey = __Pyx_PySequence_ITEM(next, 0); if (unlikely(*pkey)) goto bad; *pvalue = __Pyx_PySequence_ITEM(next, 1); if (unlikely(*pvalue)) goto bad; Py_DECREF(next); } else if (pkey) { *pkey = next; } else { assert(pvalue); *pvalue = next; } return 1; bad: Py_XDECREF(next); #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef"); #else PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef); #endif if (pkey) *pkey = NULL; if (pvalue) *pvalue = NULL; return 0; } #else // !CYTHON_AVOID_BORROWED_REFS static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) { int result = PyDict_Next(p, ppos, pkey, pvalue); if (likely(result == 1)) { if (pkey) Py_INCREF(*pkey); if (pvalue) Py_INCREF(*pvalue); } return result; } #endif /* RaiseDoubleKeywords (used by ParseKeywordsImpl) */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, "%s() got multiple values for keyword argument '%U'", func_name, kw_name); } /* CallUnboundCMethod2 */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); if (likely(was_initialized == 2 && cfunc->func)) { PyObject *args[2] = {arg1, arg2}; if (cfunc->flag == METH_FASTCALL) { return __Pyx_CallCFunctionFast(cfunc, self, args, 2); } if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL); } #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING else if (unlikely(was_initialized == 1)) { __Pyx_CachedCFunction tmp_cfunc = { #ifndef __cplusplus 0 #endif }; tmp_cfunc.type = cfunc->type; tmp_cfunc.method_name = cfunc->method_name; return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2); } #endif PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2); __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); return result; } #endif static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){ if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; #if CYTHON_COMPILING_IN_CPYTHON if (cfunc->func && (cfunc->flag & METH_VARARGS)) { PyObject *result = NULL; PyObject *args = PyTuple_New(2); if (unlikely(!args)) return NULL; Py_INCREF(arg1); PyTuple_SET_ITEM(args, 0, arg1); Py_INCREF(arg2); PyTuple_SET_ITEM(args, 1, arg2); if (cfunc->flag & METH_KEYWORDS) result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL); else result = __Pyx_CallCFunction(cfunc, self, args); Py_DECREF(args); return result; } #endif { PyObject *args[4] = {NULL, self, arg1, arg2}; return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } } /* ParseKeywordsImpl (used by ParseKeywords) */ static int __Pyx_ValidateDuplicatePosArgs( PyObject *kwds, PyObject ** const argnames[], PyObject ** const *first_kw_arg, const char* function_name) { PyObject ** const *name = argnames; while (name != first_kw_arg) { PyObject *key = **name; int found = PyDict_Contains(kwds, key); if (unlikely(found)) { if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; } name++; } return 0; bad: return -1; } #if CYTHON_USE_UNICODE_INTERNALS static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) { int kind; Py_ssize_t len = PyUnicode_GET_LENGTH(s1); if (len != PyUnicode_GET_LENGTH(s2)) return 0; kind = PyUnicode_KIND(s1); if (kind != PyUnicode_KIND(s2)) return 0; const void *data1 = PyUnicode_DATA(s1); const void *data2 = PyUnicode_DATA(s2); return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0); } #endif static int __Pyx_MatchKeywordArg_str( PyObject *key, PyObject ** const argnames[], PyObject ** const *first_kw_arg, size_t *index_found, const char *function_name) { PyObject ** const *name; #if CYTHON_USE_UNICODE_INTERNALS Py_hash_t key_hash = ((PyASCIIObject*)key)->hash; if (unlikely(key_hash == -1)) { key_hash = PyObject_Hash(key); if (unlikely(key_hash == -1)) goto bad; } #endif name = first_kw_arg; while (*name) { PyObject *name_str = **name; #if CYTHON_USE_UNICODE_INTERNALS if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) { *index_found = (size_t) (name - argnames); return 1; } #else #if CYTHON_ASSUME_SAFE_SIZE if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) #endif { int cmp = PyUnicode_Compare(name_str, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { *index_found = (size_t) (name - argnames); return 1; } } #endif name++; } name = argnames; while (name != first_kw_arg) { PyObject *name_str = **name; #if CYTHON_USE_UNICODE_INTERNALS if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) { if (__Pyx_UnicodeKeywordsEqual(name_str, key)) goto arg_passed_twice; } #else #if CYTHON_ASSUME_SAFE_SIZE if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) #endif { if (unlikely(name_str == key)) goto arg_passed_twice; int cmp = PyUnicode_Compare(name_str, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; } #endif name++; } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; bad: return -1; } static int __Pyx_MatchKeywordArg_nostr( PyObject *key, PyObject ** const argnames[], PyObject ** const *first_kw_arg, size_t *index_found, const char *function_name) { PyObject ** const *name; if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type; name = first_kw_arg; while (*name) { int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); if (cmp == 1) { *index_found = (size_t) (name - argnames); return 1; } if (unlikely(cmp == -1)) goto bad; name++; } name = argnames; while (name != first_kw_arg) { int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); if (unlikely(cmp != 0)) { if (cmp == 1) goto arg_passed_twice; else goto bad; } name++; } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%.200s() keywords must be strings", function_name); goto bad; bad: return -1; } static CYTHON_INLINE int __Pyx_MatchKeywordArg( PyObject *key, PyObject ** const argnames[], PyObject ** const *first_kw_arg, size_t *index_found, const char *function_name) { return likely(PyUnicode_CheckExact(key)) ? __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) : __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name); } static void __Pyx_RejectUnknownKeyword( PyObject *kwds, PyObject ** const argnames[], PyObject ** const *first_kw_arg, const char *function_name) { #if CYTHON_AVOID_BORROWED_REFS PyObject *pos = NULL; #else Py_ssize_t pos = 0; #endif PyObject *key = NULL; __Pyx_BEGIN_CRITICAL_SECTION(kwds); while ( #if CYTHON_AVOID_BORROWED_REFS __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL) #else PyDict_Next(kwds, &pos, &key, NULL) #endif ) { PyObject** const *name = first_kw_arg; while (*name && (**name != key)) name++; if (!*name) { size_t index_found = 0; int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); if (cmp != 1) { if (cmp == 0) { PyErr_Format(PyExc_TypeError, "%s() got an unexpected keyword argument '%U'", function_name, key); } #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(key); #endif break; } } #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(key); #endif } __Pyx_END_CRITICAL_SECTION(); #if CYTHON_AVOID_BORROWED_REFS Py_XDECREF(pos); #endif assert(PyErr_Occurred()); } static int __Pyx_ParseKeywordDict( PyObject *kwds, PyObject ** const argnames[], PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs) { PyObject** const *name; PyObject** const *first_kw_arg = argnames + num_pos_args; Py_ssize_t extracted = 0; #if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; #endif name = first_kw_arg; while (*name && num_kwargs > extracted) { PyObject * key = **name; PyObject *value; int found = 0; #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 found = PyDict_GetItemRef(kwds, key, &value); #else value = PyDict_GetItemWithError(kwds, key); if (value) { Py_INCREF(value); found = 1; } else { if (unlikely(PyErr_Occurred())) goto bad; } #endif if (found) { if (unlikely(found < 0)) goto bad; values[name-argnames] = value; extracted++; } name++; } if (num_kwargs > extracted) { if (ignore_unknown_kwargs) { if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1)) goto bad; } else { __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name); goto bad; } } return 0; bad: return -1; } static int __Pyx_ParseKeywordDictToDict( PyObject *kwds, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject** const *name; PyObject** const *first_kw_arg = argnames + num_pos_args; Py_ssize_t len; #if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; #endif if (PyDict_Update(kwds2, kwds) < 0) goto bad; name = first_kw_arg; while (*name) { PyObject *key = **name; PyObject *value; #if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop)) int found = PyDict_Pop(kwds2, key, &value); if (found) { if (unlikely(found < 0)) goto bad; values[name-argnames] = value; } #elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 int found = PyDict_GetItemRef(kwds2, key, &value); if (found) { if (unlikely(found < 0)) goto bad; values[name-argnames] = value; if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad; } #else #if CYTHON_COMPILING_IN_CPYTHON value = _PyDict_Pop(kwds2, key, kwds2); #else value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2); #endif if (value == kwds2) { Py_DECREF(value); } else { if (unlikely(!value)) goto bad; values[name-argnames] = value; } #endif name++; } len = PyDict_Size(kwds2); if (len > 0) { return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name); } else if (unlikely(len == -1)) { goto bad; } return 0; bad: return -1; } static int __Pyx_ParseKeywordsTuple( PyObject *kwds, PyObject * const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs) { PyObject *key = NULL; PyObject** const * name; PyObject** const *first_kw_arg = argnames + num_pos_args; for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) { #if CYTHON_AVOID_BORROWED_REFS key = __Pyx_PySequence_ITEM(kwds, pos); #else key = __Pyx_PyTuple_GET_ITEM(kwds, pos); #endif #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely(!key)) goto bad; #endif name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { PyObject *value = kwvalues[pos]; values[name-argnames] = __Pyx_NewRef(value); } else { size_t index_found = 0; int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); if (cmp == 1) { PyObject *value = kwvalues[pos]; values[index_found] = __Pyx_NewRef(value); } else { if (unlikely(cmp == -1)) goto bad; if (kwds2) { PyObject *value = kwvalues[pos]; if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else if (!ignore_unknown_kwargs) { goto invalid_keyword; } } } #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(key); key = NULL; #endif } return 0; invalid_keyword: PyErr_Format(PyExc_TypeError, "%s() got an unexpected keyword argument '%U'", function_name, key); goto bad; bad: #if CYTHON_AVOID_BORROWED_REFS Py_XDECREF(key); #endif return -1; } /* ParseKeywords */ static int __Pyx_ParseKeywords( PyObject *kwds, PyObject * const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs) { if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); else if (kwds2) return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name); else return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); } /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } /* HasAttr */ #if __PYX_LIMITED_VERSION_HEX < 0x030d0000 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { PyObject *r; if (unlikely(!PyUnicode_Check(n))) { PyErr_SetString(PyExc_TypeError, "hasattr(): attribute name must be string"); return -1; } r = __Pyx_PyObject_GetAttrStrNoError(o, n); if (!r) { return (unlikely(PyErr_Occurred())) ? -1 : 0; } else { Py_DECREF(r); return 1; } } #endif /* PyObjectFastCallMethod */ #if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) { PyObject *result; PyObject *attr = PyObject_GetAttr(args[0], name); if (unlikely(!attr)) return NULL; result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1); Py_DECREF(attr); return result; } #endif /* IterFinish (used by dict_iter) */ static CYTHON_INLINE int __Pyx_IterFinish(void) { PyObject* exc_type; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign exc_type = __Pyx_PyErr_CurrentExceptionType(); if (unlikely(exc_type)) { if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) return -1; __Pyx_PyErr_Clear(); return 0; } return 0; } /* PyObjectCallNoArg (used by PyObjectCallMethod0) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { PyObject *arg[2] = {NULL, NULL}; return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } /* PyObjectGetMethod (used by PyObjectCallMethod0) */ #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { PyObject *attr; #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP __Pyx_TypeName type_name; PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; descrgetfunc f = NULL; PyObject **dictptr, *dict; int meth_found = 0; assert (*method == NULL); if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { attr = __Pyx_PyObject_GetAttrStr(obj, name); goto try_unpack; } if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { return 0; } descr = _PyType_Lookup(tp, name); if (likely(descr != NULL)) { Py_INCREF(descr); #if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) #else #ifdef __Pyx_CyFunction_USED if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) #else if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) #endif #endif { meth_found = 1; } else { f = Py_TYPE(descr)->tp_descr_get; if (f != NULL && PyDescr_IsData(descr)) { attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); Py_DECREF(descr); goto try_unpack; } } } dictptr = _PyObject_GetDictPtr(obj); if (dictptr != NULL && (dict = *dictptr) != NULL) { Py_INCREF(dict); attr = __Pyx_PyDict_GetItemStr(dict, name); if (attr != NULL) { Py_INCREF(attr); Py_DECREF(dict); Py_XDECREF(descr); goto try_unpack; } Py_DECREF(dict); } if (meth_found) { *method = descr; return 1; } if (f != NULL) { attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); Py_DECREF(descr); goto try_unpack; } if (likely(descr != NULL)) { *method = descr; return 0; } type_name = __Pyx_PyType_GetFullyQualifiedName(tp); PyErr_Format(PyExc_AttributeError, "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", type_name, name); __Pyx_DECREF_TypeName(type_name); return 0; #else attr = __Pyx_PyObject_GetAttrStr(obj, name); goto try_unpack; #endif try_unpack: #if CYTHON_UNPACK_METHODS if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { PyObject *function = PyMethod_GET_FUNCTION(attr); Py_INCREF(function); Py_DECREF(attr); *method = function; return 1; } #endif *method = attr; return 0; } #endif /* PyObjectCallMethod0 (used by dict_iter) */ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) PyObject *args[1] = {obj}; (void) __Pyx_PyObject_CallOneArg; (void) __Pyx_PyObject_CallNoArg; return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); #else PyObject *method = NULL, *result = NULL; int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); if (likely(is_method)) { result = __Pyx_PyObject_CallOneArg(method, obj); Py_DECREF(method); return result; } if (unlikely(!method)) goto bad; result = __Pyx_PyObject_CallNoArg(method); Py_DECREF(method); bad: return result; #endif } /* RaiseNeedMoreValuesToUnpack (used by UnpackTuple2) */ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", index, (index == 1) ? "" : "s"); } /* RaiseTooManyValuesToUnpack (used by UnpackItemEndCheck) */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } /* UnpackItemEndCheck (used by UnpackTuple2) */ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { if (unlikely(retval)) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; } return __Pyx_IterFinish(); } /* RaiseNoneIterError (used by UnpackTupleError) */ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } /* UnpackTupleError (used by UnpackTuple2) */ static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { if (t == Py_None) { __Pyx_RaiseNoneNotIterableError(); } else { Py_ssize_t size = __Pyx_PyTuple_GET_SIZE(t); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(size < 0)) return; #endif if (size < index) { __Pyx_RaiseNeedMoreValuesError(size); } else { __Pyx_RaiseTooManyValuesError(index); } } } /* UnpackTuple2 (used by dict_iter) */ static CYTHON_INLINE int __Pyx_unpack_tuple2( PyObject* tuple, PyObject** value1, PyObject** value2, int is_tuple, int has_known_size, int decref_tuple) { if (likely(is_tuple || PyTuple_Check(tuple))) { Py_ssize_t size; if (has_known_size) { return __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple); } size = __Pyx_PyTuple_GET_SIZE(tuple); if (likely(size == 2)) { return __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple); } if (size >= 0) { __Pyx_UnpackTupleError(tuple, 2); } return -1; } else { return __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple); } } static CYTHON_INLINE int __Pyx_unpack_tuple2_exact( PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) { PyObject *value1 = NULL, *value2 = NULL; #if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS value1 = __Pyx_PySequence_ITEM(tuple, 0); if (unlikely(!value1)) goto bad; value2 = __Pyx_PySequence_ITEM(tuple, 1); if (unlikely(!value2)) goto bad; #else value1 = PyTuple_GET_ITEM(tuple, 0); Py_INCREF(value1); value2 = PyTuple_GET_ITEM(tuple, 1); Py_INCREF(value2); #endif if (decref_tuple) { Py_DECREF(tuple); } *pvalue1 = value1; *pvalue2 = value2; return 0; #if CYTHON_AVOID_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS bad: Py_XDECREF(value1); Py_XDECREF(value2); if (decref_tuple) { Py_XDECREF(tuple); } return -1; #endif } static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int has_known_size, int decref_tuple) { Py_ssize_t index; PyObject *value1 = NULL, *value2 = NULL, *iter = NULL; iternextfunc iternext; iter = PyObject_GetIter(tuple); if (unlikely(!iter)) goto bad; if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; } iternext = __Pyx_PyObject_GetIterNextFunc(iter); value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; } value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; } if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad; Py_DECREF(iter); *pvalue1 = value1; *pvalue2 = value2; return 0; unpacking_failed: if (!has_known_size && __Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); bad: Py_XDECREF(iter); Py_XDECREF(value1); Py_XDECREF(value2); if (decref_tuple) { Py_XDECREF(tuple); } return -1; } /* dict_iter */ #if CYTHON_AVOID_BORROWED_REFS #include #endif static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name, Py_ssize_t* p_orig_length, int* p_source_is_dict) { is_dict = is_dict || likely(PyDict_CheckExact(iterable)); *p_source_is_dict = is_dict; if (is_dict) { #if !CYTHON_AVOID_BORROWED_REFS *p_orig_length = PyDict_Size(iterable); Py_INCREF(iterable); return iterable; #else static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL; PyObject **pp = NULL; if (method_name) { const char *name = PyUnicode_AsUTF8(method_name); if (strcmp(name, "iteritems") == 0) pp = &py_items; else if (strcmp(name, "iterkeys") == 0) pp = &py_keys; else if (strcmp(name, "itervalues") == 0) pp = &py_values; if (pp) { if (!*pp) { *pp = PyUnicode_FromString(name + 4); if (!*pp) return NULL; } method_name = *pp; } } #endif } *p_orig_length = 0; if (method_name) { PyObject* iter; iterable = __Pyx_PyObject_CallMethod0(iterable, method_name); if (!iterable) return NULL; #if !CYTHON_AVOID_BORROWED_REFS if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable)) return iterable; #endif iter = PyObject_GetIter(iterable); Py_DECREF(iterable); return iter; } return PyObject_GetIter(iterable); } #if !CYTHON_AVOID_BORROWED_REFS static CYTHON_INLINE int __Pyx_dict_iter_next_source_is_dict( PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos, PyObject** pkey, PyObject** pvalue, PyObject** pitem) { PyObject *key, *value; if (unlikely(orig_length != PyDict_Size(iter_obj))) { PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration"); return -1; } if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) { return 0; } if (pitem) { PyObject* tuple = PyTuple_New(2); if (unlikely(!tuple)) { return -1; } Py_INCREF(key); Py_INCREF(value); #if CYTHON_ASSUME_SAFE_MACROS PyTuple_SET_ITEM(tuple, 0, key); PyTuple_SET_ITEM(tuple, 1, value); #else if (unlikely(PyTuple_SetItem(tuple, 0, key) < 0)) { Py_DECREF(value); Py_DECREF(tuple); return -1; } if (unlikely(PyTuple_SetItem(tuple, 1, value) < 0)) { Py_DECREF(tuple); return -1; } #endif *pitem = tuple; } else { if (pkey) { Py_INCREF(key); *pkey = key; } if (pvalue) { Py_INCREF(value); *pvalue = value; } } return 1; } #endif static CYTHON_INLINE int __Pyx_dict_iter_next( PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos, PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) { PyObject* next_item; #if !CYTHON_AVOID_BORROWED_REFS if (source_is_dict) { int result; #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API Py_BEGIN_CRITICAL_SECTION(iter_obj); #endif result = __Pyx_dict_iter_next_source_is_dict(iter_obj, orig_length, ppos, pkey, pvalue, pitem); #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API Py_END_CRITICAL_SECTION(); #endif return result; } else if (PyTuple_CheckExact(iter_obj)) { Py_ssize_t pos = *ppos; Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(iter_obj); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(tuple_size < 0)) return -1; #endif if (unlikely(pos >= tuple_size)) return 0; *ppos = pos + 1; #if CYTHON_ASSUME_SAFE_MACROS next_item = PyTuple_GET_ITEM(iter_obj, pos); #else next_item = PyTuple_GetItem(iter_obj, pos); if (unlikely(!next_item)) return -1; #endif Py_INCREF(next_item); } else if (PyList_CheckExact(iter_obj)) { Py_ssize_t pos = *ppos; Py_ssize_t list_size = __Pyx_PyList_GET_SIZE(iter_obj); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(list_size < 0)) return -1; #endif if (unlikely(pos >= list_size)) return 0; *ppos = pos + 1; next_item = __Pyx_PyList_GetItemRef(iter_obj, pos); if (unlikely(!next_item)) return -1; } else #endif { next_item = PyIter_Next(iter_obj); if (unlikely(!next_item)) { return __Pyx_IterFinish(); } } if (pitem) { *pitem = next_item; } else if (pkey && pvalue) { if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1)) return -1; } else if (pkey) { *pkey = next_item; } else { *pvalue = next_item; } return 1; } /* pyfrozenset_new (used by PySetContains) */ static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) { if (it) { PyObject* result; #if CYTHON_COMPILING_IN_PYPY PyObject* args; args = PyTuple_Pack(1, it); if (unlikely(!args)) return NULL; result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL); Py_DECREF(args); return result; #else if (PyFrozenSet_CheckExact(it)) { Py_INCREF(it); return it; } result = PyFrozenSet_New(it); if (unlikely(!result)) return NULL; if ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000) #if CYTHON_COMPILING_IN_LIMITED_API || __Pyx_get_runtime_version() >= 0x030A0000 #endif ) return result; { Py_ssize_t size = __Pyx_PySet_GET_SIZE(result); if (likely(size > 0)) return result; #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(size < 0)) { Py_DECREF(result); return NULL; } #endif } Py_DECREF(result); #endif } return __Pyx_PyObject_CallNoArg((PyObject*) &PyFrozenSet_Type); } /* PySetContains */ static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) { int result = -1; if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) { PyObject *tmpkey; PyErr_Clear(); tmpkey = __Pyx_PyFrozenSet_New(key); if (tmpkey != NULL) { result = PySet_Contains(set, tmpkey); Py_DECREF(tmpkey); } } return result; } static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) { int result = PySet_Contains(set, key); if (unlikely(result < 0)) { result = __Pyx_PySet_ContainsUnhashable(set, key); } return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); } /* GetTopmostException (used by SaveResetException) */ #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) { _PyErr_StackItem *exc_info = tstate->exc_info; while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && exc_info->previous_item != NULL) { exc_info = exc_info->previous_item; } return exc_info; } #endif /* SaveResetException */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); PyObject *exc_value = exc_info->exc_value; if (exc_value == NULL || exc_value == Py_None) { *value = NULL; *type = NULL; *tb = NULL; } else { *value = exc_value; Py_INCREF(*value); *type = (PyObject*) Py_TYPE(exc_value); Py_INCREF(*type); *tb = PyException_GetTraceback(exc_value); } #elif CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); *type = exc_info->exc_type; *value = exc_info->exc_value; *tb = exc_info->exc_traceback; Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); #else *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); #endif } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 _PyErr_StackItem *exc_info = tstate->exc_info; PyObject *tmp_value = exc_info->exc_value; exc_info->exc_value = value; Py_XDECREF(tmp_value); Py_XDECREF(type); Py_XDECREF(tb); #else PyObject *tmp_type, *tmp_value, *tmp_tb; #if CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = type; exc_info->exc_value = value; exc_info->exc_traceback = tb; #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = type; tstate->exc_value = value; tstate->exc_traceback = tb; #endif Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #endif } #endif /* GetException */ #if CYTHON_FAST_THREAD_STATE static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) #else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #endif { PyObject *local_type = NULL, *local_value, *local_tb = NULL; #if CYTHON_FAST_THREAD_STATE PyObject *tmp_type, *tmp_value, *tmp_tb; #if PY_VERSION_HEX >= 0x030C0000 local_value = tstate->current_exception; tstate->current_exception = 0; #else local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; #endif #elif __PYX_LIMITED_VERSION_HEX > 0x030C0000 local_value = PyErr_GetRaisedException(); #else PyErr_Fetch(&local_type, &local_value, &local_tb); #endif #if __PYX_LIMITED_VERSION_HEX > 0x030C0000 if (likely(local_value)) { local_type = (PyObject*) Py_TYPE(local_value); Py_INCREF(local_type); local_tb = PyException_GetTraceback(local_value); } #else PyErr_NormalizeException(&local_type, &local_value, &local_tb); #if CYTHON_FAST_THREAD_STATE if (unlikely(tstate->curexc_type)) #else if (unlikely(PyErr_Occurred())) #endif goto bad; if (local_tb) { if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) goto bad; } #endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000 Py_XINCREF(local_tb); Py_XINCREF(local_type); Py_XINCREF(local_value); *type = local_type; *value = local_value; *tb = local_tb; #if CYTHON_FAST_THREAD_STATE #if CYTHON_USE_EXC_INFO_STACK { _PyErr_StackItem *exc_info = tstate->exc_info; #if PY_VERSION_HEX >= 0x030B00a4 tmp_value = exc_info->exc_value; exc_info->exc_value = local_value; tmp_type = NULL; tmp_tb = NULL; Py_XDECREF(local_type); Py_XDECREF(local_tb); #else tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = local_type; exc_info->exc_value = local_value; exc_info->exc_traceback = local_tb; #endif } #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = local_type; tstate->exc_value = local_value; tstate->exc_traceback = local_tb; #endif Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000 PyErr_SetHandledException(local_value); Py_XDECREF(local_value); Py_XDECREF(local_type); Py_XDECREF(local_tb); #else PyErr_SetExcInfo(local_type, local_value, local_tb); #endif return 0; #if __PYX_LIMITED_VERSION_HEX <= 0x030C0000 bad: *type = 0; *value = 0; *tb = 0; Py_XDECREF(local_type); Py_XDECREF(local_value); Py_XDECREF(local_tb); return -1; #endif } /* RaiseException */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *instance_class = NULL; if (value && PyExceptionInstance_Check(value)) { instance_class = (PyObject*) Py_TYPE(value); if (instance_class != type) { int is_subclass = PyObject_IsSubclass(instance_class, type); if (!is_subclass) { instance_class = NULL; } else if (unlikely(is_subclass == -1)) { goto bad; } else { type = instance_class; } } } if (!instance_class) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyObject_Call(type, args, NULL); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } if (cause) { PyObject *fixed_cause; if (cause == Py_None) { fixed_cause = NULL; } else if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { #if PY_VERSION_HEX >= 0x030C00A6 PyException_SetTraceback(value, tb); #elif CYTHON_FAST_THREAD_STATE PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } #else PyObject *tmp_type, *tmp_value, *tmp_tb; PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); Py_INCREF(tb); PyErr_Restore(tmp_type, tmp_value, tb); Py_XDECREF(tmp_tb); #endif } bad: Py_XDECREF(owned_instance); return; } /* PyLongBinop */ #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_Fallback___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, int inplace) { return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); } #if CYTHON_USE_PYLONG_INTERNALS static PyObject* __Pyx_Unpacked___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { CYTHON_MAYBE_UNUSED_VAR(inplace); CYTHON_UNUSED_VAR(zerodivision_check); const long b = intval; long a; const PY_LONG_LONG llb = intval; PY_LONG_LONG lla; if (unlikely(__Pyx_PyLong_IsZero(op1))) { return __Pyx_NewRef(op2); } const int is_positive = __Pyx_PyLong_IsPos(op1); const digit* digits = __Pyx_PyLong_Digits(op1); const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); if (likely(size == 1)) { a = (long) digits[0]; if (!is_positive) a *= -1; } else { switch (size) { case 2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); if (!is_positive) a *= -1; goto calculate_long; } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); if (!is_positive) lla *= -1; goto calculate_long_long; } break; case 3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); if (!is_positive) a *= -1; goto calculate_long; } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); if (!is_positive) lla *= -1; goto calculate_long_long; } break; case 4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); if (!is_positive) a *= -1; goto calculate_long; } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); if (!is_positive) lla *= -1; goto calculate_long_long; } break; } return PyLong_Type.tp_as_number->nb_add(op1, op2); } calculate_long: { long x; x = a + b; return PyLong_FromLong(x); } calculate_long_long: { PY_LONG_LONG llx; llx = lla + llb; return PyLong_FromLongLong(llx); } } #endif static PyObject* __Pyx_Float___Pyx_PyLong_AddObjC(PyObject *float_val, long intval, int zerodivision_check) { CYTHON_UNUSED_VAR(zerodivision_check); const long b = intval; double a = __Pyx_PyFloat_AS_DOUBLE(float_val); double result; result = ((double)a) + (double)b; return PyFloat_FromDouble(result); } static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { CYTHON_MAYBE_UNUSED_VAR(intval); CYTHON_UNUSED_VAR(zerodivision_check); #if CYTHON_USE_PYLONG_INTERNALS if (likely(PyLong_CheckExact(op1))) { return __Pyx_Unpacked___Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check); } #endif if (PyFloat_CheckExact(op1)) { return __Pyx_Float___Pyx_PyLong_AddObjC(op1, intval, zerodivision_check); } return __Pyx_Fallback___Pyx_PyLong_AddObjC(op1, op2, inplace); } #endif /* DictGetItem */ #if !CYTHON_COMPILING_IN_PYPY static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { PyObject *value; if (unlikely(__Pyx_PyDict_GetItemRef(d, key, &value) == 0)) { // no value, no error if (unlikely(PyTuple_Check(key))) { PyObject* args = PyTuple_Pack(1, key); if (likely(args)) { PyErr_SetObject(PyExc_KeyError, args); Py_DECREF(args); } } else { PyErr_SetObject(PyExc_KeyError, key); } } return value; } #endif /* PyDictVersioning (used by GetModuleGlobalName) */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { PyObject *dict = Py_TYPE(obj)->tp_dict; return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; } static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { PyObject **dictptr = NULL; Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; if (offset) { #if CYTHON_COMPILING_IN_CPYTHON dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); #else dictptr = _PyObject_GetDictPtr(obj); #endif } return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; } static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { PyObject *dict = Py_TYPE(obj)->tp_dict; if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) return 0; return obj_dict_version == __Pyx_get_object_dict_version(obj); } #endif /* GetModuleGlobalName */ #if CYTHON_USE_DICT_VERSIONS static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) #else static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) #endif { PyObject *result; #if CYTHON_COMPILING_IN_LIMITED_API if (unlikely(!__pyx_m)) { if (!PyErr_Occurred()) PyErr_SetNone(PyExc_NameError); return NULL; } result = PyObject_GetAttr(__pyx_m, name); if (likely(result)) { return result; } PyErr_Clear(); #elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear(); __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { return result; } #else result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash); __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { return __Pyx_NewRef(result); } PyErr_Clear(); #endif return __Pyx_GetBuiltinName(name); } /* JoinPyUnicode */ static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength, Py_UCS4 max_char) { #if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS PyObject *result_uval; int result_ukind, kind_shift; Py_ssize_t i, char_pos; void *result_udata; if (max_char > 1114111) max_char = 1114111; result_uval = PyUnicode_New(result_ulength, max_char); if (unlikely(!result_uval)) return NULL; result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1; result_udata = PyUnicode_DATA(result_uval); assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0); if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - result_ulength < 0)) goto overflow; char_pos = 0; for (i=0; i < value_count; i++) { int ukind; Py_ssize_t ulength; void *udata; PyObject *uval = values[i]; #if !CYTHON_COMPILING_IN_LIMITED_API if (__Pyx_PyUnicode_READY(uval) == (-1)) goto bad; #endif ulength = __Pyx_PyUnicode_GET_LENGTH(uval); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(ulength < 0)) goto bad; #endif if (unlikely(!ulength)) continue; if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos)) goto overflow; ukind = __Pyx_PyUnicode_KIND(uval); udata = __Pyx_PyUnicode_DATA(uval); if (ukind == result_ukind) { memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift)); } else { #if PY_VERSION_HEX >= 0x030d0000 if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad; #elif CYTHON_COMPILING_IN_CPYTHON || defined(_PyUnicode_FastCopyCharacters) _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); #else Py_ssize_t j; for (j=0; j < ulength; j++) { Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); } #endif } char_pos += ulength; } return result_uval; overflow: PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); bad: Py_DECREF(result_uval); return NULL; #else Py_ssize_t i; PyObject *result = NULL; PyObject *value_tuple = PyTuple_New(value_count); if (unlikely(!value_tuple)) return NULL; CYTHON_UNUSED_VAR(max_char); CYTHON_UNUSED_VAR(result_ulength); for (i=0; i__pyx_empty_unicode, value_tuple); bad: Py_DECREF(value_tuple); return result; #endif } /* RejectKeywords */ static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) { PyObject *key = NULL; if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) { key = __Pyx_PySequence_ITEM(kwds, 0); } else { #if CYTHON_AVOID_BORROWED_REFS PyObject *pos = NULL; #else Py_ssize_t pos = 0; #endif #if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return; #endif __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL); #if CYTHON_AVOID_BORROWED_REFS Py_XDECREF(pos); #endif } if (likely(key)) { PyErr_Format(PyExc_TypeError, "%s() got an unexpected keyword argument '%U'", function_name, key); Py_DECREF(key); } } /* PyObjectVectorCallKwBuilder (used by PyObjectVectorCallMethodKwBuilder) */ #if CYTHON_VECTORCALL static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { (void)__Pyx_PyObject_FastCallDict; Py_INCREF(key); if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; args[n] = value; return 0; } CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { (void)__Pyx_VectorcallBuilder_AddArgStr; if (unlikely(!PyUnicode_Check(key))) { PyErr_SetString(PyExc_TypeError, "keywords must be strings"); return -1; } return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n); } static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) { PyObject *pyKey = PyUnicode_FromString(key); if (!pyKey) return -1; return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n); } #else // CYTHON_VECTORCALL CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) { if (unlikely(!PyUnicode_Check(key))) { PyErr_SetString(PyExc_TypeError, "keywords must be strings"); return -1; } return PyDict_SetItem(builder, key, value); } #endif /* PyObjectVectorCallMethodKwBuilder */ #if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 static PyObject *__Pyx_Object_VectorcallMethod_CallFromBuilder(PyObject *name, PyObject *const *args, size_t nargsf, PyObject *kwnames) { PyObject *result; PyObject *obj = PyObject_GetAttr(args[0], name); if (unlikely(!obj)) return NULL; result = __Pyx_Object_Vectorcall_CallFromBuilder(obj, args+1, nargsf-1, kwnames); Py_DECREF(obj); return result; } #endif /* decode_c_bytes (used by decode_bytes) */ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { if (unlikely((start < 0) | (stop < 0))) { if (start < 0) { start += length; if (start < 0) start = 0; } if (stop < 0) stop += length; } if (stop > length) stop = length; if (unlikely(stop <= start)) return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_unicode); length = stop - start; cstring += start; if (decode_func) { return decode_func(cstring, length, errors); } else { return PyUnicode_Decode(cstring, length, encoding, errors); } } /* AllocateExtensionType */ static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) { if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc); return alloc_func(t, 0); } else { newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc); #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 if (!tp_new) { PyObject *new_str = PyUnicode_FromString("__new__"); if (likely(new_str)) { PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL); Py_DECREF(new_str); return o; } else return NULL; } else #endif return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0); } } /* CallTypeTraverse */ #if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) #else static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) { #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000 if (__Pyx_get_runtime_version() < 0x03090000) return 0; #endif if (!always_call) { PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*); unsigned long flags = PyType_GetFlags(base); if (flags & Py_TPFLAGS_HEAPTYPE) { return 0; } } Py_VISIT((PyObject*)Py_TYPE(o)); return 0; } #endif /* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */ #if CYTHON_COMPILING_IN_LIMITED_API static Py_ssize_t __Pyx_GetTypeDictOffset(void) { PyObject *tp_dictoffset_o; Py_ssize_t tp_dictoffset; tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__"); if (unlikely(!tp_dictoffset_o)) return -1; tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o); Py_DECREF(tp_dictoffset_o); if (unlikely(tp_dictoffset == 0)) { PyErr_SetString( PyExc_TypeError, "'type' doesn't have a dictoffset"); return -1; } else if (unlikely(tp_dictoffset < 0)) { PyErr_SetString( PyExc_TypeError, "'type' has an unexpected negative dictoffset. " "Please report this as Cython bug"); return -1; } return tp_dictoffset; } static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) { static Py_ssize_t tp_dictoffset = 0; if (unlikely(tp_dictoffset == 0)) { tp_dictoffset = __Pyx_GetTypeDictOffset(); if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) { tp_dictoffset = 0; // try again next time? return NULL; } } return *(PyObject**)((char*)tp + tp_dictoffset); } #endif /* SetItemOnTypeDict (used by FixUpExtensionType) */ static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) { int result; PyObject *tp_dict; #if CYTHON_COMPILING_IN_LIMITED_API tp_dict = __Pyx_GetTypeDict(tp); if (unlikely(!tp_dict)) return -1; #else tp_dict = tp->tp_dict; #endif result = PyDict_SetItem(tp_dict, k, v); if (likely(!result)) { PyType_Modified(tp); if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) { PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name, (PyObject *) tp, k, NULL); if (!setNameResult) return -1; Py_DECREF(setNameResult); } } return result; } /* FixUpExtensionType */ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { #if __PYX_LIMITED_VERSION_HEX > 0x030900B1 CYTHON_UNUSED_VAR(spec); CYTHON_UNUSED_VAR(type); CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); #else const PyType_Slot *slot = spec->slots; int changed = 0; #if !CYTHON_COMPILING_IN_LIMITED_API while (slot && slot->slot && slot->slot != Py_tp_members) slot++; if (slot && slot->slot == Py_tp_members) { #if !CYTHON_COMPILING_IN_CPYTHON const #endif // !CYTHON_COMPILING_IN_CPYTHON) PyMemberDef *memb = (PyMemberDef*) slot->pfunc; while (memb && memb->name) { if (memb->name[0] == '_' && memb->name[1] == '_') { if (strcmp(memb->name, "__weaklistoffset__") == 0) { assert(memb->type == T_PYSSIZET); assert(memb->flags == READONLY); type->tp_weaklistoffset = memb->offset; changed = 1; } else if (strcmp(memb->name, "__dictoffset__") == 0) { assert(memb->type == T_PYSSIZET); assert(memb->flags == READONLY); type->tp_dictoffset = memb->offset; changed = 1; } #if CYTHON_METH_FASTCALL else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { assert(memb->type == T_PYSSIZET); assert(memb->flags == READONLY); type->tp_vectorcall_offset = memb->offset; changed = 1; } #endif // CYTHON_METH_FASTCALL #if !CYTHON_COMPILING_IN_PYPY else if (strcmp(memb->name, "__module__") == 0) { PyObject *descr; assert(memb->type == T_OBJECT); assert(memb->flags == 0 || memb->flags == READONLY); descr = PyDescr_NewMember(type, memb); if (unlikely(!descr)) return -1; int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); Py_DECREF(descr); if (unlikely(set_item_result < 0)) { return -1; } changed = 1; } #endif // !CYTHON_COMPILING_IN_PYPY } memb++; } } #endif // !CYTHON_COMPILING_IN_LIMITED_API #if !CYTHON_COMPILING_IN_PYPY slot = spec->slots; while (slot && slot->slot && slot->slot != Py_tp_getset) slot++; if (slot && slot->slot == Py_tp_getset) { PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc; while (getset && getset->name) { if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) { PyObject *descr = PyDescr_NewGetSet(type, getset); if (unlikely(!descr)) return -1; #if CYTHON_COMPILING_IN_LIMITED_API PyObject *pyname = PyUnicode_FromString(getset->name); if (unlikely(!pyname)) { Py_DECREF(descr); return -1; } int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr); Py_DECREF(pyname); #else CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); #endif Py_DECREF(descr); if (unlikely(set_item_result < 0)) { return -1; } changed = 1; } ++getset; } } #else CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); #endif // !CYTHON_COMPILING_IN_PYPY if (changed) PyType_Modified(type); #endif // PY_VERSION_HEX > 0x030900B1 return 0; } /* ValidateBasesTuple (used by PyType_Ready) */ #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { Py_ssize_t i, n; #if CYTHON_ASSUME_SAFE_SIZE n = PyTuple_GET_SIZE(bases); #else n = PyTuple_Size(bases); if (unlikely(n < 0)) return -1; #endif for (i = 1; i < n; i++) { PyTypeObject *b; #if CYTHON_AVOID_BORROWED_REFS PyObject *b0 = PySequence_GetItem(bases, i); if (!b0) return -1; #elif CYTHON_ASSUME_SAFE_MACROS PyObject *b0 = PyTuple_GET_ITEM(bases, i); #else PyObject *b0 = PyTuple_GetItem(bases, i); if (!b0) return -1; #endif b = (PyTypeObject*) b0; if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) { __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b); PyErr_Format(PyExc_TypeError, "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); __Pyx_DECREF_TypeName(b_name); #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(b0); #endif return -1; } if (dictoffset == 0) { Py_ssize_t b_dictoffset = 0; #if CYTHON_USE_TYPE_SLOTS b_dictoffset = b->tp_dictoffset; #else PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__"); if (!py_b_dictoffset) goto dictoffset_return; b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset); Py_DECREF(py_b_dictoffset); if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return; #endif if (b_dictoffset) { { __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b); PyErr_Format(PyExc_TypeError, "extension type '%.200s' has no __dict__ slot, " "but base type '" __Pyx_FMT_TYPENAME "' has: " "either add 'cdef dict __dict__' to the extension type " "or add '__slots__ = [...]' to the base type", type_name, b_name); __Pyx_DECREF_TypeName(b_name); } #if !CYTHON_USE_TYPE_SLOTS dictoffset_return: #endif #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(b0); #endif return -1; } } #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(b0); #endif } return 0; } #endif /* PyType_Ready */ CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) { while (t) { PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); if (bases) { return 1; } t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*); } return 0; } static int __Pyx_PyType_Ready(PyTypeObject *t) { #if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION) (void)__Pyx_PyObject_CallMethod0; #if CYTHON_USE_TYPE_SPECS (void)__Pyx_validate_bases_tuple; #endif return PyType_Ready(t); #else int r; if (!__Pyx_PyType_HasMultipleInheritance(t)) { return PyType_Ready(t); } PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) return -1; #if !defined(PYSTON_MAJOR_VERSION) { int gc_was_enabled; #if PY_VERSION_HEX >= 0x030A00b1 gc_was_enabled = PyGC_Disable(); (void)__Pyx_PyObject_CallMethod0; #else PyObject *ret, *py_status; PyObject *gc = NULL; #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\ !CYTHON_COMPILING_IN_GRAAL gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc); #endif if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc); if (unlikely(!gc)) return -1; py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled); if (unlikely(!py_status)) { Py_DECREF(gc); return -1; } gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); Py_DECREF(py_status); if (gc_was_enabled > 0) { ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable); if (unlikely(!ret)) { Py_DECREF(gc); return -1; } Py_DECREF(ret); } else if (unlikely(gc_was_enabled == -1)) { Py_DECREF(gc); return -1; } #endif t->tp_flags |= Py_TPFLAGS_HEAPTYPE; #if PY_VERSION_HEX >= 0x030A0000 t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; #endif #else (void)__Pyx_PyObject_CallMethod0; #endif r = PyType_Ready(t); #if !defined(PYSTON_MAJOR_VERSION) t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; #if PY_VERSION_HEX >= 0x030A00b1 if (gc_was_enabled) PyGC_Enable(); #else if (gc_was_enabled) { PyObject *tp, *v, *tb; PyErr_Fetch(&tp, &v, &tb); ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable); if (likely(ret || r == -1)) { Py_XDECREF(ret); PyErr_Restore(tp, v, tb); } else { Py_XDECREF(tp); Py_XDECREF(v); Py_XDECREF(tb); r = -1; } } Py_DECREF(gc); #endif } #endif return r; #endif } /* DelItemOnTypeDict (used by SetupReduce) */ static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k) { int result; PyObject *tp_dict; #if CYTHON_COMPILING_IN_LIMITED_API tp_dict = __Pyx_GetTypeDict(tp); if (unlikely(!tp_dict)) return -1; #else tp_dict = tp->tp_dict; #endif result = PyDict_DelItem(tp_dict, k); if (likely(!result)) PyType_Modified(tp); return result; } /* SetupReduce */ static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; PyObject *name_attr; name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_mstate_global->__pyx_n_u_name); if (likely(name_attr)) { ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); } else { ret = -1; } if (unlikely(ret < 0)) { PyErr_Clear(); ret = 0; } Py_XDECREF(name_attr); return ret; } static int __Pyx_setup_reduce(PyObject* type_obj) { int ret = 0; PyObject *object_reduce = NULL; PyObject *object_getstate = NULL; PyObject *object_reduce_ex = NULL; PyObject *reduce = NULL; PyObject *reduce_ex = NULL; PyObject *reduce_cython = NULL; PyObject *setstate = NULL; PyObject *setstate_cython = NULL; PyObject *getstate = NULL; #if CYTHON_USE_PYTYPE_LOOKUP getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_getstate); #else getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_getstate); if (!getstate && PyErr_Occurred()) { goto __PYX_BAD; } #endif if (getstate) { #if CYTHON_USE_PYTYPE_LOOKUP object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate); #else object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate); if (!object_getstate && PyErr_Occurred()) { goto __PYX_BAD; } #endif if (object_getstate != getstate) { goto __PYX_GOOD; } } #if CYTHON_USE_PYTYPE_LOOKUP object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; #else object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; #endif reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; if (reduce_ex == object_reduce_ex) { #if CYTHON_USE_PYTYPE_LOOKUP object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD; #else object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD; #endif reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce); if (unlikely(!reduce)) goto __PYX_BAD; if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_mstate_global->__pyx_n_u_reduce_cython)) { reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); if (likely(reduce_cython)) { ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; } else if (reduce == object_reduce || PyErr_Occurred()) { goto __PYX_BAD; } setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate); if (!setstate) PyErr_Clear(); if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_mstate_global->__pyx_n_u_setstate_cython)) { setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); if (likely(setstate_cython)) { ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; } else if (!setstate || PyErr_Occurred()) { goto __PYX_BAD; } } PyType_Modified((PyTypeObject*)type_obj); } } goto __PYX_GOOD; __PYX_BAD: if (!PyErr_Occurred()) { __Pyx_TypeName type_obj_name = __Pyx_PyType_GetFullyQualifiedName((PyTypeObject*)type_obj); PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); __Pyx_DECREF_TypeName(type_obj_name); } ret = -1; __PYX_GOOD: #if !CYTHON_USE_PYTYPE_LOOKUP Py_XDECREF(object_reduce); Py_XDECREF(object_reduce_ex); Py_XDECREF(object_getstate); Py_XDECREF(getstate); #endif Py_XDECREF(reduce); Py_XDECREF(reduce_ex); Py_XDECREF(reduce_cython); Py_XDECREF(setstate); Py_XDECREF(setstate_cython); return ret; } /* ImportImpl (used by Import) */ static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) { PyObject *imported_module = PyImport_GetModule(qualname); if (unlikely(!imported_module)) { *module = NULL; if (PyErr_Occurred()) { return -1; } return 0; } *module = imported_module; return 1; } static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) { PyObject *imported_module; PyObject *top_level_package_name; Py_ssize_t i; int status, module_found; Py_ssize_t dot_index; module_found = __Pyx__Import_GetModule(qualname, &imported_module); if (unlikely(!module_found || module_found == -1)) { *module = NULL; return module_found; } if (imported_names) { for (i = 0; i < len_imported_names; i++) { PyObject *imported_name = imported_names[i]; #if __PYX_LIMITED_VERSION_HEX < 0x030d0000 int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name); #else int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name); if (unlikely(has_imported_attribute == -1)) goto error; #endif if (!has_imported_attribute) { goto not_found; } } *module = imported_module; return 1; } dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1); if (dot_index == -1) { *module = imported_module; return 1; } if (unlikely(dot_index == -2)) goto error; top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index); if (unlikely(!top_level_package_name)) goto error; Py_DECREF(imported_module); status = __Pyx__Import_GetModule(top_level_package_name, module); Py_DECREF(top_level_package_name); return status; error: Py_DECREF(imported_module); *module = NULL; return -1; not_found: Py_DECREF(imported_module); *module = NULL; return 0; } static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) { PyObject *module = 0; PyObject *empty_dict = 0; PyObject *from_list = 0; int module_found; if (!qualname) { qualname = name; } module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module); if (likely(module_found == 1)) { return module; } else if (unlikely(module_found == -1)) { return NULL; } empty_dict = PyDict_New(); if (unlikely(!empty_dict)) goto bad; if (imported_names) { #if CYTHON_COMPILING_IN_CPYTHON from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names); if (unlikely(!from_list)) goto bad; #else from_list = PyList_New(len_imported_names); if (unlikely(!from_list)) goto bad; for (Py_ssize_t i=0; i__pyx_d, level); } /* dict_setdefault (used by FetchCommonType) */ static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) { PyObject* value; #if __PYX_LIMITED_VERSION_HEX >= 0x030F0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4) PyDict_SetDefaultRef(d, key, default_value, &value); #elif CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000 PyObject *args[] = {d, key, default_value}; value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); #elif CYTHON_COMPILING_IN_LIMITED_API value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL); #else value = PyDict_SetDefault(d, key, default_value); if (unlikely(!value)) return NULL; Py_INCREF(value); #endif return value; } /* AddModuleRef (used by FetchSharedCythonModule) */ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) { PyObject *module_dict = PyImport_GetModuleDict(); PyObject *m; if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) { return NULL; } if (m != NULL && PyModule_Check(m)) { return m; } Py_XDECREF(m); m = PyModule_NewObject(name); if (m == NULL) return NULL; if (PyDict_CheckExact(module_dict)) { PyObject *new_m; (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m); Py_DECREF(m); return new_m; } else { if (PyObject_SetItem(module_dict, name, m) != 0) { Py_DECREF(m); return NULL; } return m; } } static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { PyObject *py_name = PyUnicode_FromString(name); if (!py_name) return NULL; PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name); Py_DECREF(py_name); return module; } #elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) #else static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { PyObject *module = PyImport_AddModule(name); Py_XINCREF(module); return module; } #endif /* FetchSharedCythonModule (used by FetchCommonType) */ static PyObject *__Pyx_FetchSharedCythonABIModule(void) { return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME); } /* FetchCommonType (used by CommonTypesMetaclass) */ #if __PYX_LIMITED_VERSION_HEX < 0x030C0000 static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases); if (result && metaclass) { PyObject *old_tp = (PyObject*)Py_TYPE(result); Py_INCREF((PyObject*)metaclass); #if __PYX_LIMITED_VERSION_HEX >= 0x03090000 Py_SET_TYPE(result, metaclass); #else result->ob_type = metaclass; #endif Py_DECREF(old_tp); } return result; } #else #define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b) #endif static int __Pyx_VerifyCachedType(PyObject *cached_type, const char *name, Py_ssize_t expected_basicsize) { Py_ssize_t basicsize; if (!PyType_Check(cached_type)) { PyErr_Format(PyExc_TypeError, "Shared Cython type %.200s is not a type object", name); return -1; } if (expected_basicsize == 0) { return 0; // size is inherited, nothing useful to check } #if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_basicsize; py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); if (unlikely(!py_basicsize)) return -1; basicsize = PyLong_AsSsize_t(py_basicsize); Py_DECREF(py_basicsize); py_basicsize = NULL; if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1; #else basicsize = ((PyTypeObject*) cached_type)->tp_basicsize; #endif if (basicsize != expected_basicsize) { PyErr_Format(PyExc_TypeError, "Shared Cython type %.200s has the wrong size, try recompiling", name); return -1; } return 0; } static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name; int get_item_ref_result; const char* object_name = strrchr(spec->name, '.'); object_name = object_name ? object_name+1 : spec->name; py_object_name = PyUnicode_FromString(object_name); if (!py_object_name) return NULL; abi_module = __Pyx_FetchSharedCythonABIModule(); if (!abi_module) goto done; abi_module_dict = PyModule_GetDict(abi_module); if (!abi_module_dict) goto done; get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type); if (get_item_ref_result == 1) { if (__Pyx_VerifyCachedType( cached_type, object_name, spec->basicsize) < 0) { goto bad; } goto done; } else if (unlikely(get_item_ref_result == -1)) { goto bad; } cached_type = __Pyx_PyType_FromMetaclass( metaclass, CYTHON_USE_MODULE_STATE ? module : abi_module, spec, bases); if (unlikely(!cached_type)) goto bad; if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type); if (unlikely(new_cached_type != cached_type)) { if (unlikely(!new_cached_type)) goto bad; Py_DECREF(cached_type); cached_type = new_cached_type; if (__Pyx_VerifyCachedType( cached_type, object_name, spec->basicsize) < 0) { goto bad; } goto done; } else { Py_DECREF(new_cached_type); } done: Py_XDECREF(abi_module); Py_DECREF(py_object_name); assert(cached_type == NULL || PyType_Check(cached_type)); return (PyTypeObject *) cached_type; bad: Py_XDECREF(cached_type); cached_type = NULL; goto done; } /* CommonTypesMetaclass (used by CythonFunctionShared) */ static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) { return PyUnicode_FromString(__PYX_ABI_MODULE_NAME); } #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) { PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types"); return NULL; } static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) { PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable"); return -1; } #endif static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = { {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL}, {0, 0, 0, 0, 0} }; static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = { {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset}, #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call}, {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call}, {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr}, #endif {0, 0} }; static PyType_Spec __pyx_CommonTypesMetaclass_spec = { __PYX_TYPE_MODULE_PREFIX "_common_types_metatype", 0, 0, Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | Py_TPFLAGS_DEFAULT, __pyx_CommonTypesMetaclass_slots }; static int __pyx_CommonTypesMetaclass_init(PyObject *module) { __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); PyObject *bases = PyTuple_Pack(1, &PyType_Type); if (unlikely(!bases)) { return -1; } mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases); Py_DECREF(bases); if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) { return -1; } return 0; } /* PyMethodNew (used by CythonFunctionShared) */ #if CYTHON_COMPILING_IN_LIMITED_API static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { PyObject *result; CYTHON_UNUSED_VAR(typ); if (!self) return __Pyx_NewRef(func); #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 { PyObject *args[] = {func, self}; result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL); } #else result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL); #endif return result; } #else static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { CYTHON_UNUSED_VAR(typ); if (!self) return __Pyx_NewRef(func); return PyMethod_New(func, self); } #endif /* PyVectorcallFastCallDict (used by CythonFunctionShared) */ #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) { PyObject *res = NULL; PyObject *kwnames; PyObject **newargs; PyObject **kwvalues; Py_ssize_t i; #if CYTHON_AVOID_BORROWED_REFS PyObject *pos; #else Py_ssize_t pos; #endif size_t j; PyObject *key, *value; unsigned long keys_are_strings; #if !CYTHON_ASSUME_SAFE_SIZE Py_ssize_t nkw = PyDict_Size(kw); if (unlikely(nkw == -1)) return NULL; #else Py_ssize_t nkw = PyDict_GET_SIZE(kw); #endif newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); if (unlikely(newargs == NULL)) { PyErr_NoMemory(); return NULL; } for (j = 0; j < nargs; j++) newargs[j] = args[j]; kwnames = PyTuple_New(nkw); if (unlikely(kwnames == NULL)) { PyMem_Free(newargs); return NULL; } kwvalues = newargs + nargs; pos = 0; i = 0; keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) { keys_are_strings &= #if CYTHON_COMPILING_IN_LIMITED_API PyType_GetFlags(Py_TYPE(key)); #else Py_TYPE(key)->tp_flags; #endif #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup; #else PyTuple_SET_ITEM(kwnames, i, key); #endif kwvalues[i] = value; i++; } if (unlikely(!keys_are_strings)) { PyErr_SetString(PyExc_TypeError, "keywords must be strings"); goto cleanup; } res = vc(func, newargs, nargs, kwnames); cleanup: #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(pos); #endif Py_DECREF(kwnames); for (i = 0; i < nkw; i++) Py_DECREF(kwvalues[i]); PyMem_Free(newargs); return res; } static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) { Py_ssize_t kw_size = likely(kw == NULL) ? 0 : #if !CYTHON_ASSUME_SAFE_SIZE PyDict_Size(kw); #else PyDict_GET_SIZE(kw); #endif if (kw_size == 0) { return vc(func, args, nargs, NULL); } #if !CYTHON_ASSUME_SAFE_SIZE else if (unlikely(kw_size == -1)) { return NULL; } #endif return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); } #endif /* CythonFunctionShared (used by CythonFunction) */ #if CYTHON_COMPILING_IN_LIMITED_API static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) { if (__Pyx_CyFunction_Check(func)) { return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc; } else if (PyCFunction_Check(func)) { return PyCFunction_GetFunction(func) == (PyCFunction) cfunc; } return 0; } static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) { int result; PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func); if (unlikely(!newFunc)) { PyErr_Clear(); // It's only an optimization, so don't throw an error return 0; } result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc); Py_DECREF(newFunc); return result; } return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc); } #else static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { if (PyMethod_Check(func)) { func = PyMethod_GET_FUNCTION(func); } return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; } #endif static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API __Pyx_Py_XDECREF_SET( __Pyx_CyFunction_GetClassObj(f), ((classobj) ? __Pyx_NewRef(classobj) : NULL)); #else __Pyx_Py_XDECREF_SET( ((PyCMethodObject *) (f))->mm_class, (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); #endif } static PyObject * __Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op) { if (unlikely(op->func_doc == NULL)) { #if CYTHON_COMPILING_IN_LIMITED_API op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); if (unlikely(!op->func_doc)) return NULL; #else if (((PyCFunctionObject*)op)->m_ml->ml_doc) { op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); if (unlikely(op->func_doc == NULL)) return NULL; } else { Py_INCREF(Py_None); return Py_None; } #endif } Py_INCREF(op->func_doc); return op->func_doc; } static PyObject * __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) { PyObject *result; CYTHON_UNUSED_VAR(closure); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_doc_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) { CYTHON_UNUSED_VAR(context); if (value == NULL) { value = Py_None; } Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->func_doc, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op) { if (unlikely(op->func_name == NULL)) { #if CYTHON_COMPILING_IN_LIMITED_API op->func_name = PyObject_GetAttrString(op->func, "__name__"); #else op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #endif if (unlikely(op->func_name == NULL)) return NULL; } Py_INCREF(op->func_name); return op->func_name; } static PyObject * __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) { PyObject *result = NULL; CYTHON_UNUSED_VAR(context); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_name_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) { CYTHON_UNUSED_VAR(context); if (unlikely(value == NULL || !PyUnicode_Check(value))) { PyErr_SetString(PyExc_TypeError, "__name__ must be set to a string object"); return -1; } Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->func_name, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(context); PyObject *result; __Pyx_BEGIN_CRITICAL_SECTION(op); Py_INCREF(op->func_qualname); result = op->func_qualname; __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) { CYTHON_UNUSED_VAR(context); if (unlikely(value == NULL || !PyUnicode_Check(value))) { PyErr_SetString(PyExc_TypeError, "__qualname__ must be set to a string object"); return -1; } Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->func_qualname, value); __Pyx_END_CRITICAL_SECTION(); return 0; } #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 static PyObject * __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(context); if (unlikely(op->func_dict == NULL)) { op->func_dict = PyDict_New(); if (unlikely(op->func_dict == NULL)) return NULL; } Py_INCREF(op->func_dict); return op->func_dict; } #endif static PyObject * __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(context); Py_INCREF(op->func_globals); return op->func_globals; } static PyObject * __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(op); CYTHON_UNUSED_VAR(context); Py_INCREF(Py_None); return Py_None; } static PyObject * __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) { PyObject* result = (op->func_code) ? op->func_code : Py_None; CYTHON_UNUSED_VAR(context); Py_INCREF(result); return result; } static int __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { int result = 0; PyObject *res = op->defaults_getter((PyObject *) op); if (unlikely(!res)) return -1; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS op->defaults_tuple = PyTuple_GET_ITEM(res, 0); Py_INCREF(op->defaults_tuple); op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); Py_INCREF(op->defaults_kwdict); #else op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); if (unlikely(!op->defaults_tuple)) result = -1; else { op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); if (unlikely(!op->defaults_kwdict)) result = -1; } #endif Py_DECREF(res); return result; } static int __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { PyErr_SetString(PyExc_TypeError, "__defaults__ must be set to a tuple object"); return -1; } PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " "currently affect the values used in function calls", 1); Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) { PyObject* result = op->defaults_tuple; if (unlikely(!result)) { if (op->defaults_getter) { if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_tuple; } else { result = Py_None; } } Py_INCREF(result); return result; } static PyObject * __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result = NULL; CYTHON_UNUSED_VAR(context); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_defaults_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; } else if (unlikely(value != Py_None && !PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__kwdefaults__ must be set to a dict object"); return -1; } PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " "currently affect the values used in function calls", 1); Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) { PyObject* result = op->defaults_kwdict; if (unlikely(!result)) { if (op->defaults_getter) { if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_kwdict; } else { result = Py_None; } } Py_INCREF(result); return result; } static PyObject * __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result; CYTHON_UNUSED_VAR(context); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_kwdefaults_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); if (!value || value == Py_None) { value = NULL; } else if (unlikely(!PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__annotations__ must be set to a dict object"); return -1; } Py_XINCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->func_annotations, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) { PyObject* result = op->func_annotations; if (unlikely(!result)) { result = PyDict_New(); if (unlikely(!result)) return NULL; op->func_annotations = result; } Py_INCREF(result); return result; } static PyObject * __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { PyObject *result; CYTHON_UNUSED_VAR(context); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_annotations_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static PyObject *__Pyx_CyFunction_annotate_impl(PyObject *self, PyObject *args) { CYTHON_UNUSED_VAR(args); if (unlikely(!self)) { PyErr_SetString(PyExc_SystemError, "cython __annotate__ called without 'self' argument"); } Py_XINCREF(self); return self; } static PyMethodDef __Pyx_CyFunction_annotate_method = { "__annotate__", (PyCFunction)(void (*)(void))__Pyx_CyFunction_annotate_impl, METH_VARARGS, "Placeholder __annotate__ function to allow 'functools.wraps' to work " "on Cython functions." }; static PyObject * __Pyx_CyFunction_get_annotate(PyObject *op_in, void *context) { CYTHON_UNUSED_VAR(context); PyObject *annotations = __Pyx_CyFunction_get_annotations((__pyx_CyFunctionObject *) op_in, NULL); if (unlikely(!annotations)) return NULL; PyObject *method = PyCFunction_New( &__Pyx_CyFunction_annotate_method, annotations); Py_DECREF(annotations); return method; } static int __Pyx_CyFunction_set_annotate(PyObject *op_in, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); if (value == NULL) { PyErr_SetString(PyExc_TypeError, "__annotate__ cannot be deleted"); return -1; } if (value == Py_None) { return 0; } PyObject *annotations = PyObject_CallObject(value, NULL); if (!annotations) return -1; int result = __Pyx_CyFunction_set_annotations((__pyx_CyFunctionObject *) op_in, annotations, NULL); Py_DECREF(annotations); return result; } static PyObject * __Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) { int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; if (is_coroutine) { PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine; fromlist = PyList_New(1); if (unlikely(!fromlist)) return NULL; Py_INCREF(marker); #if CYTHON_ASSUME_SAFE_MACROS PyList_SET_ITEM(fromlist, 0, marker); #else if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { Py_DECREF(fromlist); return NULL; } #endif module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0); Py_DECREF(fromlist); if (unlikely(!module)) goto ignore; is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker); Py_DECREF(module); if (likely(is_coroutine_value)) { return is_coroutine_value; } ignore: PyErr_Clear(); } return __Pyx_PyBool_FromLong(is_coroutine); } static PyObject * __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { PyObject *result; CYTHON_UNUSED_VAR(context); if (op->func_is_coroutine) { return __Pyx_NewRef(op->func_is_coroutine); } result = __Pyx_CyFunction_get_is_coroutine_value(op); if (unlikely(!result)) return NULL; __Pyx_BEGIN_CRITICAL_SECTION(op); if (op->func_is_coroutine) { Py_DECREF(result); result = __Pyx_NewRef(op->func_is_coroutine); } else { op->func_is_coroutine = __Pyx_NewRef(result); } __Pyx_END_CRITICAL_SECTION(); return result; } static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) { #if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); if (!py_name) return; PyErr_Format(PyExc_TypeError, "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", py_name, message, size); Py_DECREF(py_name); #else const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; PyErr_Format(PyExc_TypeError, "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", name, message, size); #endif } static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) { #if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); if (!py_name) return; PyErr_Format(PyExc_TypeError, "%.200S() %s", py_name, message); Py_DECREF(py_name); #else const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; PyErr_Format(PyExc_TypeError, "%.200s() %s", name, message); #endif } #if CYTHON_COMPILING_IN_LIMITED_API static PyObject * __Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(context); return PyObject_GetAttrString(op->func, "__module__"); } static int __Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); return PyObject_SetAttrString(op->func, "__module__", value); } #endif static PyGetSetDef __pyx_CyFunction_getsets[] = { {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, #else {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, #endif {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, {"__annotate__", (getter)__Pyx_CyFunction_get_annotate, (setter)__Pyx_CyFunction_set_annotate, 0, 0}, {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, #if CYTHON_COMPILING_IN_LIMITED_API {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, #endif {0, 0, 0, 0, 0} }; static PyMemberDef __pyx_CyFunction_members[] = { #if !CYTHON_COMPILING_IN_LIMITED_API {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, #endif #if CYTHON_METH_FASTCALL #if CYTHON_COMPILING_IN_LIMITED_API {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, #else {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, #endif #if CYTHON_COMPILING_IN_LIMITED_API {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, #else {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, #endif #endif {0, 0, 0, 0, 0} }; static PyObject * __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) { PyObject *result = NULL; CYTHON_UNUSED_VAR(args); __Pyx_BEGIN_CRITICAL_SECTION(m); Py_INCREF(m->func_qualname); result = m->func_qualname; __Pyx_END_CRITICAL_SECTION(); return result; } static PyMethodDef __pyx_CyFunction_methods[] = { {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, {0, 0, 0, 0} }; #if CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) #else #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) #endif static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { #if !CYTHON_COMPILING_IN_LIMITED_API PyCFunctionObject *cf = (PyCFunctionObject*) op; #endif if (unlikely(op == NULL)) return NULL; #if CYTHON_COMPILING_IN_LIMITED_API op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); if (unlikely(!op->func)) return NULL; #endif op->flags = flags; __Pyx_CyFunction_weakreflist(op) = NULL; #if !CYTHON_COMPILING_IN_LIMITED_API cf->m_ml = ml; cf->m_self = (PyObject *) op; #endif Py_XINCREF(closure); op->func_closure = closure; #if !CYTHON_COMPILING_IN_LIMITED_API Py_XINCREF(module); cf->m_module = module; #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API op->func_dict = NULL; #endif op->func_name = NULL; Py_INCREF(qualname); op->func_qualname = qualname; op->func_doc = NULL; #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API op->func_classobj = NULL; #else ((PyCMethodObject*)op)->mm_class = NULL; #endif op->func_globals = globals; Py_INCREF(op->func_globals); Py_XINCREF(code); op->func_code = code; op->defaults = NULL; op->defaults_tuple = NULL; op->defaults_kwdict = NULL; op->defaults_getter = NULL; op->func_annotations = NULL; op->func_is_coroutine = NULL; #if CYTHON_METH_FASTCALL switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { case METH_NOARGS: __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; break; case METH_O: __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; break; case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; break; case METH_FASTCALL | METH_KEYWORDS: __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; break; case METH_VARARGS | METH_KEYWORDS: __Pyx_CyFunction_func_vectorcall(op) = NULL; break; default: PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); Py_DECREF(op); return NULL; } #endif return (PyObject *) op; } static int __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) { Py_CLEAR(m->func_closure); #if CYTHON_COMPILING_IN_LIMITED_API Py_CLEAR(m->func); #else Py_CLEAR(((PyCFunctionObject*)m)->m_module); #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API Py_CLEAR(m->func_dict); #elif PY_VERSION_HEX < 0x030d0000 _PyObject_ClearManagedDict((PyObject*)m); #else PyObject_ClearManagedDict((PyObject*)m); #endif Py_CLEAR(m->func_name); Py_CLEAR(m->func_qualname); Py_CLEAR(m->func_doc); Py_CLEAR(m->func_globals); Py_CLEAR(m->func_code); #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); #else { PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; ((PyCMethodObject *) (m))->mm_class = NULL; Py_XDECREF(cls); } #endif Py_CLEAR(m->defaults_tuple); Py_CLEAR(m->defaults_kwdict); Py_CLEAR(m->func_annotations); Py_CLEAR(m->func_is_coroutine); Py_CLEAR(m->defaults); return 0; } static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) { if (__Pyx_CyFunction_weakreflist(m) != NULL) PyObject_ClearWeakRefs((PyObject *) m); __Pyx_CyFunction_clear(m); __Pyx_PyHeapTypeObject_GC_Del(m); } static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) { PyObject_GC_UnTrack(m); __Pyx__CyFunction_dealloc(m); } static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) { { int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg); if (e) return e; } Py_VISIT(m->func_closure); #if CYTHON_COMPILING_IN_LIMITED_API Py_VISIT(m->func); #else Py_VISIT(((PyCFunctionObject*)m)->m_module); #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API Py_VISIT(m->func_dict); #else { int e = #if PY_VERSION_HEX < 0x030d0000 _PyObject_VisitManagedDict #else PyObject_VisitManagedDict #endif ((PyObject*)m, visit, arg); if (e != 0) return e; } #endif __Pyx_VISIT_CONST(m->func_name); __Pyx_VISIT_CONST(m->func_qualname); Py_VISIT(m->func_doc); Py_VISIT(m->func_globals); __Pyx_VISIT_CONST(m->func_code); Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); Py_VISIT(m->defaults_tuple); Py_VISIT(m->defaults_kwdict); Py_VISIT(m->func_annotations); Py_VISIT(m->func_is_coroutine); Py_VISIT(m->defaults); return 0; } static PyObject* __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) { PyObject *repr; __Pyx_BEGIN_CRITICAL_SECTION(op); repr = PyUnicode_FromFormat("", op->func_qualname, (void *)op); __Pyx_END_CRITICAL_SECTION(); return repr; } static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { #if CYTHON_COMPILING_IN_LIMITED_API PyObject *f = ((__pyx_CyFunctionObject*)func)->func; PyCFunction meth; int flags; meth = PyCFunction_GetFunction(f); if (unlikely(!meth)) return NULL; flags = PyCFunction_GetFlags(f); if (unlikely(flags < 0)) return NULL; #else PyCFunctionObject* f = (PyCFunctionObject*)func; PyCFunction meth = f->m_ml->ml_meth; int flags = f->m_ml->ml_flags; #endif Py_ssize_t size; switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { case METH_VARARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) return (*meth)(self, arg); break; case METH_VARARGS | METH_KEYWORDS: return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw); case METH_NOARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { #if CYTHON_ASSUME_SAFE_SIZE size = PyTuple_GET_SIZE(arg); #else size = PyTuple_Size(arg); if (unlikely(size < 0)) return NULL; #endif if (likely(size == 0)) return (*meth)(self, NULL); __Pyx_CyFunction_raise_argument_count_error( (__pyx_CyFunctionObject*)func, "takes no arguments", size); return NULL; } break; case METH_O: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { #if CYTHON_ASSUME_SAFE_SIZE size = PyTuple_GET_SIZE(arg); #else size = PyTuple_Size(arg); if (unlikely(size < 0)) return NULL; #endif if (likely(size == 1)) { PyObject *result, *arg0; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS arg0 = PyTuple_GET_ITEM(arg, 0); #else arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; #endif result = (*meth)(self, arg0); #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) Py_DECREF(arg0); #endif return result; } __Pyx_CyFunction_raise_argument_count_error( (__pyx_CyFunctionObject*)func, "takes exactly one argument", size); return NULL; } break; default: PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); return NULL; } __Pyx_CyFunction_raise_type_error( (__pyx_CyFunctionObject*)func, "takes no keyword arguments"); return NULL; } static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *self, *result; #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)func)->m_self; #endif result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); return result; } static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { PyObject *result; __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); if (vc) { #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); #else (void) &__Pyx_PyVectorcall_FastCallDict; return PyVectorcall_Call(func, args, kw); #endif } #endif if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { Py_ssize_t argc; PyObject *new_args; PyObject *self; #if CYTHON_ASSUME_SAFE_SIZE argc = PyTuple_GET_SIZE(args); #else argc = PyTuple_Size(args); if (unlikely(argc < 0)) return NULL; #endif new_args = PyTuple_GetSlice(args, 1, argc); if (unlikely(!new_args)) return NULL; self = PyTuple_GetItem(args, 0); if (unlikely(!self)) { Py_DECREF(new_args); PyErr_Format(PyExc_TypeError, "unbound method %.200S() needs an argument", cyfunc->func_qualname); return NULL; } result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); Py_DECREF(new_args); } else { result = __Pyx_CyFunction_Call(func, args, kw); } return result; } #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) { int ret = 0; if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { if (unlikely(nargs < 1)) { __Pyx_CyFunction_raise_type_error( cyfunc, "needs an argument"); return -1; } ret = 1; } if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) { __Pyx_CyFunction_raise_type_error( cyfunc, "takes no keyword arguments"); return -1; } return ret; } static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) { __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); PyObject *self; #if CYTHON_COMPILING_IN_LIMITED_API PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); if (unlikely(!meth)) return NULL; #else PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; #endif switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { case 1: self = args[0]; args += 1; nargs -= 1; break; case 0: #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)cyfunc)->m_self; #endif break; default: return NULL; } if (unlikely(nargs != 0)) { __Pyx_CyFunction_raise_argument_count_error( cyfunc, "takes no arguments", nargs); return NULL; } return meth(self, NULL); } static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) { __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); PyObject *self; #if CYTHON_COMPILING_IN_LIMITED_API PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); if (unlikely(!meth)) return NULL; #else PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; #endif switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { case 1: self = args[0]; args += 1; nargs -= 1; break; case 0: #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)cyfunc)->m_self; #endif break; default: return NULL; } if (unlikely(nargs != 1)) { __Pyx_CyFunction_raise_argument_count_error( cyfunc, "takes exactly one argument", nargs); return NULL; } return meth(self, args[0]); } static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) { __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); PyObject *self; #if CYTHON_COMPILING_IN_LIMITED_API PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); if (unlikely(!meth)) return NULL; #else PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; #endif switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { case 1: self = args[0]; args += 1; nargs -= 1; break; case 0: #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)cyfunc)->m_self; #endif break; default: return NULL; } return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames); } static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) { __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); PyObject *self; #if CYTHON_COMPILING_IN_LIMITED_API PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); if (unlikely(!meth)) return NULL; #else PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; #endif switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { case 1: self = args[0]; args += 1; nargs -= 1; break; case 0: #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)cyfunc)->m_self; #endif break; default: return NULL; } #if PY_VERSION_HEX < 0x030e00A6 size_t nargs_value = (size_t) nargs; #else Py_ssize_t nargs_value = nargs; #endif return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames); } #endif static PyType_Slot __pyx_CyFunctionType_slots[] = { {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, {Py_tp_methods, (void *)__pyx_CyFunction_methods}, {Py_tp_members, (void *)__pyx_CyFunction_members}, {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, {0, 0}, }; static PyType_Spec __pyx_CyFunctionType_spec = { __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", sizeof(__pyx_CyFunctionObject), 0, #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR Py_TPFLAGS_METHOD_DESCRIPTOR | #endif #if CYTHON_METH_FASTCALL #if defined(Py_TPFLAGS_HAVE_VECTORCALL) Py_TPFLAGS_HAVE_VECTORCALL | #elif defined(_Py_TPFLAGS_HAVE_VECTORCALL) _Py_TPFLAGS_HAVE_VECTORCALL | #endif #endif // CYTHON_METH_FASTCALL #if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API Py_TPFLAGS_MANAGED_DICT | #endif Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, __pyx_CyFunctionType_slots }; static int __pyx_CyFunction_init(PyObject *module) { __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec( mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL); if (unlikely(mstate->__pyx_CyFunctionType == NULL)) { return -1; } return 0; } static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type); if (unlikely(!m->defaults)) return NULL; return m->defaults; } static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults_tuple = tuple; Py_INCREF(tuple); } static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults_kwdict = dict; Py_INCREF(dict); } static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->func_annotations = dict; Py_INCREF(dict); } /* CythonFunction */ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { PyObject *op = __Pyx_CyFunction_Init( PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType), ml, flags, qualname, closure, module, globals, code ); if (likely(op)) { PyObject_GC_Track(op); } return op; } /* CLineInTraceback (used by AddTraceback) */ #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 #define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o)) #elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL); #else PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) { PyObject **dict_ptr = _PyObject_GetDictPtr(o); return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL; } #endif static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline = NULL; PyObject *ptype, *pvalue, *ptraceback; PyObject *cython_runtime_dict; CYTHON_MAYBE_UNUSED_VAR(tstate); if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) { return c_line; } __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime); if (likely(cython_runtime_dict)) { __PYX_PY_DICT_LOOKUP_IF_MODIFIED( use_cline, cython_runtime_dict, __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False)) } if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; } Py_XDECREF(use_cline); Py_XDECREF(cython_runtime_dict); __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); return c_line; } #endif /* CodeObjectCache (used by AddTraceback) */ 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 __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) { __Pyx_CachedCodeObjectType* code_object; int pos; if (unlikely(!code_line) || unlikely(!code_cache->entries)) { return NULL; } pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) { return NULL; } code_object = code_cache->entries[pos].code_object; Py_INCREF(code_object); return code_object; } static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS (void)__pyx__find_code_object; return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss. #else struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count); if (old_count < 0) { __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); return NULL; } #endif __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line); #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); #endif return result; #endif } static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = code_cache->entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { code_cache->entries = entries; code_cache->max_count = 64; 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(code_cache->entries, code_cache->count, code_line); if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) { __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_INCREF(code_object); Py_DECREF(tmp); return; } if (code_cache->count == code_cache->max_count) { int new_max = code_cache->max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } code_cache->entries = entries; code_cache->max_count = new_max; } for (i=code_cache->count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; code_cache->count++; Py_INCREF(code_object); } static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS (void)__pyx__insert_code_object; return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail. #else struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_nonatomic_int_type expected = 0; if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) { return; } #endif __pyx__insert_code_object(code_cache, code_line, code_object); #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN); #endif #endif } /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif #if CYTHON_COMPILING_IN_LIMITED_API static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, PyObject *firstlineno, PyObject *name) { PyObject *replace = NULL; if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; replace = PyObject_GetAttrString(code, "replace"); if (likely(replace)) { PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict); Py_DECREF(replace); return result; } PyErr_Clear(); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; PyObject *replace = NULL, *getframe = NULL, *frame = NULL; PyObject *exc_type, *exc_value, *exc_traceback; int success = 0; if (c_line) { c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); } PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); code_object = __pyx_find_code_object(c_line ? -c_line : py_line); if (!code_object) { code_object = Py_CompileString("_getframe()", filename, Py_eval_input); if (unlikely(!code_object)) goto bad; py_py_line = PyLong_FromLong(py_line); if (unlikely(!py_py_line)) goto bad; if (c_line) { py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); } else { py_funcname = PyUnicode_FromString(funcname); } if (unlikely(!py_funcname)) goto bad; dict = PyDict_New(); if (unlikely(!dict)) goto bad; { PyObject *old_code_object = code_object; code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); Py_DECREF(old_code_object); } if (unlikely(!code_object)) goto bad; __pyx_insert_code_object(c_line ? -c_line : py_line, code_object); } else { dict = PyDict_New(); } getframe = PySys_GetObject("_getframe"); if (unlikely(!getframe)) goto bad; if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; frame = PyEval_EvalCode(code_object, dict, dict); if (unlikely(!frame) || frame == Py_None) goto bad; success = 1; bad: PyErr_Restore(exc_type, exc_value, exc_traceback); Py_XDECREF(code_object); Py_XDECREF(py_py_line); Py_XDECREF(py_funcname); Py_XDECREF(dict); Py_XDECREF(replace); if (success) { PyTraceBack_Here( (struct _frame*)frame); } Py_XDECREF(frame); } #else static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = NULL; PyObject *py_funcname = NULL; if (c_line) { py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); if (!py_funcname) goto bad; funcname = PyUnicode_AsUTF8(py_funcname); if (!funcname) goto bad; } py_code = PyCode_NewEmpty(filename, funcname, py_line); Py_XDECREF(py_funcname); return py_code; bad: 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; PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject *ptype, *pvalue, *ptraceback; if (c_line) { c_line = __Pyx_CLineForTraceback(tstate, c_line); } py_code = __pyx_find_code_object(c_line ? -c_line : py_line); if (!py_code) { __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) { /* If the code object creation fails, then we should clear the fetched exception references and propagate the new exception */ Py_XDECREF(ptype); Py_XDECREF(pvalue); Py_XDECREF(ptraceback); goto bad; } __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } py_frame = PyFrame_New( tstate, /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ __pyx_mstate_global->__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); } #endif /* 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 int __Pyx_PyLong_As_int(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const int neg_one = (int) -1, const_zero = (int) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (unlikely(!PyLong_Check(x))) { int val; PyObject *tmp = __Pyx_PyNumber_Long(x); if (!tmp) return (int) -1; val = __Pyx_PyLong_As_int(tmp); Py_DECREF(tmp); return val; } if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS if (unlikely(__Pyx_PyLong_IsNeg(x))) { goto raise_neg_overflow; } else if (__Pyx_PyLong_IsCompact(x)) { __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_DigitCount(x)) { 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 && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (int) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if ((sizeof(int) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_USE_PYLONG_INTERNALS if (__Pyx_PyLong_IsCompact(x)) { __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_SignedDigitCount(x)) { case -2: if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 2: if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -3: if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 3: if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -4: if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 4: if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; } } #endif if ((sizeof(int) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { int val; int ret = -1; #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API Py_ssize_t bytes_copied = PyLong_AsNativeBytes( x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); if (unlikely(bytes_copied == -1)) { } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { goto raise_overflow; } else { ret = 0; } #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; ret = _PyLong_AsByteArray((PyLongObject *)x, bytes, sizeof(val), is_little, !is_unsigned); #else PyObject *v; PyObject *stepval = NULL, *mask = NULL, *shift = NULL; int bits, remaining_bits, is_negative = 0; int chunk_size = (sizeof(long) < 8) ? 30 : 62; if (likely(PyLong_CheckExact(x))) { v = __Pyx_NewRef(x); } else { v = PyNumber_Long(x); if (unlikely(!v)) return (int) -1; assert(PyLong_CheckExact(v)); } { int result = PyObject_RichCompareBool(v, Py_False, Py_LT); if (unlikely(result < 0)) { Py_DECREF(v); return (int) -1; } is_negative = result == 1; } if (is_unsigned && unlikely(is_negative)) { Py_DECREF(v); goto raise_neg_overflow; } else if (is_negative) { stepval = PyNumber_Invert(v); Py_DECREF(v); if (unlikely(!stepval)) return (int) -1; } else { stepval = v; } v = NULL; val = (int) 0; mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { PyObject *tmp, *digit; long idigit; digit = PyNumber_And(stepval, mask); if (unlikely(!digit)) goto done; idigit = PyLong_AsLong(digit); Py_DECREF(digit); if (unlikely(idigit < 0)) goto done; val |= ((int) idigit) << bits; tmp = PyNumber_Rshift(stepval, shift); if (unlikely(!tmp)) goto done; Py_DECREF(stepval); stepval = tmp; } Py_DECREF(shift); shift = NULL; Py_DECREF(mask); mask = NULL; { long idigit = PyLong_AsLong(stepval); if (unlikely(idigit < 0)) goto done; remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); if (unlikely(idigit >= (1L << remaining_bits))) goto raise_overflow; val |= ((int) idigit) << bits; } if (!is_unsigned) { if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) goto raise_overflow; if (is_negative) val = ~val; } ret = 0; done: Py_XDECREF(shift); Py_XDECREF(mask); Py_XDECREF(stepval); #endif if (unlikely(ret)) return (int) -1; return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); return (int) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to int"); return (int) -1; } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const int neg_one = (int) -1, const_zero = (int) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(int) < sizeof(long)) { return PyLong_FromLong((long) value); } else if (sizeof(int) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #if !CYTHON_COMPILING_IN_PYPY } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(int) <= sizeof(long)) { return PyLong_FromLong((long) value); } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); } } { unsigned char *bytes = (unsigned char *)&value; #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 if (is_unsigned) { return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); } else { return PyLong_FromNativeBytes(bytes, sizeof(value), -1); } #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 int one = 1; int little = (int)*(unsigned char *)&one; return _PyLong_FromByteArray(bytes, sizeof(int), little, !is_unsigned); #else int one = 1; int little = (int)*(unsigned char *)&one; PyObject *from_bytes, *result = NULL, *kwds = NULL; PyObject *py_bytes = NULL, *order_str = NULL; from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); if (!from_bytes) return NULL; py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); if (!py_bytes) goto limited_bad; order_str = PyUnicode_FromString(little ? "little" : "big"); if (!order_str) goto limited_bad; { PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; if (!is_unsigned) { kwds = __Pyx_MakeVectorcallBuilderKwds(1); if (!kwds) goto limited_bad; if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; } result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); } limited_bad: Py_XDECREF(kwds); Py_XDECREF(order_str); Py_XDECREF(py_bytes); Py_XDECREF(from_bytes); return result; #endif } } /* FormatTypeName */ #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp) { PyObject *module = NULL, *name = NULL, *result = NULL; #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, __pyx_mstate_global->__pyx_n_u_qualname); #else name = PyType_GetQualName(tp); #endif if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad; module = __Pyx_PyObject_GetAttrStr((PyObject *)tp, __pyx_mstate_global->__pyx_n_u_module); if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad; if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) { result = name; name = NULL; goto done; } result = PyUnicode_FromFormat("%U.%U", module, name); if (unlikely(result == NULL)) goto bad; done: Py_XDECREF(name); Py_XDECREF(module); return result; bad: PyErr_Clear(); if (name) { result = name; name = NULL; } else { result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__2); } goto done; } #endif /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const long neg_one = (long) -1, const_zero = (long) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(long) < sizeof(long)) { return PyLong_FromLong((long) value); } else if (sizeof(long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #if !CYTHON_COMPILING_IN_PYPY } 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 PyLong_FromLong((long) value); } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); } } { unsigned char *bytes = (unsigned char *)&value; #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 if (is_unsigned) { return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); } else { return PyLong_FromNativeBytes(bytes, sizeof(value), -1); } #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 int one = 1; int little = (int)*(unsigned char *)&one; return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); #else int one = 1; int little = (int)*(unsigned char *)&one; PyObject *from_bytes, *result = NULL, *kwds = NULL; PyObject *py_bytes = NULL, *order_str = NULL; from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); if (!from_bytes) return NULL; py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); if (!py_bytes) goto limited_bad; order_str = PyUnicode_FromString(little ? "little" : "big"); if (!order_str) goto limited_bad; { PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; if (!is_unsigned) { kwds = __Pyx_MakeVectorcallBuilderKwds(1); if (!kwds) goto limited_bad; if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; } result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); } limited_bad: Py_XDECREF(kwds); Py_XDECREF(order_str); Py_XDECREF(py_bytes); Py_XDECREF(from_bytes); return result; #endif } } /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const long neg_one = (long) -1, const_zero = (long) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (unlikely(!PyLong_Check(x))) { long val; PyObject *tmp = __Pyx_PyNumber_Long(x); if (!tmp) return (long) -1; val = __Pyx_PyLong_As_long(tmp); Py_DECREF(tmp); return val; } if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS if (unlikely(__Pyx_PyLong_IsNeg(x))) { goto raise_neg_overflow; } else if (__Pyx_PyLong_IsCompact(x)) { __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_DigitCount(x)) { 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 && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (long) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if ((sizeof(long) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_USE_PYLONG_INTERNALS if (__Pyx_PyLong_IsCompact(x)) { __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_SignedDigitCount(x)) { case -2: if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 2: if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -3: if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 3: if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -4: if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 4: if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; } } #endif if ((sizeof(long) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { long val; int ret = -1; #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API Py_ssize_t bytes_copied = PyLong_AsNativeBytes( x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); if (unlikely(bytes_copied == -1)) { } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { goto raise_overflow; } else { ret = 0; } #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; ret = _PyLong_AsByteArray((PyLongObject *)x, bytes, sizeof(val), is_little, !is_unsigned); #else PyObject *v; PyObject *stepval = NULL, *mask = NULL, *shift = NULL; int bits, remaining_bits, is_negative = 0; int chunk_size = (sizeof(long) < 8) ? 30 : 62; if (likely(PyLong_CheckExact(x))) { v = __Pyx_NewRef(x); } else { v = PyNumber_Long(x); if (unlikely(!v)) return (long) -1; assert(PyLong_CheckExact(v)); } { int result = PyObject_RichCompareBool(v, Py_False, Py_LT); if (unlikely(result < 0)) { Py_DECREF(v); return (long) -1; } is_negative = result == 1; } if (is_unsigned && unlikely(is_negative)) { Py_DECREF(v); goto raise_neg_overflow; } else if (is_negative) { stepval = PyNumber_Invert(v); Py_DECREF(v); if (unlikely(!stepval)) return (long) -1; } else { stepval = v; } v = NULL; val = (long) 0; mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { PyObject *tmp, *digit; long idigit; digit = PyNumber_And(stepval, mask); if (unlikely(!digit)) goto done; idigit = PyLong_AsLong(digit); Py_DECREF(digit); if (unlikely(idigit < 0)) goto done; val |= ((long) idigit) << bits; tmp = PyNumber_Rshift(stepval, shift); if (unlikely(!tmp)) goto done; Py_DECREF(stepval); stepval = tmp; } Py_DECREF(shift); shift = NULL; Py_DECREF(mask); mask = NULL; { long idigit = PyLong_AsLong(stepval); if (unlikely(idigit < 0)) goto done; remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); if (unlikely(idigit >= (1L << remaining_bits))) goto raise_overflow; val |= ((long) idigit) << bits; } if (!is_unsigned) { if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) goto raise_overflow; if (is_negative) val = ~val; } ret = 0; done: Py_XDECREF(shift); Py_XDECREF(mask); Py_XDECREF(stepval); #endif if (unlikely(ret)) return (long) -1; return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); return (long) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long) -1; } /* FastTypeChecks */ #if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); if (a == b) return 1; } return b == &PyBaseObject_Type; } static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { PyObject *mro; if (a == b) return 1; mro = a->tp_mro; if (likely(mro)) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(mro); for (i = 0; i < n; i++) { if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) return 1; } return 0; } return __Pyx_InBases(a, b); } static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { PyObject *mro; if (cls == a || cls == b) return 1; mro = cls->tp_mro; if (likely(mro)) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(mro); for (i = 0; i < n; i++) { PyObject *base = PyTuple_GET_ITEM(mro, i); if (base == (PyObject *)a || base == (PyObject *)b) return 1; } return 0; } return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); } static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { if (exc_type1) { return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); } else { return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); } } static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { Py_ssize_t i, n; assert(PyExceptionClass_Check(exc_type)); n = PyTuple_GET_SIZE(tuple); for (i=0; i>= 8; ++i; } __Pyx_cached_runtime_version = version; } } #endif static unsigned long __Pyx_get_runtime_version(void) { #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 return Py_Version & ~0xFFUL; #else return __Pyx_cached_runtime_version; #endif } /* CheckBinaryVersion */ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) { const unsigned long MAJOR_MINOR = 0xFFFF0000UL; if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR)) return 0; if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR))) return 1; { char message[200]; PyOS_snprintf(message, sizeof(message), "compile time Python version %d.%d " "of module '%.100s' " "%s " "runtime version %d.%d", (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF), __Pyx_MODULE_NAME, (allow_newer) ? "was newer than" : "does not match", (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF) ); return PyErr_WarnEx(NULL, message, 1); } } /* NewCodeObj */ #if CYTHON_COMPILING_IN_LIMITED_API static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { PyObject *exception_table = NULL; PyObject *types_module=NULL, *code_type=NULL, *result=NULL; #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 PyObject *version_info; PyObject *py_minor_version = NULL; #endif long minor_version = 0; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 minor_version = 11; #else if (!(version_info = PySys_GetObject("version_info"))) goto end; if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; minor_version = PyLong_AsLong(py_minor_version); Py_DECREF(py_minor_version); if (minor_version == -1 && PyErr_Occurred()) goto end; #endif if (!(types_module = PyImport_ImportModule("types"))) goto end; if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; if (minor_version <= 7) { (void)p; result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code, c, n, v, fn, name, fline, lnos, fv, cell); } else if (minor_version <= 10) { result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code, c, n, v, fn, name, fline, lnos, fv, cell); } else { if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code, c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); } end: Py_XDECREF(code_type); Py_XDECREF(exception_table); Py_XDECREF(types_module); if (type) { PyErr_Restore(type, value, traceback); } return result; } #elif PY_VERSION_HEX >= 0x030B0000 static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { PyCodeObject *result; result = #if PY_VERSION_HEX >= 0x030C0000 PyUnstable_Code_NewWithPosOnlyArgs #else PyCode_NewWithPosOnlyArgs #endif (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1 if (likely(result)) result->_co_firsttraceable = 0; #endif return result; } #elif !CYTHON_COMPILING_IN_PYPY #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif static PyObject* __Pyx_PyCode_New( const __Pyx_PyCode_New_function_description descr, PyObject * const *varnames, PyObject *filename, PyObject *funcname, PyObject *line_table, PyObject *tuple_dedup_map ) { PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL; Py_ssize_t var_count = (Py_ssize_t) descr.nlocals; PyObject *varnames_tuple = PyTuple_New(var_count); if (unlikely(!varnames_tuple)) return NULL; for (Py_ssize_t i=0; i < var_count; i++) { Py_INCREF(varnames[i]); if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done; } #if CYTHON_COMPILING_IN_LIMITED_API varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple); if (!varnames_tuple_dedup) { if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done; varnames_tuple_dedup = varnames_tuple; } #else varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple); if (unlikely(!varnames_tuple_dedup)) goto done; #endif #if CYTHON_AVOID_BORROWED_REFS Py_INCREF(varnames_tuple_dedup); #endif if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) { Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(line_table_length == -1)) goto done; #endif Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL; code_bytes = PyBytes_FromStringAndSize(NULL, code_len); if (unlikely(!code_bytes)) goto done; char* c_code_bytes = PyBytes_AsString(code_bytes); if (unlikely(!c_code_bytes)) goto done; memset(c_code_bytes, 0, (size_t) code_len); } code_obj = (PyObject*) __Pyx__PyCode_New( (int) descr.argcount, (int) descr.num_posonly_args, (int) descr.num_kwonly_args, (int) descr.nlocals, 0, (int) descr.flags, code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes, __pyx_mstate_global->__pyx_empty_tuple, __pyx_mstate_global->__pyx_empty_tuple, varnames_tuple_dedup, __pyx_mstate_global->__pyx_empty_tuple, __pyx_mstate_global->__pyx_empty_tuple, filename, funcname, (int) descr.first_line, (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes ); done: Py_XDECREF(code_bytes); #if CYTHON_AVOID_BORROWED_REFS Py_XDECREF(varnames_tuple_dedup); #endif Py_DECREF(varnames_tuple); return code_obj; } /* DecompressString */ static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) { PyObject *module = NULL, *decompress, *compressed_bytes, *decompressed; const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib"; PyObject *methodname = PyUnicode_FromString("decompress"); if (unlikely(!methodname)) return NULL; #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000 if (algo == 3) { PyObject *fromlist = Py_BuildValue("[O]", methodname); if (unlikely(!fromlist)) goto bad; module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0); Py_DECREF(fromlist); } else #endif module = PyImport_ImportModule(module_name); if (unlikely(!module)) goto import_failed; decompress = PyObject_GetAttr(module, methodname); if (unlikely(!decompress)) goto import_failed; { #ifdef __cplusplus char *memview_bytes = const_cast(s); #else #if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wcast-qual" #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-qual" #endif char *memview_bytes = (char*) s; #if defined(__clang__) #pragma clang diagnostic pop #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) #pragma GCC diagnostic pop #endif #endif #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ) int memview_flags = 0x100; #else int memview_flags = PyBUF_READ; #endif compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags); } if (unlikely(!compressed_bytes)) { Py_DECREF(decompress); goto bad; } decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL); Py_DECREF(compressed_bytes); Py_DECREF(decompress); Py_DECREF(module); Py_DECREF(methodname); return decompressed; import_failed: PyErr_Format(PyExc_ImportError, "Failed to import '%.20s.decompress' - cannot initialise module strings. " "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.", module_name, algo); bad: Py_XDECREF(module); Py_DECREF(methodname); return NULL; } #include static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { size_t len = strlen(s); if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) { PyErr_SetString(PyExc_OverflowError, "byte string is too long"); return -1; } return (Py_ssize_t) len; } static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { Py_ssize_t len = __Pyx_ssize_strlen(c_str); if (unlikely(len < 0)) return NULL; return __Pyx_PyUnicode_FromStringAndSize(c_str, len); } static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) { Py_ssize_t len = __Pyx_ssize_strlen(c_str); if (unlikely(len < 0)) return NULL; return PyByteArray_FromStringAndSize(c_str, len); } static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; #if CYTHON_COMPILING_IN_LIMITED_API { const char* result; Py_ssize_t unicode_length; CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL; #else result = PyUnicode_AsUTF8AndSize(o, length); #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII unicode_length = PyUnicode_GetLength(o); if (unlikely(unicode_length < 0)) return NULL; if (unlikely(unicode_length != *length)) { PyUnicode_AsASCIIString(o); return NULL; } #endif return result; } #else #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (likely(PyUnicode_IS_ASCII(o))) { *length = PyUnicode_GET_LENGTH(o); return PyUnicode_AsUTF8(o); } else { PyUnicode_AsASCIIString(o); return NULL; } #else return PyUnicode_AsUTF8AndSize(o, length); #endif #endif } #endif static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 if (PyUnicode_Check(o)) { return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif if (PyByteArray_Check(o)) { #if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))) *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); #else *length = PyByteArray_Size(o); if (*length == -1) return NULL; return PyByteArray_AsString(o); #endif } else { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); if (unlikely(r < 0)) { return NULL; } else { return result; } } } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { int retval; if (unlikely(!x)) return -1; retval = __Pyx_PyObject_IsTrue(x); Py_DECREF(x); return retval; } static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) { __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result)); if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " "The ability to return an instance of a strict subclass of int is deprecated, " "and may be removed in a future version of Python.", result_type_name)) { __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } __Pyx_DECREF_TypeName(result_type_name); return result; } PyErr_Format(PyExc_TypeError, "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")", result_type_name); __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) { #if CYTHON_USE_TYPE_SLOTS PyNumberMethods *m; #endif PyObject *res = NULL; if (likely(PyLong_Check(x))) return __Pyx_NewRef(x); #if CYTHON_USE_TYPE_SLOTS m = Py_TYPE(x)->tp_as_number; if (likely(m && m->nb_int)) { res = m->nb_int(x); } #else if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { res = PyNumber_Long(x); } #endif if (likely(res)) { if (unlikely(!PyLong_CheckExact(res))) { return __Pyx_PyNumber_LongWrongResultType(res); } } 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 (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS if (likely(__Pyx_PyLong_IsCompact(b))) { return __Pyx_PyLong_CompactValue(b); } else { const digit* digits = __Pyx_PyLong_Digits(b); const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); 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 = PyLong_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); } else { Py_ssize_t ival; PyObject *x; x = PyNumber_Index(o); if (!x) return -1; ival = PyLong_AsLong(x); Py_DECREF(x); return ival; } } static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) { CYTHON_UNUSED_VAR(b); return __Pyx_NewRef(Py_None); } static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return __Pyx_NewRef(b ? Py_True: Py_False); } static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) { return PyLong_FromSize_t(ival); } /* MultiPhaseInitModuleState */ #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE #ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE #if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000) #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1 #else #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0 #endif #endif #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS #error "Module state with PEP489 requires atomics. Currently that's one of\ C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics" #endif #if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE #define __Pyx_ModuleStateLookup_Lock() #define __Pyx_ModuleStateLookup_Unlock() #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 static PyMutex __Pyx_ModuleStateLookup_mutex = {0}; #define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex) #define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex) #elif defined(__cplusplus) && __cplusplus >= 201103L #include static std::mutex __Pyx_ModuleStateLookup_mutex; #define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock() #define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock() #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__) #include static mtx_t __Pyx_ModuleStateLookup_mutex; static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT; static void __Pyx_ModuleStateLookup_initialize_mutex(void) { mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain); } #define __Pyx_ModuleStateLookup_Lock()\ call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\ mtx_lock(&__Pyx_ModuleStateLookup_mutex) #define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex) #elif defined(HAVE_PTHREAD_H) #include static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER; #define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex) #define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex) #elif defined(_WIN32) #include // synchapi.h on its own doesn't work static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT; #define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) #define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) #else #error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\ Requires C standard >= C11, or C++ standard >= C++11,\ or pthreads, or the Windows 32 API, or Python >= 3.13." #endif typedef struct { int64_t id; PyObject *module; } __Pyx_InterpreterIdAndModule; typedef struct { char interpreter_id_as_index; Py_ssize_t count; Py_ssize_t allocated; __Pyx_InterpreterIdAndModule table[1]; } __Pyx_ModuleStateLookupData; #define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32 #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0; #endif #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0; #else static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL; #endif static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound( __Pyx_InterpreterIdAndModule* table, Py_ssize_t count, int64_t interpreterId) { __Pyx_InterpreterIdAndModule* begin = table; __Pyx_InterpreterIdAndModule* end = begin + count; if (begin->id == interpreterId) { return begin; } while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2; if (halfway->id == interpreterId) { return halfway; } if (halfway->id < interpreterId) { begin = halfway; } else { end = halfway; } } for (; begin < end; ++begin) { if (begin->id >= interpreterId) return begin; } return begin; } static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) { int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); if (interpreter_id == -1) return NULL; #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); { __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); if (likely(data)) { __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data); if (likely(data == new_data)) { goto read_finished; } } __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); __Pyx_ModuleStateLookup_Lock(); __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter); data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); __Pyx_ModuleStateLookup_Unlock(); } read_finished:; #else __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data; #endif __Pyx_InterpreterIdAndModule* found = NULL; if (unlikely(!data)) goto end; if (data->interpreter_id_as_index) { if (interpreter_id < data->count) { found = data->table+interpreter_id; } } else { found = __Pyx_State_FindModuleStateLookupTableLowerBound( data->table, data->count, interpreter_id); } end: { PyObject *result=NULL; if (found && found->id == interpreter_id) { result = found->module; } #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); #endif return result; } } #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) { while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0); } #else #define __Pyx_ModuleStateLookup_wait_until_no_readers() #endif static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) { Py_ssize_t to_allocate = (*old_data)->allocated; while (to_allocate <= interpreter_id) { if (to_allocate == 0) to_allocate = 1; else to_allocate *= 2; } __Pyx_ModuleStateLookupData *new_data = *old_data; if (to_allocate != (*old_data)->allocated) { new_data = (__Pyx_ModuleStateLookupData *)realloc( *old_data, sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); if (!new_data) { PyErr_NoMemory(); return -1; } for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) { new_data->table[i].id = i; new_data->table[i].module = NULL; } new_data->allocated = to_allocate; } new_data->table[interpreter_id].module = module; if (new_data->count < interpreter_id+1) { new_data->count = interpreter_id+1; } *old_data = new_data; return 0; } static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) { __Pyx_InterpreterIdAndModule *read = data->table; __Pyx_InterpreterIdAndModule *write = data->table; __Pyx_InterpreterIdAndModule *end = read + data->count; for (; readmodule) { write->id = read->id; write->module = read->module; ++write; } } data->count = write - data->table; for (; writeid = 0; write->module = NULL; } data->interpreter_id_as_index = 0; } static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) { int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); if (interpreter_id == -1) return -1; int result = 0; __Pyx_ModuleStateLookup_Lock(); #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *) __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); #else __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data; #endif __Pyx_ModuleStateLookupData *new_data = old_data; if (!new_data) { new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData)); if (!new_data) { result = -1; PyErr_NoMemory(); goto end; } new_data->allocated = 1; new_data->interpreter_id_as_index = 1; } __Pyx_ModuleStateLookup_wait_until_no_readers(); if (new_data->interpreter_id_as_index) { if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id); goto end; } __Pyx_State_ConvertFromInterpIdAsIndex(new_data); } { Py_ssize_t insert_at = 0; { __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( new_data->table, new_data->count, interpreter_id); assert(lower_bound); insert_at = lower_bound - new_data->table; if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) { lower_bound->module = module; goto end; // already in table, nothing more to do } } if (new_data->count+1 >= new_data->allocated) { Py_ssize_t to_allocate = (new_data->count+1)*2; new_data = (__Pyx_ModuleStateLookupData*)realloc( new_data, sizeof(__Pyx_ModuleStateLookupData) + (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); if (!new_data) { result = -1; new_data = old_data; PyErr_NoMemory(); goto end; } new_data->allocated = to_allocate; } ++new_data->count; int64_t last_id = interpreter_id; PyObject *last_module = module; for (Py_ssize_t i=insert_at; icount; ++i) { int64_t current_id = new_data->table[i].id; new_data->table[i].id = last_id; last_id = current_id; PyObject *current_module = new_data->table[i].module; new_data->table[i].module = last_module; last_module = current_module; } } end: #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data); #else __Pyx_ModuleStateLookup_data = new_data; #endif __Pyx_ModuleStateLookup_Unlock(); return result; } static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) { int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); if (interpreter_id == -1) return -1; __Pyx_ModuleStateLookup_Lock(); #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *) __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); #else __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data; #endif if (data->interpreter_id_as_index) { if (interpreter_id < data->count) { data->table[interpreter_id].module = NULL; } goto done; } { __Pyx_ModuleStateLookup_wait_until_no_readers(); __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( data->table, data->count, interpreter_id); if (!lower_bound) goto done; if (lower_bound->id != interpreter_id) goto done; __Pyx_InterpreterIdAndModule *end = data->table+data->count; for (;lower_boundid = (lower_bound+1)->id; lower_bound->module = (lower_bound+1)->module; } } --data->count; if (data->count == 0) { free(data); data = NULL; } done: #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data); #else __Pyx_ModuleStateLookup_data = data; #endif __Pyx_ModuleStateLookup_Unlock(); return 0; } #endif /* #### Code section: utility_code_pragmas_end ### */ #ifdef _MSC_VER #pragma warning( pop ) #endif /* #### Code section: end ### */ #endif /* Py_PYTHON_H */ graph-algorithms-planarity-08d7b51/planarity/classic/planarity.pyx000066400000000000000000000154171522057144000255200ustar00rootroot00000000000000#!python #cython: embedsignature=True """ Wrapper for Boyer's (c) planarity algorithms. """ from libc.stdlib cimport free import warnings from planarity.classic cimport cplanarity cdef class PGraph: cdef cplanarity.graphP theGraph cdef dict nodemap cdef dict reverse_nodemap cdef int embedding def __init__(self,graph): # guess input type if hasattr(graph,'nodes'): # NetworkX graph nodes=list(graph.nodes()) edges=list(graph.edges()) elif hasattr(graph,'keys'): # adjacency dict of dicts|sets|lists nodes=graph.keys() edges=[] seen=set() for node,adj in graph.items(): nbrs=[n for n in adj if n not in seen] l=len(nbrs) edges.extend(zip([node]*l,nbrs)) seen.add(node) else: # edge list (list of lists|tuples) try: nodes=set([node for sublist in graph for node in sublist]) except: raise RuntimeError("Unknown input type") edges=graph n=len(nodes) self.nodemap=dict(zip(nodes,range(1,n+1))) self.reverse_nodemap=dict(zip(range(1,n+1),nodes)) self.theGraph = cplanarity.gp_New() cdef int status status = cplanarity.gp_EnsureVertexCapacity(self.theGraph, n) if status != cplanarity.OK: raise RuntimeError("planarity: failed to initialize graph") # add the edges and check return seen = set() for u,v in edges: if (u,v) not in seen and (v,u) not in seen: status = cplanarity.gp_DynamicAddEdge(self.theGraph, self.nodemap[u], 0, self.nodemap[v], 0) if status != cplanarity.OK: cplanarity.gp_Free(&self.theGraph) raise RuntimeError("planarity: failed adding edge.") seen.add((u,v)) else: warnings.warn('ignoring parallel edge %s-%s'%(str(u),str(v))) self.embedding=cplanarity.NOTOK def __dealloc__(self): cplanarity.gp_Free(&self.theGraph) def embed_planar(self): if self.embedding != 0: return status = cplanarity.gp_ExtendWith_Planarity(self.theGraph) if status != cplanarity.OK: raise RuntimeError("planarity: failed to extend graph with planarity structures.") self.embedding = cplanarity.gp_Embed(self.theGraph, cplanarity.EMBEDFLAGS_PLANAR) cplanarity.gp_SortVertices(self.theGraph) def embed_drawplanar(self): status = cplanarity.gp_ExtendWith_DrawPlanar(self.theGraph) if status != cplanarity.OK: raise RuntimeError("planarity: failed to extend graph with drawplanar structures.") status = cplanarity.gp_Embed(self.theGraph, cplanarity.EMBEDFLAGS_DRAWPLANAR) if status == cplanarity.NONEMBEDDABLE: raise RuntimeError("planarity: graph not planar.") cplanarity.gp_SortVertices(self.theGraph) def is_planar(self): """Return True if graph is planar.""" self.embed_planar() if self.embedding == cplanarity.NONEMBEDDABLE: return False return True def kuratowski_edges(self): if self.is_planar(): return [] elif self.embedding == cplanarity.NONEMBEDDABLE: return self.edges(include_drawplanar_edge_info=False) else: raise RuntimeError("planarity: Unknown error.") def nodes(self, include_drawplanar_vertex_info=False): first=cplanarity.gp_LowerBoundVertices(self.theGraph) last=cplanarity.gp_UpperBoundVertices(self.theGraph) r=self.reverse_nodemap nodes=[] for v in range(first, last): if include_drawplanar_vertex_info: drawplanar_vertex_info = {} vertex_position=cplanarity.gp_DrawPlanar_GetVertexPosition(self.theGraph, v) vertex_start=cplanarity.gp_DrawPlanar_GetVertexStart(self.theGraph, v) vertex_end=cplanarity.gp_DrawPlanar_GetVertexEnd(self.theGraph, v) if (vertex_position > -1 and vertex_start > -1 and vertex_end > -1): drawplanar_vertex_info.update( vertex_position=vertex_position, vertex_start=vertex_start, vertex_end=vertex_end, ) nodes.append((r[v], drawplanar_vertex_info)) else: nodes.append((r[v])) return nodes def edges(self, include_drawplanar_edge_info=False): edges=[] r=self.reverse_nodemap first=cplanarity.gp_LowerBoundVertices(self.theGraph) last=cplanarity.gp_UpperBoundVertices(self.theGraph) for v in range(first,last): e = cplanarity.gp_GetFirstEdge(self.theGraph, v) is_edge = cplanarity.gp_IsEdge(self.theGraph, e) while is_edge > 0: nbr = cplanarity.gp_GetNeighbor(self.theGraph, e) if nbr > v: if include_drawplanar_edge_info: drawplanar_edge_info = {} edge_position=cplanarity.gp_DrawPlanar_GetEdgePosition(self.theGraph, e) edge_start=cplanarity.gp_DrawPlanar_GetEdgeStart(self.theGraph, e) edge_end=cplanarity.gp_DrawPlanar_GetEdgeEnd(self.theGraph, e) if (edge_position > -1 and edge_start > -1 and edge_end > -1): drawplanar_edge_info.update( edge_position=edge_position, edge_start=edge_start, edge_end=edge_end, ) edges.append((r[v], r[nbr], drawplanar_edge_info)) else: edges.append((r[v],r[nbr])) e=cplanarity.gp_GetNextEdge(self.theGraph,e) is_edge=cplanarity.gp_IsEdge(self.theGraph, e) return edges def ascii(self): cdef char* s = NULL self.embed_drawplanar() status = cplanarity.gp_DrawPlanar_RenderToString(self.theGraph, &s) py_bytes = s[:] free(s) return py_bytes.decode('ascii') def write(self,path): bpath=path.encode() status=cplanarity.gp_Write(self.theGraph, bpath, cplanarity.WRITE_ADJLIST) def mapping(self): return self.reverse_nodemap graph-algorithms-planarity-08d7b51/planarity/classic/planarity_functions.py000066400000000000000000000014461522057144000274150ustar00rootroot00000000000000"""Functional interface to planarity.""" import planarity __all__ = [ 'is_planar', 'kuratowski_edges', 'ascii', 'write', 'mapping' ] def is_planar(graph): """Test planarity of graph.""" return planarity.PGraph(graph).is_planar() def kuratowski_edges(graph): """Return edges of forbidden subgraph of non-planar graph.""" return planarity.PGraph(graph).kuratowski_edges() def ascii(graph): """Draw text representation of a planar graph.""" return planarity.PGraph(graph).ascii() def write(graph, path='stdout'): """Write an adjacency list representation of graph to path.""" planarity.PGraph(graph).write(path) def mapping(graph): """Return dictionary of internal mapping of nodes to integers.""" return planarity.PGraph(graph).mapping() graph-algorithms-planarity-08d7b51/planarity/classic/planarity_networkx.py000066400000000000000000000053641522057144000272710ustar00rootroot00000000000000"""NetworkX interface to planarity.""" import planarity __all__ = [ 'kuratowski_subgraph', 'networkx_graph', 'pgraph_graph', 'draw', ] def kuratowski_subgraph(graph): """Return forbidden subgraph of nonplanar graph G.""" try: import networkx as nx except ImportError: raise ImportError("NetworkX required for kuratowski_subgraph()") pgraph = planarity.PGraph(graph) edges = pgraph.kuratowski_edges() return nx.Graph(edges) def networkx_graph(pgraph): """Return NetworkX graph built from planarity pgraph.""" try: import networkx as nx except ImportError: raise ImportError("NetworkX required for networkx_graph()") graph = nx.Graph() graph.add_nodes_from(pgraph.nodes(include_drawplanar_vertex_info=True)) graph.add_edges_from(pgraph.edges(include_drawplanar_edge_info=True)) return graph def pgraph_graph(graph): """Return pgraph graph built from NetworkX graph.""" return planarity.PGraph(graph) def draw(graph, labels=True): """Draw planar graph with Matplotlib.""" try: import matplotlib.pyplot as plt from matplotlib.patches import Circle from matplotlib.collections import PatchCollection except ImportError: raise ImportError("Matplotlib is required for draw()") pgraph = planarity.PGraph(graph) pgraph.embed_drawplanar() hgraph = networkx_graph(pgraph) patches = [] node_labels = {} xs = [] ys = [] for node, drawplanar_vertex_info in hgraph.nodes(data=True): y = drawplanar_vertex_info['vertex_position'] xb = drawplanar_vertex_info['vertex_start'] xe = drawplanar_vertex_info['vertex_end'] x = int((xe+xb)/2) node_labels[node] = (x, y) patches += [Circle((x, y), 0.25)]#,0.5,fc='w')] xs.extend([xb, xe]) ys.append(y) plt.hlines([y], [xb], [xe]) for (_, _, drawplanar_edge_info) in hgraph.edges(data=True): x = drawplanar_edge_info['edge_position'] yb = drawplanar_edge_info['edge_start'] ye = drawplanar_edge_info['edge_end'] ys.extend([yb, ye]) xs.append(x) plt.vlines([x], [yb], [ye]) # labels if labels: for n, (x, y) in node_labels.items(): plt.text(x, y, n, horizontalalignment='center', verticalalignment='center', bbox = dict(boxstyle='round', ec=(0.0, 0.0, 0.0), fc=(1.0, 1.0, 1.0), ) ) p = PatchCollection(patches) ax = plt.gca() ax.add_collection(p) plt.axis('equal') plt.xlim(min(xs)-1, max(xs)+1) plt.ylim(min(ys)-1, max(ys)+1) graph-algorithms-planarity-08d7b51/planarity/full/000077500000000000000000000000001522057144000222645ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/planarity/full/__init__.pxd000066400000000000000000000000001522057144000245260ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/planarity/full/__init__.py000066400000000000000000000000001522057144000243630ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/planarity/full/cgraphLib.pxd000066400000000000000000000264621522057144000247060ustar00rootroot00000000000000"""C-level interface for the Edge Addition Planarity Suite Graph Library Specifically provides definitions for functions and macros that are required to interact with graphP structs and to expose the G6 read and write iterator machinery. """ cdef extern from "../c/graphLib/lowLevelUtils/apiutils.h": int QUIETMODE_NONE, QUIETMODE_ERRORS, QUIETMODE_MESSAGES, QUIETMODE_ALL int gp_GetQuietMode() void gp_SetQuietMode(int newQuietMode) cdef extern from "../c/graphLib/graphLib.h": const char *gp_GetProjectVersionFull() const char *gp_GetLibPlanarityVersionFull() cdef extern from "../c/graphLib/lowLevelUtils/appconst.h": cdef int OK, NOTOK, TRUE, FALSE, NIL cdef extern from "../c/graphLib/graph.h": ctypedef struct graphStruct: pass ctypedef graphStruct * graphP graphP gp_New() int gp_EnsureVertexCapacity(graphP theGraph, int N) int gp_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity) void gp_ResetGraphStorage(graphP theGraph) void gp_Free(graphP *pGraph) int gp_GetN(graphP theGraph) int gp_GetNV(graphP theGraph) int gp_GetM(graphP theGraph) int gp_GetEdgeCapacity(graphP theGraph) int gp_CopyGraph(graphP dstGraph, graphP srcGraph) graphP gp_DupGraph(graphP theGraph) int gp_CopyAdjacencyLists(graphP dstGraph, graphP srcGraph) int gp_CreateRandomGraph(graphP theGraph) int gp_CreateRandomGraphEx(graphP theGraph, int numEdges) int gp_IsNeighbor(graphP theGraph, int u, int v) int gp_FindEdge(graphP theGraph, int u, int v) int gp_GetVertexDegree(graphP theGraph, int v) int gp_IsNeighborDirected(graphP theGraph, int u, int v, unsigned direction) int gp_FindDirectedEdge(graphP theGraph, int u, int v, unsigned direction) int gp_GetVertexInDegree(graphP theGraph, int v) int gp_GetVertexOutDegree(graphP theGraph, int v) int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink) int gp_DynamicAddEdge(graphP theGraph, int u, int ulink, int v, int vlink) int gp_InsertEdge(graphP theGraph, int u, int e_u, int e_ulink, int v, int e_v, int e_vlink) int gp_DeleteEdge(graphP theGraph, int e) void gp_HideEdge(graphP theGraph, int e) void gp_RestoreEdge(graphP theGraph, int e) int gp_HideVertex(graphP theGraph, int vertex) int gp_RestoreVertex(graphP theGraph) int gp_ContractEdge(graphP theGraph, int e) int gp_IdentifyVertices(graphP theGraph, int u, int v, int eBefore) int gp_RestoreVertices(graphP theGraph) int gp_GetGraphFlags(graphP theGraph) int gp_GetFirstEdge(graphP theGraph, int v) int gp_GetLastEdge(graphP theGraph, int v) int gp_GetEdgeByLink(graphP theGraph, int v, int theLink) void gp_SetFirstEdge(graphP theGraph, int v, int newFirstEdge) void gp_SetLastEdge(graphP theGraph, int v, int newLastEdge) void gp_SetEdgeByLink(graphP theGraph, int v, int theLink, int newEdge) int gp_LowerBoundVertices(graphP theGraph) int gp_UpperBoundVertices(graphP theGraph) int gp_LowerBoundVirtualVertices(graphP theGraph) int gp_UpperBoundVirtualVertices(graphP theGraph) int gp_LowerBoundVertexStorage(graphP theGraph) int gp_UpperBoundVertexStorage(graphP theGraph) int gp_IsVertex(graphP theGraph, int v) int gp_IsVirtualVertex(graphP theGraph, int v) int gp_IsNotVertex(graphP theGraph, int v) int gp_IsNotVirtualVertex(graphP theGraph, int v) int gp_VirtualVertexInUse(graphP theGraph, int virtualVertex) int gp_VirtualVertexNotInUse(graphP theGraph, int virtualVertex) int gp_GetIndex(graphP theGraph, int v) void gp_SetIndex(graphP theGraph, int v, int theIndex) void gp_InitFlags(graphP theGraph, int v) int VERTEX_VISITED_MASK int gp_GetVisited(graphP theGraph, int v) void gp_ClearVisited(graphP theGraph, int v) void gp_SetVisited(graphP theGraph, int v) int VERTEX_MARKED_MASK int gp_GetMarked(graphP theGraph, int v) void gp_ClearMarked(graphP theGraph, int v) void gp_SetMarked(graphP theGraph, int v) int gp_GetTwin(graphP theGraph, int e) int gp_GetNextEdge(graphP theGraph, int e) int gp_GetPrevEdge(graphP theGraph, int e) int gp_GetAdjacentEdge(graphP theGraph, int e, int theLink) void gp_SetNextEdge(graphP theGraph, int e, int newNextEdge) void gp_SetPrevEdge(graphP theGraph, int e, int newPrevEdge) void gp_SetAdjacentEdge(graphP theGraph, int e, int theLink, int newEdge) int gp_IsEdge(graphP theGraph, int e) int gp_IsNotEdge(graphP theGraph, int e) int gp_GetNeighbor(graphP theGraph, int e) void gp_SetNeighbor(graphP theGraph, int e, int v) void gp_InitEdgeFlags(graphP theGraph, int e) int EDGE_VISITED_MASK int gp_GetEdgeVisited(graphP theGraph, int e) void gp_ClearEdgeVisited(graphP theGraph, int e) void gp_SetEdgeVisited(graphP theGraph, int e) int EDGE_MARKED_MASK int gp_GetEdgeMarked(graphP theGraph, int e) void gp_ClearEdgeMarked(graphP theGraph, int e) void gp_SetEdgeMarked(graphP theGraph, int e) int EDGE_TYPE_MASK int EDGE_TYPE_CHILD, EDGE_TYPE_FORWARD, EDGE_TYPE_PARENT, EDGE_TYPE_BACK int EDGE_TYPE_NOTDEFINED, EDGE_TYPE_TREE int gp_GetEdgeType(graphP theGraph, int e) void gp_ClearEdgeType(graphP theGraph, int e) void gp_SetEdgeType(graphP theGraph, int e, int type) void gp_ResetEdgeType(graphP theGraph, int e, int type) int EDGEFLAG_INVERTED_MASK int gp_GetEdgeFlagInverted(graphP theGraph, int e) void gp_SetEdgeFlagInverted(graphP theGraph, int e) void gp_ClearEdgeFlagInverted(graphP theGraph, int e) void gp_XorEdgeFlagInverted(graphP theGraph, int e) int EDGEFLAG_DIRECTION_INONLY, EDGEFLAG_DIRECTION_OUTONLY, EDGEFLAG_DIRECTION_MASK int gp_GetDirection(graphP theGraph, int e) void gp_SetDirection(graphP theGraph, int e, int direction) int gp_LowerBoundEdges(graphP theGraph) int gp_UpperBoundEdges(graphP theGraph) int gp_EdgeInUse(graphP theGraph, int e) int gp_EdgeNotInUse(graphP theGraph, int e) int gp_LowerBoundEdgeStorage(graphP theGraph) int gp_UpperBoundEdgeStorage(graphP theGraph) int DEFAULT_EDGE_CAPACITY_FACTOR int AT_EDGE_CAPACITY_LIMIT cdef extern from "../c/graphLib/io/graphIO.h": int gp_Read(graphP theGraph, char *fileName) int gp_ReadFromString(graphP theGraph, char *inputStr) int gp_Write(graphP theGraph, char *fileName, int writeMode) int gp_WriteToString(graphP theGraph, char **pOutputStr, int writeMode) int WRITE_ADJLIST, WRITE_ADJMATRIX, WRITE_DEBUGINFO, WRITE_G6 int GRAPHFLAGS_ZEROBASEDIO cdef extern from "../c/graphLib/io/g6-read-iterator.h": ctypedef struct G6ReadIterator: pass ctypedef G6ReadIterator * G6ReadIteratorP int g6_NewReader(G6ReadIteratorP *pG6ReadIterator, graphP theGraph) int g6_InitReaderWithString(G6ReadIteratorP theG6ReadIterator, char *inputString) int g6_InitReaderWithFileName(G6ReadIteratorP theG6ReadIterator, char *infileName) int g6_ReadGraph(G6ReadIteratorP theG6ReadIterator) int g6_EndReached(G6ReadIteratorP theG6ReadIterator) void g6_FreeReader(G6ReadIteratorP *pG6ReadIterator) cdef extern from "../c/graphLib/io/g6-write-iterator.h": ctypedef struct G6WriteIterator: pass ctypedef G6WriteIterator * G6WriteIteratorP int g6_NewWriter(G6WriteIteratorP *pG6WriteIterator, graphP theGraph) int g6_InitWriterWithString(G6WriteIteratorP theG6WriteIterator, char **pOutputString) int g6_InitWriterWithFileName(G6WriteIteratorP theG6WriteIterator, char *outputFileName) int g6_WriteGraph(G6WriteIteratorP theG6WriteIterator) void g6_FreeWriter(G6WriteIteratorP *pG6WriteIterator) cdef extern from "../c/graphLib/graphDFSUtils.h": const char *DFSUTILS_NAME int gp_ExtendWith_DFSUtils(graphP theGraph) int gp_Detach_DFSUtils(graphP theGraph) int GRAPHFLAGS_EXTENDEDWITH_DFSUTILS, GRAPHFLAGS_DFSNUMBERED, GRAPHFLAGS_SORTEDBYDFI int gp_DepthFirstSearch(graphP theGraph) int gp_SortVertices(graphP theGraph) int gp_ComputeLowpoints(graphP theGraph) int gp_ComputeLeastAncestors(graphP theGraph) int gp_GetParent(graphP theGraph, int v) int gp_GetLeastAncestor(graphP theGraph, int v) int gp_GetLowpoint(graphP theGraph, int v) # FIXME: We fail to link due to issue where these macros call private # gp_GetVertexParent() rather than public gp_GetParent() # int gp_IsDFSTreeRoot(graphP theGraph, int v) # int gp_IsNotDFSTreeRoot(graphP theGraph, int v) int gp_GetBicompRootFromDFSChild(graphP theGraph, int c) int gp_GetDFSChildFromBicompRoot(graphP theGraph, int R) # FIXME: We fail to link due to issue where this macro calls private # gp_GetVertexParent() rather than public gp_GetParent() # int gp_GetVertexFromBicompRoot(graphP theGraph, int R) int gp_IsBicompRoot(graphP theGraph, int v) int gp_IsSeparatedDFSChild(graphP theGraph, int theChild) int gp_IsNotSeparatedDFSChild(graphP theGraph, int theChild) cdef extern from "../c/graphLib/planarityRelated/graphPlanarity.h": const char *PLANARITY_NAME int gp_ExtendWith_Planarity(graphP theGraph) int gp_Detach_Planarity(graphP theGraph) int GRAPHFLAGS_EXTENDEDWITH_PLANARITY int gp_Embed(graphP theGraph, unsigned int embedFlags) int gp_TestEmbedResultIntegrity(graphP theGraph, graphP origGraph, int embedResult) int NONEMBEDDABLE int gp_GetEmbedFlags(graphP theGraph) int EMBEDFLAGS_PLANAR, EMBEDFLAGS_DRAWPLANAR, EMBEDFLAGS_OUTERPLANAR int EMBEDFLAGS_SEARCHFORK23, EMBEDFLAGS_SEARCHFORK33, EMBEDFLAGS_SEARCHFORK4 unsigned gp_GetObstructionMinorType(graphP theGraph) int MINORTYPE_NONE, MINORTYPE_A, MINORTYPE_B, MINORTYPE_C, MINORTYPE_D, MINORTYPE_E int MINORTYPE_E1, MINORTYPE_E2, MINORTYPE_E3, MINORTYPE_E4 int MINORTYPE_E5, MINORTYPE_E6, MINORTYPE_E7 cdef extern from "../c/graphLib/planarityRelated/graphOuterplanarity.h": const char *OUTERPLANARITY_NAME int gp_ExtendWith_Outerplanarity(graphP theGraph) int gp_Detach_Outerplanarity(graphP theGraph) int GRAPHFLAGS_EXTENDEDWITH_OUTERPLANARITY cdef extern from "../c/graphLib/planarityRelated/graphDrawPlanar.h": const char *DRAWPLANAR_NAME int gp_ExtendWith_DrawPlanar(graphP theGraph) int gp_Detach_DrawPlanar(graphP theGraph) int gp_DrawPlanar_RenderToFile(graphP theEmbedding, char *theFileName) int gp_DrawPlanar_RenderToString(graphP theEmbedding, char **pRenditionString) int gp_DrawPlanar_GetVertexPosition(graphP theEmbedding, int v) int gp_DrawPlanar_GetVertexStart(graphP theEmbedding, int v) int gp_DrawPlanar_GetVertexEnd(graphP theEmbedding, int v) int gp_DrawPlanar_GetEdgePosition(graphP theEmbedding, int e) int gp_DrawPlanar_GetEdgeStart(graphP theEmbedding, int e) int gp_DrawPlanar_GetEdgeEnd(graphP theEmbedding, int e) cdef extern from "../c/graphLib/homeomorphSearch/graphK23Search.h": const char *K23SEARCH_NAME int gp_ExtendWith_K23Search(graphP theGraph) int gp_Detach_K23Search(graphP theGraph) cdef extern from "../c/graphLib/homeomorphSearch/graphK33Search.h": const char *K33SEARCH_NAME int gp_ExtendWith_K33Search(graphP theGraph) int gp_Detach_K33Search(graphP theGraph) cdef extern from "../c/graphLib/homeomorphSearch/graphK4Search.h": const char *K4SEARCH_NAME int gp_ExtendWith_K4Search(graphP theGraph) int gp_Detach_K4Search(graphP theGraph) graph-algorithms-planarity-08d7b51/planarity/full/g6IterationUtils.c000066400000000000000000021454671522057144000256670ustar00rootroot00000000000000/* Generated by Cython 3.2.6 */ /* BEGIN: Cython Metadata { "distutils": { "depends": [], "name": "planarity.full.g6IterationUtils", "sources": [ "planarity/full/g6IterationUtils.pyx" ] }, "module_name": "planarity.full.g6IterationUtils" } END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ /* InitLimitedAPI */ #if defined(Py_LIMITED_API) #if !defined(CYTHON_LIMITED_API) #define CYTHON_LIMITED_API 1 #endif #elif defined(CYTHON_LIMITED_API) #ifdef _MSC_VER #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.") #else #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead. #endif #endif #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 < 0x03080000 #error Cython requires Python 3.8+. #else #define __PYX_ABI_VERSION "3_2_6" #define CYTHON_HEX_VERSION 0x030206F0 #define CYTHON_FUTURE_DIVISION 1 /* CModulePreamble */ #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #define __PYX_COMMA , #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX #if defined(GRAALVM_PYTHON) /* For very preliminary testing purposes. Most variables are set the same as PyPy. The existence of this section does not imply that anything works or is even tested */ #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 #define CYTHON_COMPILING_IN_LIMITED_API 0 #define CYTHON_COMPILING_IN_GRAAL 1 #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 #undef CYTHON_USE_TYPE_SPECS #define CYTHON_USE_TYPE_SPECS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 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_AVOID_THREAD_UNSAFE_BORROWED_REFS #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 #undef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 0 #undef CYTHON_ASSUME_SAFE_SIZE #define CYTHON_ASSUME_SAFE_SIZE 0 #undef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_GIL #define CYTHON_FAST_GIL 0 #undef CYTHON_METH_FASTCALL #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #ifndef CYTHON_PEP487_INIT_SUBCLASS #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #undef CYTHON_USE_MODULE_STATE #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_SYS_MONITORING #define CYTHON_USE_SYS_MONITORING 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_AM_SEND #define CYTHON_USE_AM_SEND 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 1 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif #undef CYTHON_USE_FREELISTS #define CYTHON_USE_FREELISTS 0 #undef CYTHON_IMMORTAL_CONSTANTS #define CYTHON_IMMORTAL_CONSTANTS 0 #elif defined(PYPY_VERSION) #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #define CYTHON_COMPILING_IN_LIMITED_API 0 #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #ifndef CYTHON_USE_TYPE_SPECS #define CYTHON_USE_TYPE_SPECS 0 #endif #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 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_AVOID_THREAD_UNSAFE_BORROWED_REFS #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 #undef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 0 #ifndef CYTHON_ASSUME_SAFE_SIZE #define CYTHON_ASSUME_SAFE_SIZE 1 #endif #undef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_GIL #define CYTHON_FAST_GIL 0 #undef CYTHON_METH_FASTCALL #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #ifndef CYTHON_PEP487_INIT_SUBCLASS #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif #if PY_VERSION_HEX < 0x03090000 #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 0 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif #undef CYTHON_USE_MODULE_STATE #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_SYS_MONITORING #define CYTHON_USE_SYS_MONITORING 0 #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00) #endif #undef CYTHON_USE_AM_SEND #define CYTHON_USE_AM_SEND 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100) #endif #undef CYTHON_USE_FREELISTS #define CYTHON_USE_FREELISTS 0 #undef CYTHON_IMMORTAL_CONSTANTS #define CYTHON_IMMORTAL_CONSTANTS 0 #elif defined(CYTHON_LIMITED_API) #ifdef Py_LIMITED_API #undef __PYX_LIMITED_VERSION_HEX #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API #endif #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 #define CYTHON_COMPILING_IN_LIMITED_API 1 #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 #undef CYTHON_USE_TYPE_SPECS #define CYTHON_USE_TYPE_SPECS 1 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #undef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 0 #ifndef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #endif #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_AVOID_THREAD_UNSAFE_BORROWED_REFS #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 #endif #undef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 0 #undef CYTHON_ASSUME_SAFE_SIZE #define CYTHON_ASSUME_SAFE_SIZE 0 #undef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_GIL #define CYTHON_FAST_GIL 0 #undef CYTHON_METH_FASTCALL #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #ifndef CYTHON_PEP487_INIT_SUBCLASS #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif #ifndef CYTHON_USE_MODULE_STATE #define CYTHON_USE_MODULE_STATE 0 #endif #undef CYTHON_USE_SYS_MONITORING #define CYTHON_USE_SYS_MONITORING 0 #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #endif #ifndef CYTHON_USE_AM_SEND #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000) #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif #ifndef CYTHON_USE_FREELISTS #define CYTHON_USE_FREELISTS 1 #endif #undef CYTHON_IMMORTAL_CONSTANTS #define CYTHON_IMMORTAL_CONSTANTS 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #define CYTHON_COMPILING_IN_LIMITED_API 0 #define CYTHON_COMPILING_IN_GRAAL 0 #ifdef Py_GIL_DISABLED #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1 #else #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 #endif #if PY_VERSION_HEX < 0x030A0000 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #elif !defined(CYTHON_USE_TYPE_SLOTS) #define CYTHON_USE_TYPE_SLOTS 1 #endif #ifndef CYTHON_USE_TYPE_SPECS #define CYTHON_USE_TYPE_SPECS 0 #endif #ifndef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #ifndef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #elif !defined(CYTHON_USE_PYLIST_INTERNALS) #define CYTHON_USE_PYLIST_INTERNALS 1 #endif #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) #define CYTHON_USE_UNICODE_WRITER 1 #endif #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS) #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 #endif #ifndef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 1 #endif #ifndef CYTHON_ASSUME_SAFE_SIZE #define CYTHON_ASSUME_SAFE_SIZE 1 #endif #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #undef CYTHON_FAST_GIL #define CYTHON_FAST_GIL 0 #elif !defined(CYTHON_FAST_GIL) #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6) #endif #ifndef CYTHON_METH_FASTCALL #define CYTHON_METH_FASTCALL 1 #endif #ifndef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 1 #endif #ifndef CYTHON_PEP487_INIT_SUBCLASS #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif #ifndef CYTHON_USE_MODULE_STATE #define CYTHON_USE_MODULE_STATE 0 #endif #ifndef CYTHON_USE_SYS_MONITORING #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1) #endif #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 1 #endif #ifndef CYTHON_USE_AM_SEND #define CYTHON_USE_AM_SEND 1 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #elif !defined(CYTHON_USE_DICT_VERSIONS) #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE) #endif #ifndef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 1 #endif #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 #endif #ifndef CYTHON_USE_FREELISTS #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) #endif #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000 #undef CYTHON_IMMORTAL_CONSTANTS #define CYTHON_IMMORTAL_CONSTANTS 0 // definitely won't work #elif !defined(CYTHON_IMMORTAL_CONSTANTS) #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) #endif #endif #ifndef CYTHON_COMPRESS_STRINGS #define CYTHON_COMPRESS_STRINGS 1 #endif #ifndef CYTHON_FAST_PYCCALL #define CYTHON_FAST_PYCCALL CYTHON_FAST_PYCALL #endif #ifndef CYTHON_VECTORCALL #if CYTHON_COMPILING_IN_LIMITED_API #define CYTHON_VECTORCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) #else #define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL) #endif #endif #if CYTHON_USE_PYLONG_INTERNALS #undef SHIFT #undef BASE #undef MASK #ifdef SIZEOF_VOID_P enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; #endif #endif #ifndef __has_attribute #define __has_attribute(x) 0 #endif #ifndef __has_cpp_attribute #define __has_cpp_attribute(x) 0 #endif #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict #else #define CYTHON_RESTRICT #endif #endif #ifndef CYTHON_UNUSED #if defined(__cplusplus) /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 * but leads to warnings with -pedantic, since it is a C++17 feature */ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) #if __has_cpp_attribute(maybe_unused) #define CYTHON_UNUSED [[maybe_unused]] #endif #endif #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_UNUSED_VAR # if defined(__cplusplus) template void CYTHON_UNUSED_VAR( const T& ) { } # else # define CYTHON_UNUSED_VAR(x) (void)(x) # endif #endif #ifndef CYTHON_MAYBE_UNUSED_VAR #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) #endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING # define CYTHON_NCP_UNUSED # else # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif #ifndef CYTHON_USE_CPP_STD_MOVE #if defined(__cplusplus) && (\ __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) #define CYTHON_USE_CPP_STD_MOVE 1 #else #define CYTHON_USE_CPP_STD_MOVE 0 #endif #endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #include typedef uintptr_t __pyx_uintptr_t; #ifndef CYTHON_FALLTHROUGH #if defined(__cplusplus) /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 * but leads to warnings with -pedantic, since it is a C++17 feature */ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) #if __has_cpp_attribute(fallthrough) #define CYTHON_FALLTHROUGH [[fallthrough]] #endif #endif #ifndef CYTHON_FALLTHROUGH #if __has_cpp_attribute(clang::fallthrough) #define CYTHON_FALLTHROUGH [[clang::fallthrough]] #elif __has_cpp_attribute(gnu::fallthrough) #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] #endif #endif #endif #ifndef CYTHON_FALLTHROUGH #if __has_attribute(fallthrough) #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) #else #define CYTHON_FALLTHROUGH #endif #endif #if defined(__clang__) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif #ifndef Py_UNREACHABLE #define Py_UNREACHABLE() assert(0); abort() #endif #ifdef __cplusplus template struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) #else #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) #endif #if CYTHON_COMPILING_IN_PYPY == 1 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x030A0000) #else #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x03090000) #endif #define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) /* CInitCode */ #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 /* PythonCompatibility */ #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_DefaultClassType PyType_Type #if CYTHON_COMPILING_IN_LIMITED_API #ifndef CO_OPTIMIZED static int CO_OPTIMIZED; #endif #ifndef CO_NEWLOCALS static int CO_NEWLOCALS; #endif #ifndef CO_VARARGS static int CO_VARARGS; #endif #ifndef CO_VARKEYWORDS static int CO_VARKEYWORDS; #endif #ifndef CO_ASYNC_GENERATOR static int CO_ASYNC_GENERATOR; #endif #ifndef CO_GENERATOR static int CO_GENERATOR; #endif #ifndef CO_COROUTINE static int CO_COROUTINE; #endif #else #ifndef CO_COROUTINE #define CO_COROUTINE 0x80 #endif #ifndef CO_ASYNC_GENERATOR #define CO_ASYNC_GENERATOR 0x200 #endif #endif static int __Pyx_init_co_variables(void); #if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) #else #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) #endif #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) #define __Pyx_Py_Is(x, y) Py_Is(x, y) #else #define __Pyx_Py_Is(x, y) ((x) == (y)) #endif #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) #else #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) #endif #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) #else #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) #endif #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) #else #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) #endif #define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) #else #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) #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 Py_TPFLAGS_SEQUENCE #define Py_TPFLAGS_SEQUENCE 0 #endif #ifndef Py_TPFLAGS_MAPPING #define Py_TPFLAGS_MAPPING 0 #endif #ifndef Py_TPFLAGS_IMMUTABLETYPE #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8) #endif #ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7) #endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif #ifndef METH_FASTCALL #ifndef METH_FASTCALL #define METH_FASTCALL 0x80 #endif typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames); #else #if PY_VERSION_HEX >= 0x030d00A4 # define __Pyx_PyCFunctionFast PyCFunctionFast # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords #else # define __Pyx_PyCFunctionFast _PyCFunctionFast # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif #endif #if CYTHON_METH_FASTCALL #define __Pyx_METH_FASTCALL METH_FASTCALL #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords #else #define __Pyx_METH_FASTCALL METH_VARARGS #define __Pyx_PyCFunction_FastCall PyCFunction #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords #endif #if CYTHON_VECTORCALL #define __pyx_vectorcallfunc vectorcallfunc #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) #else #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) #endif #if PY_VERSION_HEX >= 0x030900B1 #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func) #else #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func) #endif #define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func) #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth) #elif !CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func) #endif #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags) static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) { return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self; } #endif static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) { #if CYTHON_COMPILING_IN_LIMITED_API return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc; #else return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; #endif } #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc) #if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000) #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); #else #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) #define __Pyx_PyCMethod PyCMethod #endif #ifndef METH_METHOD #define METH_METHOD 0x200 #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_LIMITED_API #define __Pyx_PyFrame_SetLineNumber(frame, lineno) #elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno)) #elif CYTHON_COMPILING_IN_GRAAL #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno)) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif #if CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_PyThreadState_Current PyThreadState_Get() #elif !CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x030d00A1 #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked() #else #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() #endif #if CYTHON_USE_MODULE_STATE static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op) { void *result; result = PyModule_GetState(op); if (!result) Py_FatalError("Couldn't find the module state"); return result; } #define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o) #else #define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global) #endif #define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype) #define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype) #define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype) #define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype) #if CYTHON_USE_TYPE_SLOTS #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype) #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL) #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) #else #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\ ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\ (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\ __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL) #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype) #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype) #endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else #define __Pyx_PyDict_NewPresized(n) PyDict_New() #endif #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS #define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); if (res == NULL) PyErr_Clear(); return res; } #elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000 #define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError #define __Pyx_PyDict_GetItemStr PyDict_GetItem #else static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { #if CYTHON_COMPILING_IN_PYPY return PyDict_GetItem(dict, name); #else PyDictEntry *ep; PyDictObject *mp = (PyDictObject*) dict; long hash = ((PyStringObject *) name)->ob_shash; assert(hash != -1); ep = (mp->ma_lookup)(mp, name, hash); if (ep == NULL) { return NULL; } return ep->me_value; #endif } #define __Pyx_PyDict_GetItemStr PyDict_GetItem #endif #if CYTHON_USE_TYPE_SLOTS #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) #else #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) #endif #define __Pyx_PyObject_GetIterNextFunc(iterator) __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc) #if CYTHON_USE_TYPE_SPECS #define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ PyTypeObject *type = Py_TYPE((PyObject*)obj);\ assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ PyObject_GC_Del(obj);\ Py_DECREF(type);\ } #else #define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) #endif #if CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) #define __Pyx_PyUnicode_DATA(u) ((void*)u) #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) #else #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_READY(op) (0) #else #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) #endif #define __Pyx_PyUnicode_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) ((int)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, (Py_UCS4) ch) #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) #else #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) #endif #endif #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 #if !defined(PyUnicode_DecodeUnicodeEscape) #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) #endif #if !defined(PyUnicode_Contains) #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) #endif #if !defined(PyByteArray_Check) #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) #endif #if !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif #endif #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 #define __Pyx_PySequence_ListKeepNew(obj)\ (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj)) #elif CYTHON_COMPILING_IN_CPYTHON #define __Pyx_PySequence_ListKeepNew(obj)\ (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) #else #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) #endif #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) #else #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) #endif enum __Pyx_ReferenceSharing { __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check __Pyx_ReferenceSharing_OwnStrongReference, __Pyx_ReferenceSharing_FunctionArgument, __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar }; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000 #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\ (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\ (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\ (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0))) #elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1) #else #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0) #endif #if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) #else #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i) #endif #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) #else #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i)) #endif #else #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i)) #endif #if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\ __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i)) #else #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i) #endif #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result) #elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { *result = PyObject_GetItem(dict, key); if (*result == NULL) { if (PyErr_ExceptionMatches(PyExc_KeyError)) { PyErr_Clear(); return 0; } return -1; } return 1; } #else static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { *result = PyDict_GetItemWithError(dict, key); if (*result == NULL) { return PyErr_Occurred() ? -1 : 0; } Py_INCREF(*result); return 1; } #endif #if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST #define __Pyx_VISIT_CONST(obj) Py_VISIT(obj) #else #define __Pyx_VISIT_CONST(obj) #endif #if CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i) #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i) #else #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i) #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i) #endif #if CYTHON_ASSUME_SAFE_SIZE #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o) #else #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString) #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) #endif #define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t #define __Pyx_PyLong_AsHash_t __Pyx_PyIndex_AsSsize_t #if __PYX_LIMITED_VERSION_HEX >= 0x030A0000 #define __Pyx_PySendResult PySendResult #else typedef enum { PYGEN_RETURN = 0, PYGEN_ERROR = -1, PYGEN_NEXT = 1, } __Pyx_PySendResult; #endif #if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3 typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result); #else #define __Pyx_pyiter_sendfunc sendfunc #endif #if !CYTHON_USE_AM_SEND #define __PYX_HAS_PY_AM_SEND 0 #elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000 #define __PYX_HAS_PY_AM_SEND 1 #else #define __PYX_HAS_PY_AM_SEND 2 // our own backported implementation #endif #if __PYX_HAS_PY_AM_SEND < 2 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods #else typedef struct { unaryfunc am_await; unaryfunc am_aiter; unaryfunc am_anext; __Pyx_pyiter_sendfunc am_send; } __Pyx_PyAsyncMethodsStruct; #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s)) #endif #if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0 #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21) #else #define __Pyx_TPFLAGS_HAVE_AM_SEND (0) #endif #if PY_VERSION_HEX >= 0x03090000 #define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get() #else #define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp #endif #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000 #ifdef __cplusplus extern "C" #endif PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); #endif #if CYTHON_COMPILING_IN_LIMITED_API static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) { int value; PyObject *py_value = PyObject_GetAttrString(inspect, name); if (!py_value) return 0; value = (int) PyLong_AsLong(py_value); Py_DECREF(py_value); *write_to = value; return value != -1 || !PyErr_Occurred(); } static int __Pyx_init_co_variables(void) { PyObject *inspect; int result; inspect = PyImport_ImportModule("inspect"); result = #if !defined(CO_OPTIMIZED) __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) && #endif #if !defined(CO_NEWLOCALS) __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) && #endif #if !defined(CO_VARARGS) __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) && #endif #if !defined(CO_VARKEYWORDS) __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) && #endif #if !defined(CO_ASYNC_GENERATOR) __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) && #endif #if !defined(CO_GENERATOR) __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) && #endif #if !defined(CO_COROUTINE) __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) && #endif 1; Py_DECREF(inspect); return result ? 0 : -1; } #else static int __Pyx_init_co_variables(void) { return 0; // It's a limited API-only feature } #endif /* MathInitCode */ #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) #ifndef _USE_MATH_DEFINES #define _USE_MATH_DEFINES #endif #endif #include #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) #define __Pyx_truncl trunc #else #define __Pyx_truncl truncl #endif #ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME #define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0 #endif #ifndef CYTHON_CLINE_IN_TRACEBACK #define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME #endif #if CYTHON_CLINE_IN_TRACEBACK #define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; } #else #define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; } #endif #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } #ifdef CYTHON_EXTERN_C #undef __PYX_EXTERN_C #define __PYX_EXTERN_C CYTHON_EXTERN_C #elif defined(__PYX_EXTERN_C) #ifdef _MSC_VER #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") #else #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. #endif #else #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #define __PYX_HAVE__planarity__full__g6IterationUtils #define __PYX_HAVE_API__planarity__full__g6IterationUtils /* Early includes */ #include #include #include "../c/graphLib/lowLevelUtils/apiutils.h" #include "../c/graphLib/graphLib.h" #include "../c/graphLib/lowLevelUtils/appconst.h" #include "../c/graphLib/graph.h" #include "../c/graphLib/io/graphIO.h" #include "../c/graphLib/io/g6-read-iterator.h" #include "../c/graphLib/io/g6-write-iterator.h" #include "../c/graphLib/graphDFSUtils.h" #include "../c/graphLib/planarityRelated/graphPlanarity.h" #include "../c/graphLib/planarityRelated/graphOuterplanarity.h" #include "../c/graphLib/planarityRelated/graphDrawPlanar.h" #include "../c/graphLib/homeomorphSearch/graphK23Search.h" #include "../c/graphLib/homeomorphSearch/graphK33Search.h" #include "../c/graphLib/homeomorphSearch/graphK4Search.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) #define CYTHON_WITHOUT_ASSERTIONS #endif #ifdef CYTHON_FREETHREADING_COMPATIBLE #if CYTHON_FREETHREADING_COMPATIBLE #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_NOT_USED #else #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED #endif #else #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED #endif #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 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))) ) static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { return (size_t) i < (size_t) limit; } #if defined (__cplusplus) && __cplusplus >= 201103L #include #define __Pyx_sst_abs(value) std::abs(value) #elif SIZEOF_INT >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) abs(value) #elif SIZEOF_LONG >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) labs(value) #elif defined (_MSC_VER) #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define __Pyx_sst_abs(value) llabs(value) #elif defined (__GNUC__) #define __Pyx_sst_abs(value) __builtin_llabs(value) #else #define __Pyx_sst_abs(value) ((value<0) ? -value : value) #endif static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*); #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 CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s) #else #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AsString(s)) #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s) #endif #define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) #define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) { #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef) return Py_NewRef(obj); #else Py_INCREF(obj); return obj; #endif } static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) { #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef) return Py_XNewRef(obj); #else Py_XINCREF(obj); return obj; #endif } static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b); static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x); #define __Pyx_PySequence_Tuple(obj)\ (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t); static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x) #else #define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x) #endif #define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x)) #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) #if CYTHON_USE_PYLONG_INTERNALS #if PY_VERSION_HEX >= 0x030C00A7 #ifndef _PyLong_SIGN_MASK #define _PyLong_SIGN_MASK 3 #endif #ifndef _PyLong_NON_SIZE_BITS #define _PyLong_NON_SIZE_BITS 3 #endif #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) #define __Pyx_PyLong_SignedDigitCount(x)\ ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) #else #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) #endif typedef Py_ssize_t __Pyx_compact_pylong; typedef size_t __Pyx_compact_upylong; #else #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) #define __Pyx_PyLong_CompactValue(x)\ ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) typedef sdigit __Pyx_compact_pylong; typedef digit __Pyx_compact_upylong; #endif #if PY_VERSION_HEX >= 0x030C00A5 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) #else #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) #endif #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) #elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL) #else #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #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__ */ /* PretendToInitialize */ #ifdef __cplusplus #if __cplusplus > 201103L #include #endif template static void __Pyx_pretend_to_initialize(T* ptr) { #if __cplusplus > 201103L if ((std::is_trivially_default_constructible::value)) #endif *ptr = T(); (void)ptr; } #else static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } #endif #if !CYTHON_USE_MODULE_STATE static PyObject *__pyx_m = NULL; #endif static int __pyx_lineno; static int __pyx_clineno = 0; static const char * const __pyx_cfilenm = __FILE__; static const char *__pyx_filename; /* #### Code section: filename_table ### */ static const char* const __pyx_f[] = { "planarity/full/g6IterationUtils.pyx", "", "planarity/full/graph.pxd", }; /* #### Code section: utility_code_proto_before_types ### */ /* Atomics.proto (used by UnpackUnboundCMethod) */ #include #ifndef CYTHON_ATOMICS #define CYTHON_ATOMICS 1 #endif #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS #define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #define __pyx_atomic_int_type int #define __pyx_nonatomic_int_type int #if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ (__STDC_VERSION__ >= 201112L) &&\ !defined(__STDC_NO_ATOMICS__)) #include #elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ (__cplusplus >= 201103L) ||\ (defined(_MSC_VER) && _MSC_VER >= 1700))) #include #endif #if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ (__STDC_VERSION__ >= 201112L) &&\ !defined(__STDC_NO_ATOMICS__) &&\ ATOMIC_INT_LOCK_FREE == 2) #undef __pyx_atomic_int_type #define __pyx_atomic_int_type atomic_int #define __pyx_atomic_ptr_type atomic_uintptr_t #define __pyx_nonatomic_ptr_type uintptr_t #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel) #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg) #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) #define __pyx_atomic_load(value) atomic_load(value) #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value) #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed) #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire) #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) #pragma message ("Using standard C atomics") #elif defined(__PYX_DEBUG_ATOMICS) #warning "Using standard C atomics" #endif #elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ (__cplusplus >= 201103L) ||\ \ (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ ATOMIC_INT_LOCK_FREE == 2) #undef __pyx_atomic_int_type #define __pyx_atomic_int_type std::atomic_int #define __pyx_atomic_ptr_type std::atomic_uintptr_t #define __pyx_nonatomic_ptr_type uintptr_t #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel) #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg) #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) #define __pyx_atomic_load(value) std::atomic_load(value) #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value) #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed) #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire) #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) #pragma message ("Using standard C++ atomics") #elif defined(__PYX_DEBUG_ATOMICS) #warning "Using standard C++ atomics" #endif #elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ (__GNUC_MINOR__ > 1 ||\ (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) #define __pyx_atomic_ptr_type void* #define __pyx_nonatomic_ptr_type void* #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1) #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1) #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1) #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg) static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired); int result = old == *expected; *expected = old; return result; } #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0) #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value) #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0) #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0) #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value) static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired); int result = old == *expected; *expected = old; return result; } #ifdef __PYX_DEBUG_ATOMICS #warning "Using GNU atomics" #endif #elif CYTHON_ATOMICS && defined(_MSC_VER) #include #undef __pyx_atomic_int_type #define __pyx_atomic_int_type long #define __pyx_atomic_ptr_type void* #undef __pyx_nonatomic_int_type #define __pyx_nonatomic_int_type long #define __pyx_nonatomic_ptr_type void* #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer) #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1) #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1) #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1) #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg) static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected); int result = old == *expected; *expected = old; return result; } #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0) #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value) #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0) #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value) static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected); int result = old == *expected; *expected = old; return result; } #ifdef __PYX_DEBUG_ATOMICS #pragma message ("Using MSVC atomics") #endif #else #undef CYTHON_ATOMICS #define CYTHON_ATOMICS 0 #ifdef __PYX_DEBUG_ATOMICS #warning "Not using atomics" #endif #endif /* CriticalSectionsDefinition.proto (used by CriticalSections) */ #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #define __Pyx_PyCriticalSection void* #define __Pyx_PyCriticalSection2 void* #define __Pyx_PyCriticalSection_End(cs) #define __Pyx_PyCriticalSection2_End(cs) #else #define __Pyx_PyCriticalSection PyCriticalSection #define __Pyx_PyCriticalSection2 PyCriticalSection2 #define __Pyx_PyCriticalSection_End PyCriticalSection_End #define __Pyx_PyCriticalSection2_End PyCriticalSection2_End #endif /* CriticalSections.proto (used by ParseKeywordsImpl) */ #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs) #define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs) #else #define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin #define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin #endif #if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_BEGIN_CRITICAL_SECTION(o) { #define __Pyx_END_CRITICAL_SECTION() } #else #define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION #define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION #endif /* IncludeStructmemberH.proto (used by FixUpExtensionType) */ #include /* #### Code section: numeric_typedefs ### */ /* #### Code section: complex_type_declarations ### */ /* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ struct __pyx_obj_9planarity_4full_5graph_Graph; struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator; struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator; /* "graph.pxd":12 * from planarity.full cimport graphLib * * cdef class Graph: # <<<<<<<<<<<<<< * cdef graphLib.graphP _theGraph */ struct __pyx_obj_9planarity_4full_5graph_Graph { PyObject_HEAD graphP _theGraph; }; /* "planarity/full/g6IterationUtils.pyx":17 * * * cdef class G6ReadIterator: # <<<<<<<<<<<<<< * cdef graphLib.G6ReadIteratorP _g6ReadIterator * */ struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator { PyObject_HEAD G6ReadIteratorP _g6ReadIterator; }; /* "planarity/full/g6IterationUtils.pyx":132 * * * cdef class G6WriteIterator: # <<<<<<<<<<<<<< * cdef graphLib.G6WriteIteratorP _g6WriteIterator * cdef char *_outputString */ struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator { PyObject_HEAD G6WriteIteratorP _g6WriteIterator; char *_outputString; }; /* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, Py_ssize_t); void (*DECREF)(void*, PyObject*, Py_ssize_t); void (*GOTREF)(void*, PyObject*, Py_ssize_t); void (*GIVEREF)(void*, PyObject*, Py_ssize_t); void* (*SetupContext)(const char*, Py_ssize_t, 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; #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__));\ } #define __Pyx_RefNannyFinishContextNogil() {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ __Pyx_RefNannyFinishContext();\ PyGILState_Release(__pyx_gilstate_save);\ } #define __Pyx_RefNannyFinishContextNogil() {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ __Pyx_RefNannyFinishContext();\ PyGILState_Release(__pyx_gilstate_save);\ } #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); else {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContextNogil() #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_Py_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; Py_XDECREF(tmp);\ } while (0) #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) /* TupleAndListFromArray.proto (used by fastcall) */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); #endif #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); #endif /* IncludeStringH.proto (used by BytesEquals) */ #include /* BytesEquals.proto (used by UnicodeEquals) */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /* UnicodeEquals.proto (used by fastcall) */ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /* fastcall.proto */ #if CYTHON_AVOID_BORROWED_REFS #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i) #elif CYTHON_ASSUME_SAFE_MACROS #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i)) #else #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i)) #endif #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) #define __Pyx_KwValues_VARARGS(args, nargs) NULL #define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) #define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) #if CYTHON_METH_FASTCALL #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i]) #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds) #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues); #else #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) #endif #else #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS #endif #define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) #if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start) #else #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) #endif /* py_dict_items.proto (used by OwnedDictNext) */ static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); /* CallCFunction.proto (used by CallUnboundCMethod0) */ #define __Pyx_CallCFunction(cfunc, self, args)\ ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args) #define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\ ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs) #define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\ ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs) #define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\ ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames) /* PyObjectCall.proto (used by PyObjectFastCall) */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); #else #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif /* PyObjectCallMethO.proto (used by PyObjectFastCall) */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif /* PyObjectFastCall.proto (used by PyObjectCallOneArg) */ #define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs); /* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); /* PyObjectGetAttrStr.proto (used by UnpackUnboundCMethod) */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif /* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */ typedef struct { PyObject *type; PyObject **method_name; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS __pyx_atomic_int_type initialized; #endif PyCFunction func; PyObject *method; int flag; } __Pyx_CachedCFunction; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) { #if !CYTHON_ATOMICS return 1; #else __pyx_nonatomic_int_type expected = 0; if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) { return 0; } return expected; #endif } static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) { #if CYTHON_ATOMICS __pyx_atomic_store(&cfunc->initialized, 2); #endif } #else #define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2 #define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc) #endif /* CallUnboundCMethod0.proto */ CYTHON_UNUSED static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); #else #define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self) #endif /* py_dict_values.proto (used by OwnedDictNext) */ static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); /* OwnedDictNext.proto (used by ParseKeywordsImpl) */ #if CYTHON_AVOID_BORROWED_REFS static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue); #else CYTHON_INLINE static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue); #endif /* RaiseDoubleKeywords.proto (used by ParseKeywordsImpl) */ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /* ParseKeywordsImpl.export */ static int __Pyx_ParseKeywordsTuple( PyObject *kwds, PyObject * const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs ); static int __Pyx_ParseKeywordDictToDict( PyObject *kwds, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name ); static int __Pyx_ParseKeywordDict( PyObject *kwds, PyObject ** const argnames[], PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs ); /* CallUnboundCMethod2.proto */ CYTHON_UNUSED static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2); #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2); #else #define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) #endif /* ParseKeywords.proto */ static CYTHON_INLINE int __Pyx_ParseKeywords( PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs ); /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /* ArgTypeTestFunc.export */ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); /* ArgTypeTest.proto */ #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ __Pyx__ArgTypeTest(obj, type, name, exact)) /* PyRuntimeError_Check.proto */ #define __Pyx_PyExc_RuntimeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_RuntimeError) /* PyObjectFastCallMethod.proto */ #if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 #define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL) #else static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf); #endif /* GetTopmostException.proto (used by SaveResetException) */ #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); #endif /* PyThreadStateGet.proto (used by SaveResetException) */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; #if PY_VERSION_HEX >= 0x030C00A6 #define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) #else #define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) #endif #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign #define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) #define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() #endif /* SaveResetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); #else #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) #endif /* PyErrExceptionMatches.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); #else #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) #endif /* GetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); #endif /* PyValueError_Check.proto */ #define __Pyx_PyExc_ValueError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ValueError) /* PyErrFetchRestore.proto (used by RaiseException) */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) #else #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) #endif #else #define __Pyx_PyErr_Clear() PyErr_Clear() #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif /* RaiseException.export */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /* SwapException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); #endif /* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); /* GetBuiltinName.proto (used by GetModuleGlobalName) */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); /* PyDictVersioning.proto (used by GetModuleGlobalName) */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ (version_var) = __PYX_GET_DICT_VERSION(dict);\ (cache_var) = (value); #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\ } else {\ (VAR) = __pyx_dict_cached_value = (LOOKUP);\ __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ }\ } static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); #else #define __PYX_GET_DICT_VERSION(dict) (0) #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); #endif /* GetModuleGlobalName.proto */ #if CYTHON_USE_DICT_VERSIONS #define __Pyx_GetModuleGlobalName(var, name) do {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\ (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ } while(0) #define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ PY_UINT64_T __pyx_dict_version;\ PyObject *__pyx_dict_cached_value;\ (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ } while(0) static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); #else #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif /* PyMemoryError_Check.proto */ #define __Pyx_PyExc_MemoryError_Check(obj) __Pyx_TypeCheck(obj, PyExc_MemoryError) /* WriteUnraisableException.proto */ static void __Pyx_WriteUnraisable(const char *name, int clineno, int lineno, const char *filename, int full_traceback, int nogil); /* RejectKeywords.export */ static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); /* pyint_simplify.proto */ static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none); /* PyTypeError_Check.proto */ #define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError) /* PyLongCompare.proto */ static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); /* decode_c_string_utf16.proto (used by decode_c_bytes) */ static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { int byteorder = 0; return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); } static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { int byteorder = -1; return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); } static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { int byteorder = 1; return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); } /* decode_c_bytes.proto (used by decode_bytes) */ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); /* decode_bytes.proto */ static CYTHON_INLINE PyObject* __Pyx_decode_bytes( PyObject* string, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { char* as_c_string; Py_ssize_t size; #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE as_c_string = PyBytes_AS_STRING(string); size = PyBytes_GET_SIZE(string); #else if (PyBytes_AsStringAndSize(string, &as_c_string, &size) < 0) { return NULL; } #endif return __Pyx_decode_c_bytes( as_c_string, size, start, stop, encoding, errors, decode_func); } /* AllocateExtensionType.proto */ static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final); /* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */ #if CYTHON_COMPILING_IN_LIMITED_API static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp); #endif /* SetItemOnTypeDict.proto (used by FixUpExtensionType) */ static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v); #define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v) /* FixUpExtensionType.proto */ static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); /* PyObjectCallNoArg.proto (used by PyObjectCallMethod0) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); /* PyObjectGetMethod.proto (used by PyObjectCallMethod0) */ #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); #endif /* PyObjectCallMethod0.proto (used by PyType_Ready) */ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); /* ValidateBasesTuple.proto (used by PyType_Ready) */ #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); #endif /* PyType_Ready.proto */ CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); /* DelItemOnTypeDict.proto (used by SetupReduce) */ static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k); #define __Pyx_DelItemOnTypeDict(tp, k) __Pyx__DelItemOnTypeDict((PyTypeObject*)tp, k) /* SetupReduce.proto */ static int __Pyx_setup_reduce(PyObject* type_obj); /* TypeImport.proto */ #ifndef __PYX_HAVE_RT_ImportType_proto_3_2_6 #define __PYX_HAVE_RT_ImportType_proto_3_2_6 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #include #endif #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L #define __PYX_GET_STRUCT_ALIGNMENT_3_2_6(s) alignof(s) #else #define __PYX_GET_STRUCT_ALIGNMENT_3_2_6(s) sizeof(void*) #endif enum __Pyx_ImportType_CheckSize_3_2_6 { __Pyx_ImportType_CheckSize_Error_3_2_6 = 0, __Pyx_ImportType_CheckSize_Warn_3_2_6 = 1, __Pyx_ImportType_CheckSize_Ignore_3_2_6 = 2 }; static PyTypeObject *__Pyx_ImportType_3_2_6(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_6 check_size); #endif /* FunctionImport.proto */ static int __Pyx_ImportFunction_3_2_6(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /* HasAttr.proto (used by ImportImpl) */ #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n) #else static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); #endif /* ImportImpl.export */ static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level); /* Import.proto */ static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level); /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /* dict_setdefault.proto (used by FetchCommonType) */ static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value); /* AddModuleRef.proto (used by FetchSharedCythonModule) */ #if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\ __PYX_LIMITED_VERSION_HEX < 0x030d0000) static PyObject *__Pyx_PyImport_AddModuleRef(const char *name); #else #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) #endif /* FetchSharedCythonModule.proto (used by FetchCommonType) */ static PyObject *__Pyx_FetchSharedCythonABIModule(void); /* FetchCommonType.proto (used by CommonTypesMetaclass) */ static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases); /* CommonTypesMetaclass.proto (used by CythonFunctionShared) */ static int __pyx_CommonTypesMetaclass_init(PyObject *module); #define __Pyx_CommonTypesMetaclass_USED /* CallTypeTraverse.proto (used by CythonFunctionShared) */ #if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) #define __Pyx_call_type_traverse(o, always_call, visit, arg) 0 #else static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg); #endif /* PyMethodNew.proto (used by CythonFunctionShared) */ static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ); /* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */ #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); #endif /* CythonFunctionShared.proto (used by CythonFunction) */ #define __Pyx_CyFunction_USED #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 #define __Pyx_CYFUNCTION_CCLASS 0x04 #define __Pyx_CYFUNCTION_COROUTINE 0x08 #define __Pyx_CyFunction_GetClosure(f)\ (((__pyx_CyFunctionObject *) (f))->func_closure) #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_CyFunction_GetClassObj(f)\ (((__pyx_CyFunctionObject *) (f))->func_classobj) #else #define __Pyx_CyFunction_GetClassObj(f)\ ((PyObject*) ((PyCMethodObject *) (f))->mm_class) #endif #define __Pyx_CyFunction_SetClassObj(f, classobj)\ __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) #define __Pyx_CyFunction_Defaults(type, f)\ ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) typedef struct { #if CYTHON_COMPILING_IN_LIMITED_API PyObject_HEAD PyObject *func; #elif PY_VERSION_HEX < 0x030900B1 PyCFunctionObject func; #else PyCMethodObject func; #endif #if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL __pyx_vectorcallfunc func_vectorcall; #endif #if CYTHON_COMPILING_IN_LIMITED_API PyObject *func_weakreflist; #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API PyObject *func_dict; #endif PyObject *func_name; PyObject *func_qualname; PyObject *func_doc; PyObject *func_globals; PyObject *func_code; PyObject *func_closure; #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API PyObject *func_classobj; #endif PyObject *defaults; int flags; PyObject *defaults_tuple; PyObject *defaults_kwdict; PyObject *(*defaults_getter)(PyObject *); PyObject *func_annotations; PyObject *func_is_coroutine; } __pyx_CyFunctionObject; #undef __Pyx_CyOrPyCFunction_Check #define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType) #define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type) #define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType) static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)); #undef __Pyx_IsSameCFunction #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc) static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject *globals, PyObject* code); static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type); static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, PyObject *tuple); static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, PyObject *dict); static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, PyObject *dict); static int __pyx_CyFunction_init(PyObject *module); #if CYTHON_METH_FASTCALL static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); #if CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) #else #define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) #endif #endif /* CythonFunction.proto */ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject *globals, PyObject* code); /* CLineInTraceback.proto (used by AddTraceback) */ #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #else #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) #endif /* CodeObjectCache.proto (used by AddTraceback) */ #if CYTHON_COMPILING_IN_LIMITED_API typedef PyObject __Pyx_CachedCodeObjectType; #else typedef PyCodeObject __Pyx_CachedCodeObjectType; #endif typedef struct { __Pyx_CachedCodeObjectType* code_object; int code_line; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_atomic_int_type accessor_count; #endif }; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object); /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* GCCDiagnostics.proto */ #if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) #define __Pyx_HAS_GCC_DIAGNOSTIC #endif /* PyObjectVectorCallKwBuilder.proto (used by CIntToPy) */ CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); #if CYTHON_VECTORCALL #if PY_VERSION_HEX >= 0x03090000 #define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall #else #define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall #endif #define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n) static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n); #else #define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict #define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n) #define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value) #define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value) #endif /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value); /* FormatTypeName.proto */ #if CYTHON_COMPILING_IN_LIMITED_API typedef PyObject *__Pyx_TypeName; #define __Pyx_FMT_TYPENAME "%U" #define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName #else static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp); #endif #else // !LIMITED_API typedef const char *__Pyx_TypeName; #define __Pyx_FMT_TYPENAME "%.200s" #define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name) #define __Pyx_DECREF_TypeName(obj) #endif /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); /* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) { return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2); } #endif #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) #ifdef PyExceptionInstance_Check #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj) #else #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException) #endif /* GetRuntimeVersion.proto */ #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 static unsigned long __Pyx_cached_runtime_version = 0; static void __Pyx_init_runtime_version(void); #else #define __Pyx_init_runtime_version() #endif static unsigned long __Pyx_get_runtime_version(void); /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); /* DecompressString.proto */ static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo); /* MultiPhaseInitModuleState.proto */ #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE static PyObject *__Pyx_State_FindModule(void*); static int __Pyx_State_AddModule(PyObject* module, void*); static int __Pyx_State_RemoveModule(void*); #elif CYTHON_USE_MODULE_STATE #define __Pyx_State_FindModule PyState_FindModule #define __Pyx_State_AddModule PyState_AddModule #define __Pyx_State_RemoveModule PyState_RemoveModule #endif /* #### Code section: module_declarations ### */ /* CythonABIVersion.proto */ #if CYTHON_COMPILING_IN_LIMITED_API #if CYTHON_METH_FASTCALL #define __PYX_FASTCALL_ABI_SUFFIX "_fastcall" #else #define __PYX_FASTCALL_ABI_SUFFIX #endif #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX #else #define __PYX_LIMITED_ABI_SUFFIX #endif #if __PYX_HAS_PY_AM_SEND == 1 #define __PYX_AM_SEND_ABI_SUFFIX #elif __PYX_HAS_PY_AM_SEND == 2 #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport" #else #define __PYX_AM_SEND_ABI_SUFFIX "noamsend" #endif #ifndef __PYX_MONITORING_ABI_SUFFIX #define __PYX_MONITORING_ABI_SUFFIX #endif #if CYTHON_USE_TP_FINALIZE #define __PYX_TP_FINALIZE_ABI_SUFFIX #else #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize" #endif #if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED) #define __PYX_FREELISTS_ABI_SUFFIX #else #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists" #endif #define CYTHON_ABI __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." /* Module declarations from "libc.string" */ /* Module declarations from "libc.stdlib" */ /* Module declarations from "planarity.full" */ /* Module declarations from "planarity.full.cgraphLib" */ /* Module declarations from "planarity.full.graphLib" */ static int (*__pyx_f_9planarity_4full_8graphLib_g6_NewReader)(G6ReadIteratorP *, graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_g6_InitReaderWithString)(G6ReadIteratorP, char *); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_g6_InitReaderWithFileName)(G6ReadIteratorP, char *); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_g6_ReadGraph)(G6ReadIteratorP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_g6_EndReached)(G6ReadIteratorP); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_g6_FreeReader)(G6ReadIteratorP *); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_g6_NewWriter)(G6WriteIteratorP *, graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_g6_InitWriterWithString)(G6WriteIteratorP, char **); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_g6_InitWriterWithFileName)(G6WriteIteratorP, char *); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_g6_WriteGraph)(G6WriteIteratorP); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_g6_FreeWriter)(G6WriteIteratorP *); /*proto*/ /* Module declarations from "planarity.full.graph" */ /* Module declarations from "planarity.full.g6IterationUtils" */ /* #### Code section: typeinfo ### */ /* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "planarity.full.g6IterationUtils" extern int __pyx_module_is_main_planarity__full__g6IterationUtils; int __pyx_module_is_main_planarity__full__g6IterationUtils = 0; /* Implementation of "planarity.full.g6IterationUtils" */ /* #### Code section: global_var ### */ /* #### Code section: string_decls ### */ static const char __pyx_k_Cython_wrapper_for_the_Edge_Add[] = "\nCython wrapper for the Edge Addition Planarity Suite Graph Library\n\nWraps structs pertaining to G6 file iteration using a Cython class and wraps\npertinent functions and macros.\n"; /* #### Code section: decls ### */ static int __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator___cinit__(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_curr_graph); /* proto */ static void __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_2__dealloc__(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_4g6_InitReaderWithString(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self, PyObject *__pyx_v_inputString); /* proto */ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_6g6_InitReaderWithFileName(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self, PyObject *__pyx_v_infileName); /* proto */ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_8g6_ReadGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_10g6_EndReached(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_12g6_FreeReader(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static int __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator___cinit__(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_graph_to_write); /* proto */ static void __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_2__dealloc__(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_4g6_InitWriterWithString(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_6g6_InitWriterWithFileName(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self, PyObject *__pyx_v_outfileName); /* proto */ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_8g6_WriteGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_10g6_FreeWriter(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_12__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_14__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_tp_new_9planarity_4full_16g6IterationUtils_G6ReadIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_9planarity_4full_16g6IterationUtils_G6WriteIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ /* #### Code section: late_includes ### */ /* #### Code section: module_state ### */ /* SmallCodeConfig */ #ifndef CYTHON_SMALL_CODE #if defined(__clang__) #define CYTHON_SMALL_CODE #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) #define CYTHON_SMALL_CODE __attribute__((cold)) #else #define CYTHON_SMALL_CODE #endif #endif typedef struct { PyObject *__pyx_d; PyObject *__pyx_b; PyObject *__pyx_cython_runtime; PyObject *__pyx_empty_tuple; PyObject *__pyx_empty_bytes; PyObject *__pyx_empty_unicode; PyTypeObject *__pyx_ptype_9planarity_4full_5graph_Graph; PyObject *__pyx_type_9planarity_4full_16g6IterationUtils_G6ReadIterator; PyObject *__pyx_type_9planarity_4full_16g6IterationUtils_G6WriteIterator; PyTypeObject *__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator; PyTypeObject *__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; PyObject *__pyx_codeobj_tab[13]; PyObject *__pyx_string_tab[105]; PyObject *__pyx_number_tab[1]; /* #### Code section: module_state_contents ### */ /* CommonTypesMetaclass.module_state_decls */ PyTypeObject *__pyx_CommonTypesMetaclassType; /* CachedMethodType.module_state_decls */ #if CYTHON_COMPILING_IN_LIMITED_API PyObject *__Pyx_CachedMethodType; #endif /* CythonFunctionShared.module_state_decls */ PyTypeObject *__pyx_CyFunctionType; /* CodeObjectCache.module_state_decls */ struct __Pyx_CodeObjectCache __pyx_code_cache; /* #### Code section: module_state_end ### */ } __pyx_mstatetype; #if CYTHON_USE_MODULE_STATE #ifdef __cplusplus namespace { extern struct PyModuleDef __pyx_moduledef; } /* anonymous namespace */ #else static struct PyModuleDef __pyx_moduledef; #endif #define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef))) #define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef)) #else static __pyx_mstatetype __pyx_mstate_global_static = #ifdef __cplusplus {}; #else {0}; #endif static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static; #endif /* #### Code section: constant_name_defines ### */ #define __pyx_kp_u_ __pyx_string_tab[0] #define __pyx_kp_u_Failed_to_convert_C_string_to_Py __pyx_string_tab[1] #define __pyx_kp_u_G6ReadIterator_s_underlying_g6Re __pyx_string_tab[2] #define __pyx_kp_u_G6WriteIterator_s_underlying_g6W __pyx_string_tab[3] #define __pyx_kp_u_G6WriteIterator_was_initialized __pyx_string_tab[4] #define __pyx_kp_u_Graph_to_populate_is_not_allocat __pyx_string_tab[5] #define __pyx_kp_u_Graph_to_write_is_not_allocated __pyx_string_tab[6] #define __pyx_kp_u_Graph_to_write_is_not_initialize __pyx_string_tab[7] #define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[8] #define __pyx_kp_u_Unable_to_initialize_G6ReadItera __pyx_string_tab[9] #define __pyx_kp_u_Unable_to_initialize_G6WriteIter __pyx_string_tab[10] #define __pyx_kp_u_Unable_to_initialize_reader_with __pyx_string_tab[11] #define __pyx_kp_u_Unable_to_initialize_reader_with_2 __pyx_string_tab[12] #define __pyx_kp_u_Unable_to_initialize_writer_with __pyx_string_tab[13] #define __pyx_kp_u_Unable_to_initialize_writer_with_2 __pyx_string_tab[14] #define __pyx_kp_u_Unable_to_read_graph_as_g6_ReadG __pyx_string_tab[15] #define __pyx_kp_u_Unable_to_write_graph_as_g6_Writ __pyx_string_tab[16] #define __pyx_kp_u__2 __pyx_string_tab[17] #define __pyx_kp_u_add_note __pyx_string_tab[18] #define __pyx_kp_u_disable __pyx_string_tab[19] #define __pyx_kp_u_enable __pyx_string_tab[20] #define __pyx_kp_u_gc __pyx_string_tab[21] #define __pyx_kp_u_isenabled __pyx_string_tab[22] #define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[23] #define __pyx_kp_u_planarity_full_g6IterationUtils_2 __pyx_string_tab[24] #define __pyx_kp_u_str_None __pyx_string_tab[25] #define __pyx_kp_u_stringsource __pyx_string_tab[26] #define __pyx_n_u_G6ReadIterator __pyx_string_tab[27] #define __pyx_n_u_G6ReadIterator___reduce_cython __pyx_string_tab[28] #define __pyx_n_u_G6ReadIterator___setstate_cython __pyx_string_tab[29] #define __pyx_n_u_G6ReadIterator_g6_EndReached __pyx_string_tab[30] #define __pyx_n_u_G6ReadIterator_g6_FreeReader __pyx_string_tab[31] #define __pyx_n_u_G6ReadIterator_g6_InitReaderWith __pyx_string_tab[32] #define __pyx_n_u_G6ReadIterator_g6_InitReaderWith_2 __pyx_string_tab[33] #define __pyx_n_u_G6ReadIterator_g6_ReadGraph __pyx_string_tab[34] #define __pyx_n_u_G6WriteIterator __pyx_string_tab[35] #define __pyx_n_u_G6WriteIterator___reduce_cython __pyx_string_tab[36] #define __pyx_n_u_G6WriteIterator___setstate_cytho __pyx_string_tab[37] #define __pyx_n_u_G6WriteIterator_g6_FreeWriter __pyx_string_tab[38] #define __pyx_n_u_G6WriteIterator_g6_InitWriterWit __pyx_string_tab[39] #define __pyx_n_u_G6WriteIterator_g6_InitWriterWit_2 __pyx_string_tab[40] #define __pyx_n_u_G6WriteIterator_g6_WriteGraph __pyx_string_tab[41] #define __pyx_n_u_None __pyx_string_tab[42] #define __pyx_n_u_OK __pyx_string_tab[43] #define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[44] #define __pyx_n_u_asyncio_coroutines __pyx_string_tab[45] #define __pyx_n_u_cline_in_traceback __pyx_string_tab[46] #define __pyx_n_u_curr_graph __pyx_string_tab[47] #define __pyx_n_u_encoded __pyx_string_tab[48] #define __pyx_n_u_encodedInfileName __pyx_string_tab[49] #define __pyx_n_u_encodedInputString __pyx_string_tab[50] #define __pyx_n_u_encodedOutputFileName __pyx_string_tab[51] #define __pyx_n_u_func __pyx_string_tab[52] #define __pyx_n_u_g6_EndReached __pyx_string_tab[53] #define __pyx_n_u_g6_FreeReader __pyx_string_tab[54] #define __pyx_n_u_g6_FreeWriter __pyx_string_tab[55] #define __pyx_n_u_g6_InitReaderWithFileName __pyx_string_tab[56] #define __pyx_n_u_g6_InitReaderWithString __pyx_string_tab[57] #define __pyx_n_u_g6_InitWriterWithFileName __pyx_string_tab[58] #define __pyx_n_u_g6_InitWriterWithString __pyx_string_tab[59] #define __pyx_n_u_g6_ReadGraph __pyx_string_tab[60] #define __pyx_n_u_g6_WriteGraph __pyx_string_tab[61] #define __pyx_n_u_getstate __pyx_string_tab[62] #define __pyx_n_u_gp_GetN __pyx_string_tab[63] #define __pyx_n_u_graphLib __pyx_string_tab[64] #define __pyx_n_u_graph_to_write __pyx_string_tab[65] #define __pyx_n_u_infileName __pyx_string_tab[66] #define __pyx_n_u_inputString __pyx_string_tab[67] #define __pyx_n_u_int __pyx_string_tab[68] #define __pyx_n_u_is_coroutine __pyx_string_tab[69] #define __pyx_n_u_items __pyx_string_tab[70] #define __pyx_n_u_main __pyx_string_tab[71] #define __pyx_n_u_module __pyx_string_tab[72] #define __pyx_n_u_name __pyx_string_tab[73] #define __pyx_n_u_outfileName __pyx_string_tab[74] #define __pyx_n_u_output_bytes __pyx_string_tab[75] #define __pyx_n_u_planarity_full __pyx_string_tab[76] #define __pyx_n_u_planarity_full_g6IterationUtils __pyx_string_tab[77] #define __pyx_n_u_pop __pyx_string_tab[78] #define __pyx_n_u_pyx_state __pyx_string_tab[79] #define __pyx_n_u_qualname __pyx_string_tab[80] #define __pyx_n_u_reduce __pyx_string_tab[81] #define __pyx_n_u_reduce_cython __pyx_string_tab[82] #define __pyx_n_u_reduce_ex __pyx_string_tab[83] #define __pyx_n_u_result __pyx_string_tab[84] #define __pyx_n_u_return __pyx_string_tab[85] #define __pyx_n_u_self __pyx_string_tab[86] #define __pyx_n_u_set_name __pyx_string_tab[87] #define __pyx_n_u_setdefault __pyx_string_tab[88] #define __pyx_n_u_setstate __pyx_string_tab[89] #define __pyx_n_u_setstate_cython __pyx_string_tab[90] #define __pyx_n_u_string_conversion_error __pyx_string_tab[91] #define __pyx_n_u_test __pyx_string_tab[92] #define __pyx_n_u_values __pyx_string_tab[93] #define __pyx_kp_b_int_G6ReadIteratorP_graphP_int_G __pyx_string_tab[94] #define __pyx_kp_b_iso88591_1_6I_4q_7_XQ_a __pyx_string_tab[95] #define __pyx_kp_b_iso88591_1_Zwaq_Q_31D8J_7_XQ_a __pyx_string_tab[96] #define __pyx_kp_b_iso88591_A_q_1_31D8K1_7_XQ_a __pyx_string_tab[97] #define __pyx_kp_b_iso88591_Q __pyx_string_tab[98] #define __pyx_kp_b_iso88591_a_at1_7_XQ_a __pyx_string_tab[99] #define __pyx_kp_b_iso88591_q_4_1_a_aq_A __pyx_string_tab[100] #define __pyx_kp_b_iso88591_q_4_A_a_aq_A_4_c_4_Q_Q_7_1_l __pyx_string_tab[101] #define __pyx_kp_b_iso88591_q_Qd __pyx_string_tab[102] #define __pyx_kp_b_iso88591_q_a_1_6H_7_XQ_a __pyx_string_tab[103] #define __pyx_kp_b_iso88591_q_q_A_7_XQ_a __pyx_string_tab[104] #define __pyx_int_0 __pyx_number_tab[0] /* #### Code section: module_state_clear ### */ #if CYTHON_USE_MODULE_STATE static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m); if (!clear_module_state) return 0; Py_CLEAR(clear_module_state->__pyx_d); Py_CLEAR(clear_module_state->__pyx_b); Py_CLEAR(clear_module_state->__pyx_cython_runtime); Py_CLEAR(clear_module_state->__pyx_empty_tuple); Py_CLEAR(clear_module_state->__pyx_empty_bytes); Py_CLEAR(clear_module_state->__pyx_empty_unicode); #if CYTHON_PEP489_MULTI_PHASE_INIT __Pyx_State_RemoveModule(NULL); #endif Py_CLEAR(clear_module_state->__pyx_ptype_9planarity_4full_5graph_Graph); Py_CLEAR(clear_module_state->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator); Py_CLEAR(clear_module_state->__pyx_type_9planarity_4full_16g6IterationUtils_G6ReadIterator); Py_CLEAR(clear_module_state->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator); Py_CLEAR(clear_module_state->__pyx_type_9planarity_4full_16g6IterationUtils_G6WriteIterator); for (int i=0; i<13; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } for (int i=0; i<105; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); } /* #### Code section: module_state_clear_contents ### */ /* CommonTypesMetaclass.module_state_clear */ Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType); /* CythonFunctionShared.module_state_clear */ Py_CLEAR(clear_module_state->__pyx_CyFunctionType); /* #### Code section: module_state_clear_end ### */ return 0; } #endif /* #### Code section: module_state_traverse ### */ #if CYTHON_USE_MODULE_STATE static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m); if (!traverse_module_state) return 0; Py_VISIT(traverse_module_state->__pyx_d); Py_VISIT(traverse_module_state->__pyx_b); Py_VISIT(traverse_module_state->__pyx_cython_runtime); __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple); __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes); __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode); Py_VISIT(traverse_module_state->__pyx_ptype_9planarity_4full_5graph_Graph); Py_VISIT(traverse_module_state->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator); Py_VISIT(traverse_module_state->__pyx_type_9planarity_4full_16g6IterationUtils_G6ReadIterator); Py_VISIT(traverse_module_state->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator); Py_VISIT(traverse_module_state->__pyx_type_9planarity_4full_16g6IterationUtils_G6WriteIterator); for (int i=0; i<13; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } for (int i=0; i<105; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); } /* #### Code section: module_state_traverse_contents ### */ /* CommonTypesMetaclass.module_state_traverse */ Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType); /* CythonFunctionShared.module_state_traverse */ Py_VISIT(traverse_module_state->__pyx_CyFunctionType); /* #### Code section: module_state_traverse_end ### */ return 0; } #endif /* #### Code section: module_code ### */ /* "planarity/full/g6IterationUtils.pyx":20 * cdef graphLib.G6ReadIteratorP _g6ReadIterator * * def __cinit__(self, curr_graph: graph.Graph): # <<<<<<<<<<<<<< * """Allocates the underlying G6 read iterator with g6_NewReader(). * */ /* Python wrapper */ static int __pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_curr_graph = 0; CYTHON_UNUSED Py_ssize_t __pyx_nargs; CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; #endif __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_curr_graph,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 20, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 20, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 20, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(0, 20, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 20, __pyx_L3_error) } __pyx_v_curr_graph = ((struct __pyx_obj_9planarity_4full_5graph_Graph *)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 20, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_curr_graph), __pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, 0, "curr_graph", 0))) __PYX_ERR(0, 20, __pyx_L1_error) __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator___cinit__(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *)__pyx_v_self), __pyx_v_curr_graph); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } goto __pyx_L7_cleaned_up; __pyx_L0:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __pyx_L7_cleaned_up:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator___cinit__(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_curr_graph) { PyObject *__pyx_v_invalid_graph_error = NULL; int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; size_t __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; int __pyx_t_11; char const *__pyx_t_12; PyObject *__pyx_t_13 = NULL; PyObject *__pyx_t_14 = NULL; PyObject *__pyx_t_15 = NULL; PyObject *__pyx_t_16 = NULL; PyObject *__pyx_t_17 = NULL; PyObject *__pyx_t_18 = NULL; int __pyx_t_19; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); /* "planarity/full/g6IterationUtils.pyx":31 * ValueError if curr_graph does not contain an allocated graph. * """ * try: # <<<<<<<<<<<<<< * curr_graph.gp_GetN() * except RuntimeError as invalid_graph_error: */ { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); __Pyx_XGOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { /* "planarity/full/g6IterationUtils.pyx":32 * """ * try: * curr_graph.gp_GetN() # <<<<<<<<<<<<<< * except RuntimeError as invalid_graph_error: * raise ValueError( */ __pyx_t_5 = ((PyObject *)__pyx_v_curr_graph); __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_GetN, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/g6IterationUtils.pyx":31 * ValueError if curr_graph does not contain an allocated graph. * """ * try: # <<<<<<<<<<<<<< * curr_graph.gp_GetN() * except RuntimeError as invalid_graph_error: */ } __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L8_try_end; __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; /* "planarity/full/g6IterationUtils.pyx":33 * try: * curr_graph.gp_GetN() * except RuntimeError as invalid_graph_error: # <<<<<<<<<<<<<< * raise ValueError( * "Graph to populate is not allocated." */ __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_RuntimeError)))); if (__pyx_t_7) { __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_8) < 0) __PYX_ERR(0, 33, __pyx_L5_except_error) __Pyx_XGOTREF(__pyx_t_4); __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_v_invalid_graph_error = __pyx_t_5; /*try:*/ { /* "planarity/full/g6IterationUtils.pyx":34 * curr_graph.gp_GetN() * except RuntimeError as invalid_graph_error: * raise ValueError( # <<<<<<<<<<<<<< * "Graph to populate is not allocated." * ) from invalid_graph_error */ __pyx_t_10 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_Graph_to_populate_is_not_allocat}; __pyx_t_9 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 34, __pyx_L14_error) __Pyx_GOTREF(__pyx_t_9); } /* "planarity/full/g6IterationUtils.pyx":36 * raise ValueError( * "Graph to populate is not allocated." * ) from invalid_graph_error # <<<<<<<<<<<<<< * * self._g6ReadIterator = NULL */ __Pyx_Raise(__pyx_t_9, 0, 0, __pyx_v_invalid_graph_error); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __PYX_ERR(0, 34, __pyx_L14_error) } /* "planarity/full/g6IterationUtils.pyx":33 * try: * curr_graph.gp_GetN() * except RuntimeError as invalid_graph_error: # <<<<<<<<<<<<<< * raise ValueError( * "Graph to populate is not allocated." */ /*finally:*/ { __pyx_L14_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18); if ( unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15); __Pyx_XGOTREF(__pyx_t_13); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); __pyx_t_7 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename; { __Pyx_DECREF(__pyx_v_invalid_graph_error); __pyx_v_invalid_graph_error = 0; } __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_ErrRestore(__pyx_t_13, __pyx_t_14, __pyx_t_15); __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12; goto __pyx_L5_except_error; } } } goto __pyx_L5_except_error; /* "planarity/full/g6IterationUtils.pyx":31 * ValueError if curr_graph does not contain an allocated graph. * """ * try: # <<<<<<<<<<<<<< * curr_graph.gp_GetN() * except RuntimeError as invalid_graph_error: */ __pyx_L5_except_error:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; __pyx_L8_try_end:; } /* "planarity/full/g6IterationUtils.pyx":38 * ) from invalid_graph_error * * self._g6ReadIterator = NULL # <<<<<<<<<<<<<< * * if graphLib.g6_NewReader(&self._g6ReadIterator, curr_graph._theGraph) != graphLib.OK: */ __pyx_v_self->_g6ReadIterator = NULL; /* "planarity/full/g6IterationUtils.pyx":40 * self._g6ReadIterator = NULL * * if graphLib.g6_NewReader(&self._g6ReadIterator, curr_graph._theGraph) != graphLib.OK: # <<<<<<<<<<<<<< * raise MemoryError( * "Unable to initialize G6ReadIterator, as call to " */ __pyx_t_11 = __pyx_f_9planarity_4full_8graphLib_g6_NewReader((&__pyx_v_self->_g6ReadIterator), __pyx_v_curr_graph->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 40, __pyx_L1_error) __pyx_t_8 = __Pyx_PyLong_From_int(__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_RichCompare(__pyx_t_8, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_19 < 0))) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(__pyx_t_19)) { /* "planarity/full/g6IterationUtils.pyx":41 * * if graphLib.g6_NewReader(&self._g6ReadIterator, curr_graph._theGraph) != graphLib.OK: * raise MemoryError( # <<<<<<<<<<<<<< * "Unable to initialize G6ReadIterator, as call to " * "g6_NewReader() in EAPS graphLib failed." */ __pyx_t_4 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Unable_to_initialize_G6ReadItera}; __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 41, __pyx_L1_error) /* "planarity/full/g6IterationUtils.pyx":40 * self._g6ReadIterator = NULL * * if graphLib.g6_NewReader(&self._g6ReadIterator, curr_graph._theGraph) != graphLib.OK: # <<<<<<<<<<<<<< * raise MemoryError( * "Unable to initialize G6ReadIterator, as call to " */ } /* "planarity/full/g6IterationUtils.pyx":20 * cdef graphLib.G6ReadIteratorP _g6ReadIterator * * def __cinit__(self, curr_graph: graph.Graph): # <<<<<<<<<<<<<< * """Allocates the underlying G6 read iterator with g6_NewReader(). * */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_invalid_graph_error); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/g6IterationUtils.pyx":46 * ) * * def __dealloc__(self): # <<<<<<<<<<<<<< * """Frees the underlying G6 read iterator with g6_FreeReader().""" * if self._g6ReadIterator != NULL: */ /* Python wrapper */ static void __pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_3__dealloc__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_2__dealloc__(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_2__dealloc__(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self) { int __pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* "planarity/full/g6IterationUtils.pyx":48 * def __dealloc__(self): * """Frees the underlying G6 read iterator with g6_FreeReader().""" * if self._g6ReadIterator != NULL: # <<<<<<<<<<<<<< * # NOTE: g6_FreeReader() NULLs out the pointer to currGraph on * # the C layer, so that Python will be free to clean up the */ __pyx_t_1 = (__pyx_v_self->_g6ReadIterator != NULL); if (__pyx_t_1) { /* "planarity/full/g6IterationUtils.pyx":54 * # by the calling code. At that point, the graphP will also be * # cleaned up with gp_Free(). * graphLib.g6_FreeReader(&self._g6ReadIterator) # <<<<<<<<<<<<<< * * def g6_InitReaderWithString(self, str inputString) -> None: */ __pyx_f_9planarity_4full_8graphLib_g6_FreeReader((&__pyx_v_self->_g6ReadIterator)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L1_error) /* "planarity/full/g6IterationUtils.pyx":48 * def __dealloc__(self): * """Frees the underlying G6 read iterator with g6_FreeReader().""" * if self._g6ReadIterator != NULL: # <<<<<<<<<<<<<< * # NOTE: g6_FreeReader() NULLs out the pointer to currGraph on * # the C layer, so that Python will be free to clean up the */ } /* "planarity/full/g6IterationUtils.pyx":46 * ) * * def __dealloc__(self): # <<<<<<<<<<<<<< * """Frees the underlying G6 read iterator with g6_FreeReader().""" * if self._g6ReadIterator != NULL: */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_WriteUnraisable("planarity.full.g6IterationUtils.G6ReadIterator.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; } /* "planarity/full/g6IterationUtils.pyx":56 * graphLib.g6_FreeReader(&self._g6ReadIterator) * * def g6_InitReaderWithString(self, str inputString) -> None: # <<<<<<<<<<<<<< * """Initializes the G6 read iterator with a string to use as the * input sourceof G6-encoded graphs. */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_5g6_InitReaderWithString(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_4g6_InitReaderWithString, "G6ReadIterator.g6_InitReaderWithString(self, str inputString) -> None\n\nInitializes the G6 read iterator with a string to use as the \ninput sourceof G6-encoded graphs.\n\nArgs:\n inputString: the string to use as the input source\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_5g6_InitReaderWithString = {"g6_InitReaderWithString", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_5g6_InitReaderWithString, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_4g6_InitReaderWithString}; static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_5g6_InitReaderWithString(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_inputString = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("g6_InitReaderWithString (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_inputString,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 56, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 56, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "g6_InitReaderWithString", 0) < (0)) __PYX_ERR(0, 56, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("g6_InitReaderWithString", 1, 1, 1, i); __PYX_ERR(0, 56, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 56, __pyx_L3_error) } __pyx_v_inputString = ((PyObject*)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("g6_InitReaderWithString", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 56, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.g6_InitReaderWithString", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_inputString), (&PyUnicode_Type), 1, "inputString", 1))) __PYX_ERR(0, 56, __pyx_L1_error) __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_4g6_InitReaderWithString(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *)__pyx_v_self), __pyx_v_inputString); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } goto __pyx_L7_cleaned_up; __pyx_L0:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __pyx_L7_cleaned_up:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_4g6_InitReaderWithString(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self, PyObject *__pyx_v_inputString) { PyObject *__pyx_v_encoded = 0; char const *__pyx_v_encodedInputString; int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; char const *__pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; size_t __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("g6_InitReaderWithString", 0); /* "planarity/full/g6IterationUtils.pyx":66 * RuntimeError if C graphlib version of this function failed. * """ * cdef bytes encoded = inputString.encode('utf-8') # <<<<<<<<<<<<<< * cdef const char *encodedInputString = encoded * */ if (unlikely(__pyx_v_inputString == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 66, __pyx_L1_error) } __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_inputString); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_encoded = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "planarity/full/g6IterationUtils.pyx":67 * """ * cdef bytes encoded = inputString.encode('utf-8') * cdef const char *encodedInputString = encoded # <<<<<<<<<<<<<< * * result = graphLib.g6_InitReaderWithString(self._g6ReadIterator, encodedInputString) */ __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_encoded); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 67, __pyx_L1_error) __pyx_v_encodedInputString = __pyx_t_2; /* "planarity/full/g6IterationUtils.pyx":69 * cdef const char *encodedInputString = encoded * * result = graphLib.g6_InitReaderWithString(self._g6ReadIterator, encodedInputString) # <<<<<<<<<<<<<< * if result != graphLib.OK: * raise RuntimeError( */ __pyx_t_3 = __pyx_f_9planarity_4full_8graphLib_g6_InitReaderWithString(__pyx_v_self->_g6ReadIterator, __pyx_v_encodedInputString); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L1_error) __pyx_v_result = __pyx_t_3; /* "planarity/full/g6IterationUtils.pyx":70 * * result = graphLib.g6_InitReaderWithString(self._g6ReadIterator, encodedInputString) * if result != graphLib.OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Unable to initialize reader with inputString, as " */ __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_6)) { /* "planarity/full/g6IterationUtils.pyx":71 * result = graphLib.g6_InitReaderWithString(self._g6ReadIterator, encodedInputString) * if result != graphLib.OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "Unable to initialize reader with inputString, as " * "g6_InitReaderWithString() in EAPS graphLib failed." */ __pyx_t_5 = NULL; __pyx_t_7 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Unable_to_initialize_reader_with}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 71, __pyx_L1_error) /* "planarity/full/g6IterationUtils.pyx":70 * * result = graphLib.g6_InitReaderWithString(self._g6ReadIterator, encodedInputString) * if result != graphLib.OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Unable to initialize reader with inputString, as " */ } /* "planarity/full/g6IterationUtils.pyx":56 * graphLib.g6_FreeReader(&self._g6ReadIterator) * * def g6_InitReaderWithString(self, str inputString) -> None: # <<<<<<<<<<<<<< * """Initializes the G6 read iterator with a string to use as the * input sourceof G6-encoded graphs. */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.g6_InitReaderWithString", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_encoded); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/g6IterationUtils.pyx":76 * ) * * def g6_InitReaderWithFileName(self, str infileName) -> None: # <<<<<<<<<<<<<< * """Initializes the G6 read iterator with the name of a file to use as the * input source of G6-encoded graphs. */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_7g6_InitReaderWithFileName(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_6g6_InitReaderWithFileName, "G6ReadIterator.g6_InitReaderWithFileName(self, str infileName) -> None\n\nInitializes the G6 read iterator with the name of a file to use as the \ninput source of G6-encoded graphs.\n\nArgs:\n infileName: a string containing the name of the file to use as the input source\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_7g6_InitReaderWithFileName = {"g6_InitReaderWithFileName", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_7g6_InitReaderWithFileName, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_6g6_InitReaderWithFileName}; static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_7g6_InitReaderWithFileName(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_infileName = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("g6_InitReaderWithFileName (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_infileName,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 76, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 76, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "g6_InitReaderWithFileName", 0) < (0)) __PYX_ERR(0, 76, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("g6_InitReaderWithFileName", 1, 1, 1, i); __PYX_ERR(0, 76, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 76, __pyx_L3_error) } __pyx_v_infileName = ((PyObject*)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("g6_InitReaderWithFileName", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 76, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.g6_InitReaderWithFileName", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_infileName), (&PyUnicode_Type), 1, "infileName", 1))) __PYX_ERR(0, 76, __pyx_L1_error) __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_6g6_InitReaderWithFileName(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *)__pyx_v_self), __pyx_v_infileName); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } goto __pyx_L7_cleaned_up; __pyx_L0:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __pyx_L7_cleaned_up:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_6g6_InitReaderWithFileName(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self, PyObject *__pyx_v_infileName) { PyObject *__pyx_v_encoded = 0; char const *__pyx_v_encodedInfileName; int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; char const *__pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; size_t __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("g6_InitReaderWithFileName", 0); /* "planarity/full/g6IterationUtils.pyx":86 * RuntimeError if C graphlib version of this function failed. * """ * cdef bytes encoded = infileName.encode('utf-8') # <<<<<<<<<<<<<< * cdef const char *encodedInfileName = encoded * */ if (unlikely(__pyx_v_infileName == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 86, __pyx_L1_error) } __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_infileName); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_encoded = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "planarity/full/g6IterationUtils.pyx":87 * """ * cdef bytes encoded = infileName.encode('utf-8') * cdef const char *encodedInfileName = encoded # <<<<<<<<<<<<<< * * result = graphLib.g6_InitReaderWithFileName(self._g6ReadIterator, encodedInfileName) */ __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_encoded); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L1_error) __pyx_v_encodedInfileName = __pyx_t_2; /* "planarity/full/g6IterationUtils.pyx":89 * cdef const char *encodedInfileName = encoded * * result = graphLib.g6_InitReaderWithFileName(self._g6ReadIterator, encodedInfileName) # <<<<<<<<<<<<<< * if result != graphLib.OK: * raise RuntimeError( */ __pyx_t_3 = __pyx_f_9planarity_4full_8graphLib_g6_InitReaderWithFileName(__pyx_v_self->_g6ReadIterator, __pyx_v_encodedInfileName); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L1_error) __pyx_v_result = __pyx_t_3; /* "planarity/full/g6IterationUtils.pyx":90 * * result = graphLib.g6_InitReaderWithFileName(self._g6ReadIterator, encodedInfileName) * if result != graphLib.OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Unable to initialize reader with infileName, as " */ __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_6)) { /* "planarity/full/g6IterationUtils.pyx":91 * result = graphLib.g6_InitReaderWithFileName(self._g6ReadIterator, encodedInfileName) * if result != graphLib.OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "Unable to initialize reader with infileName, as " * "g6_InitReaderWithFileName() in EAPS graphLib failed." */ __pyx_t_5 = NULL; __pyx_t_7 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Unable_to_initialize_reader_with_2}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 91, __pyx_L1_error) /* "planarity/full/g6IterationUtils.pyx":90 * * result = graphLib.g6_InitReaderWithFileName(self._g6ReadIterator, encodedInfileName) * if result != graphLib.OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Unable to initialize reader with infileName, as " */ } /* "planarity/full/g6IterationUtils.pyx":76 * ) * * def g6_InitReaderWithFileName(self, str infileName) -> None: # <<<<<<<<<<<<<< * """Initializes the G6 read iterator with the name of a file to use as the * input source of G6-encoded graphs. */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.g6_InitReaderWithFileName", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_encoded); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/g6IterationUtils.pyx":96 * ) * * def g6_ReadGraph(self) -> None: # <<<<<<<<<<<<<< * """Reads a G6-encoded graph from the input source. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_9g6_ReadGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_8g6_ReadGraph, "G6ReadIterator.g6_ReadGraph(self) -> None\n\nReads a G6-encoded graph from the input source.\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_9g6_ReadGraph = {"g6_ReadGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_9g6_ReadGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_8g6_ReadGraph}; static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_9g6_ReadGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("g6_ReadGraph (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("g6_ReadGraph", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("g6_ReadGraph", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_8g6_ReadGraph(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_8g6_ReadGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("g6_ReadGraph", 0); /* "planarity/full/g6IterationUtils.pyx":102 * RuntimeError if C graphlib version of this function failed. * """ * result = graphLib.g6_ReadGraph(self._g6ReadIterator) # <<<<<<<<<<<<<< * if result != graphLib.OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_g6_ReadGraph(__pyx_v_self->_g6ReadIterator); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 102, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/g6IterationUtils.pyx":103 * """ * result = graphLib.g6_ReadGraph(self._g6ReadIterator) * if result != graphLib.OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"Unable to read graph, as g6_ReadGraph() in EAPS graphLib failed." */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/g6IterationUtils.pyx":104 * result = graphLib.g6_ReadGraph(self._g6ReadIterator) * if result != graphLib.OK: * raise RuntimeError( # <<<<<<<<<<<<<< * f"Unable to read graph, as g6_ReadGraph() in EAPS graphLib failed." * ) */ __pyx_t_4 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Unable_to_read_graph_as_g6_ReadG}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 104, __pyx_L1_error) /* "planarity/full/g6IterationUtils.pyx":103 * """ * result = graphLib.g6_ReadGraph(self._g6ReadIterator) * if result != graphLib.OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"Unable to read graph, as g6_ReadGraph() in EAPS graphLib failed." */ } /* "planarity/full/g6IterationUtils.pyx":96 * ) * * def g6_ReadGraph(self) -> None: # <<<<<<<<<<<<<< * """Reads a G6-encoded graph from the input source. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.g6_ReadGraph", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/g6IterationUtils.pyx":108 * ) * * def g6_EndReached(self) -> int: # <<<<<<<<<<<<<< * """Indicates whether or not the end of the input source has been reached. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_11g6_EndReached(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_10g6_EndReached, "G6ReadIterator.g6_EndReached(self) -> int\n\nIndicates whether or not the end of the input source has been reached.\n\nReturns: TRUE if there are no more graphs to read, FALSE otherwise"); static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_11g6_EndReached = {"g6_EndReached", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_11g6_EndReached, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_10g6_EndReached}; static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_11g6_EndReached(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("g6_EndReached (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("g6_EndReached", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("g6_EndReached", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_10g6_EndReached(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_10g6_EndReached(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("g6_EndReached", 0); /* "planarity/full/g6IterationUtils.pyx":113 * Returns: TRUE if there are no more graphs to read, FALSE otherwise * """ * return graphLib.g6_EndReached(self._g6ReadIterator) # <<<<<<<<<<<<<< * * def g6_FreeReader(self) -> None: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_g6_EndReached(__pyx_v_self->_g6ReadIterator); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 113, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/g6IterationUtils.pyx":108 * ) * * def g6_EndReached(self) -> int: # <<<<<<<<<<<<<< * """Indicates whether or not the end of the input source has been reached. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.g6_EndReached", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/g6IterationUtils.pyx":115 * return graphLib.g6_EndReached(self._g6ReadIterator) * * def g6_FreeReader(self) -> None: # <<<<<<<<<<<<<< * """Frees the underlying G6 read iterator. Although the __dealloc__() * will do so if the API user does not, it is cleanest to directly call */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_13g6_FreeReader(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_12g6_FreeReader, "G6ReadIterator.g6_FreeReader(self) -> None\n\nFrees the underlying G6 read iterator. Although the __dealloc__()\nwill do so if the API user does not, it is cleanest to directly call\nthis method for consistency with how the write iterator must be used.\nThe __dealloc__() avoids double freeing the iterator.\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_13g6_FreeReader = {"g6_FreeReader", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_13g6_FreeReader, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_12g6_FreeReader}; static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_13g6_FreeReader(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("g6_FreeReader (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("g6_FreeReader", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("g6_FreeReader", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_12g6_FreeReader(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_12g6_FreeReader(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("g6_FreeReader", 0); /* "planarity/full/g6IterationUtils.pyx":124 * RuntimeError if C graphlib version of this function failed. * """ * if self._g6ReadIterator == NULL: # <<<<<<<<<<<<<< * raise RuntimeError( * "G6ReadIterator's underlying g6ReadIterator has already been freed." */ __pyx_t_1 = (__pyx_v_self->_g6ReadIterator == NULL); if (unlikely(__pyx_t_1)) { /* "planarity/full/g6IterationUtils.pyx":125 * """ * if self._g6ReadIterator == NULL: * raise RuntimeError( # <<<<<<<<<<<<<< * "G6ReadIterator's underlying g6ReadIterator has already been freed." * ) */ __pyx_t_3 = NULL; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_G6ReadIterator_s_underlying_g6Re}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 125, __pyx_L1_error) /* "planarity/full/g6IterationUtils.pyx":124 * RuntimeError if C graphlib version of this function failed. * """ * if self._g6ReadIterator == NULL: # <<<<<<<<<<<<<< * raise RuntimeError( * "G6ReadIterator's underlying g6ReadIterator has already been freed." */ } /* "planarity/full/g6IterationUtils.pyx":129 * ) * * graphLib.g6_FreeReader(&self._g6ReadIterator) # <<<<<<<<<<<<<< * * */ __pyx_f_9planarity_4full_8graphLib_g6_FreeReader((&__pyx_v_self->_g6ReadIterator)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 129, __pyx_L1_error) /* "planarity/full/g6IterationUtils.pyx":115 * return graphLib.g6_EndReached(self._g6ReadIterator) * * def g6_FreeReader(self) -> None: # <<<<<<<<<<<<<< * """Frees the underlying G6 read iterator. Although the __dealloc__() * will do so if the API user does not, it is cleanest to directly call */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.g6_FreeReader", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_15__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_14__reduce_cython__, "G6ReadIterator.__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_15__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_14__reduce_cython__}; static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_15__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_14__reduce_cython__(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0); __PYX_ERR(1, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_17__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_16__setstate_cython__, "G6ReadIterator.__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_17__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_16__setstate_cython__}; static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_17__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) } __pyx_v___pyx_state = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_16__setstate_cython__(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_14G6ReadIterator_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0); __PYX_ERR(1, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6ReadIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/g6IterationUtils.pyx":136 * cdef char *_outputString * * def __cinit__(self, graph.Graph graph_to_write): # <<<<<<<<<<<<<< * """Allocates the underlying G6 write iterator with gp_NewWriter(). * */ /* Python wrapper */ static int __pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_graph_to_write = 0; CYTHON_UNUSED Py_ssize_t __pyx_nargs; CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; #endif __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_graph_to_write,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 136, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 136, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__cinit__", 0) < (0)) __PYX_ERR(0, 136, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, i); __PYX_ERR(0, 136, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_VARARGS(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 136, __pyx_L3_error) } __pyx_v_graph_to_write = ((struct __pyx_obj_9planarity_4full_5graph_Graph *)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 136, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_graph_to_write), __pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, 1, "graph_to_write", 0))) __PYX_ERR(0, 136, __pyx_L1_error) __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator___cinit__(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *)__pyx_v_self), __pyx_v_graph_to_write); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } goto __pyx_L7_cleaned_up; __pyx_L0:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __pyx_L7_cleaned_up:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator___cinit__(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_graph_to_write) { PyObject *__pyx_v_invalid_graph_error = NULL; int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; size_t __pyx_t_6; int __pyx_t_7; int __pyx_t_8; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; int __pyx_t_12; char const *__pyx_t_13; PyObject *__pyx_t_14 = NULL; PyObject *__pyx_t_15 = NULL; PyObject *__pyx_t_16 = NULL; PyObject *__pyx_t_17 = NULL; PyObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); /* "planarity/full/g6IterationUtils.pyx":149 * (see gp_EnsureVertexCapacity()). * """ * try: # <<<<<<<<<<<<<< * if graph_to_write.gp_GetN() == 0: * raise ValueError( */ { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); __Pyx_XGOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { /* "planarity/full/g6IterationUtils.pyx":150 * """ * try: * if graph_to_write.gp_GetN() == 0: # <<<<<<<<<<<<<< * raise ValueError( * "Graph to write is not initialized." */ __pyx_t_5 = ((PyObject *)__pyx_v_graph_to_write); __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; __pyx_t_4 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_GetN, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); } __pyx_t_7 = (__Pyx_PyLong_BoolEqObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 150, __pyx_L3_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_7)) { /* "planarity/full/g6IterationUtils.pyx":151 * try: * if graph_to_write.gp_GetN() == 0: * raise ValueError( # <<<<<<<<<<<<<< * "Graph to write is not initialized." * ) */ __pyx_t_5 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Graph_to_write_is_not_initialize}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 151, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 151, __pyx_L3_error) /* "planarity/full/g6IterationUtils.pyx":150 * """ * try: * if graph_to_write.gp_GetN() == 0: # <<<<<<<<<<<<<< * raise ValueError( * "Graph to write is not initialized." */ } /* "planarity/full/g6IterationUtils.pyx":149 * (see gp_EnsureVertexCapacity()). * """ * try: # <<<<<<<<<<<<<< * if graph_to_write.gp_GetN() == 0: * raise ValueError( */ } __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L8_try_end; __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; /* "planarity/full/g6IterationUtils.pyx":154 * "Graph to write is not initialized." * ) * except RuntimeError as invalid_graph_error: # <<<<<<<<<<<<<< * raise ValueError( * "Graph to write is not allocated." */ __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_RuntimeError)))); if (__pyx_t_8) { __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_9) < 0) __PYX_ERR(0, 154, __pyx_L5_except_error) __Pyx_XGOTREF(__pyx_t_4); __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_5); __pyx_v_invalid_graph_error = __pyx_t_5; /*try:*/ { /* "planarity/full/g6IterationUtils.pyx":155 * ) * except RuntimeError as invalid_graph_error: * raise ValueError( # <<<<<<<<<<<<<< * "Graph to write is not allocated." * ) from invalid_graph_error */ __pyx_t_11 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_kp_u_Graph_to_write_is_not_allocated}; __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 155, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_10); } /* "planarity/full/g6IterationUtils.pyx":157 * raise ValueError( * "Graph to write is not allocated." * ) from invalid_graph_error # <<<<<<<<<<<<<< * * self._g6WriteIterator = NULL */ __Pyx_Raise(__pyx_t_10, 0, 0, __pyx_v_invalid_graph_error); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __PYX_ERR(0, 155, __pyx_L15_error) } /* "planarity/full/g6IterationUtils.pyx":154 * "Graph to write is not initialized." * ) * except RuntimeError as invalid_graph_error: # <<<<<<<<<<<<<< * raise ValueError( * "Graph to write is not allocated." */ /*finally:*/ { __pyx_L15_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19); if ( unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __pyx_t_8 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_13 = __pyx_filename; { __Pyx_DECREF(__pyx_v_invalid_graph_error); __pyx_v_invalid_graph_error = 0; } __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_XGIVEREF(__pyx_t_19); __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_ErrRestore(__pyx_t_14, __pyx_t_15, __pyx_t_16); __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_13; goto __pyx_L5_except_error; } } } goto __pyx_L5_except_error; /* "planarity/full/g6IterationUtils.pyx":149 * (see gp_EnsureVertexCapacity()). * """ * try: # <<<<<<<<<<<<<< * if graph_to_write.gp_GetN() == 0: * raise ValueError( */ __pyx_L5_except_error:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; __pyx_L8_try_end:; } /* "planarity/full/g6IterationUtils.pyx":159 * ) from invalid_graph_error * * self._g6WriteIterator = NULL # <<<<<<<<<<<<<< * if graphLib.g6_NewWriter(&self._g6WriteIterator, graph_to_write._theGraph) != graphLib.OK: * raise MemoryError( */ __pyx_v_self->_g6WriteIterator = NULL; /* "planarity/full/g6IterationUtils.pyx":160 * * self._g6WriteIterator = NULL * if graphLib.g6_NewWriter(&self._g6WriteIterator, graph_to_write._theGraph) != graphLib.OK: # <<<<<<<<<<<<<< * raise MemoryError( * "Unable to initialize G6WriteIterator, as g6_NewWriter() in " */ __pyx_t_12 = __pyx_f_9planarity_4full_8graphLib_g6_NewWriter((&__pyx_v_self->_g6WriteIterator), __pyx_v_graph_to_write->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 160, __pyx_L1_error) __pyx_t_9 = __Pyx_PyLong_From_int(__pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_RichCompare(__pyx_t_9, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(__pyx_t_7)) { /* "planarity/full/g6IterationUtils.pyx":161 * self._g6WriteIterator = NULL * if graphLib.g6_NewWriter(&self._g6WriteIterator, graph_to_write._theGraph) != graphLib.OK: * raise MemoryError( # <<<<<<<<<<<<<< * "Unable to initialize G6WriteIterator, as g6_NewWriter() in " * "EAPS graphLib failed." */ __pyx_t_4 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Unable_to_initialize_G6WriteIter}; __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 161, __pyx_L1_error) /* "planarity/full/g6IterationUtils.pyx":160 * * self._g6WriteIterator = NULL * if graphLib.g6_NewWriter(&self._g6WriteIterator, graph_to_write._theGraph) != graphLib.OK: # <<<<<<<<<<<<<< * raise MemoryError( * "Unable to initialize G6WriteIterator, as g6_NewWriter() in " */ } /* "planarity/full/g6IterationUtils.pyx":166 * ) * * self._outputString = NULL # <<<<<<<<<<<<<< * * def __dealloc__(self): */ __pyx_v_self->_outputString = NULL; /* "planarity/full/g6IterationUtils.pyx":136 * cdef char *_outputString * * def __cinit__(self, graph.Graph graph_to_write): # <<<<<<<<<<<<<< * """Allocates the underlying G6 write iterator with gp_NewWriter(). * */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_invalid_graph_error); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/g6IterationUtils.pyx":168 * self._outputString = NULL * * def __dealloc__(self): # <<<<<<<<<<<<<< * """Frees the underlying G6 write iterator with g6_FreeWriter(), if necessary. * However, if the output source is a string and if the API user did not directly */ /* Python wrapper */ static void __pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_3__dealloc__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_2__dealloc__(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_2__dealloc__(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self) { __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__dealloc__", 0); /* "planarity/full/g6IterationUtils.pyx":181 * * """ * if self._g6WriteIterator != NULL: # <<<<<<<<<<<<<< * graphLib.g6_FreeWriter(&self._g6WriteIterator) * */ __pyx_t_1 = (__pyx_v_self->_g6WriteIterator != NULL); if (__pyx_t_1) { /* "planarity/full/g6IterationUtils.pyx":182 * """ * if self._g6WriteIterator != NULL: * graphLib.g6_FreeWriter(&self._g6WriteIterator) # <<<<<<<<<<<<<< * * if self._outputString != NULL: */ __pyx_f_9planarity_4full_8graphLib_g6_FreeWriter((&__pyx_v_self->_g6WriteIterator)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L1_error) /* "planarity/full/g6IterationUtils.pyx":181 * * """ * if self._g6WriteIterator != NULL: # <<<<<<<<<<<<<< * graphLib.g6_FreeWriter(&self._g6WriteIterator) * */ } /* "planarity/full/g6IterationUtils.pyx":184 * graphLib.g6_FreeWriter(&self._g6WriteIterator) * * if self._outputString != NULL: # <<<<<<<<<<<<<< * free(self._outputString) * self._outputString = NULL */ __pyx_t_1 = (__pyx_v_self->_outputString != NULL); if (unlikely(__pyx_t_1)) { /* "planarity/full/g6IterationUtils.pyx":185 * * if self._outputString != NULL: * free(self._outputString) # <<<<<<<<<<<<<< * self._outputString = NULL * raise RuntimeError( */ free(__pyx_v_self->_outputString); /* "planarity/full/g6IterationUtils.pyx":186 * if self._outputString != NULL: * free(self._outputString) * self._outputString = NULL # <<<<<<<<<<<<<< * raise RuntimeError( * "G6WriteIterator was initialized with string, but you did not " */ __pyx_v_self->_outputString = NULL; /* "planarity/full/g6IterationUtils.pyx":187 * free(self._outputString) * self._outputString = NULL * raise RuntimeError( # <<<<<<<<<<<<<< * "G6WriteIterator was initialized with string, but you did not " * "call g6_FreeWriter(), so you have not received the string " */ __pyx_t_3 = NULL; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_G6WriteIterator_was_initialized}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 187, __pyx_L1_error) /* "planarity/full/g6IterationUtils.pyx":184 * graphLib.g6_FreeWriter(&self._g6WriteIterator) * * if self._outputString != NULL: # <<<<<<<<<<<<<< * free(self._outputString) * self._outputString = NULL */ } /* "planarity/full/g6IterationUtils.pyx":168 * self._outputString = NULL * * def __dealloc__(self): # <<<<<<<<<<<<<< * """Frees the underlying G6 write iterator with g6_FreeWriter(), if necessary. * However, if the output source is a string and if the API user did not directly */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_WriteUnraisable("planarity.full.g6IterationUtils.G6WriteIterator.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* "planarity/full/g6IterationUtils.pyx":193 * ) * * def g6_InitWriterWithString(self) -> None: # <<<<<<<<<<<<<< * """Initializes the G6 write iterator with an internal string to use as the * output source that will receive G6-encoded graphs. */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_5g6_InitWriterWithString(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_4g6_InitWriterWithString, "G6WriteIterator.g6_InitWriterWithString(self) -> None\n\nInitializes the G6 write iterator with an internal string to use as the\noutput source that will receive G6-encoded graphs.\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_5g6_InitWriterWithString = {"g6_InitWriterWithString", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_5g6_InitWriterWithString, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_4g6_InitWriterWithString}; static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_5g6_InitWriterWithString(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("g6_InitWriterWithString (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("g6_InitWriterWithString", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("g6_InitWriterWithString", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_4g6_InitWriterWithString(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_4g6_InitWriterWithString(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("g6_InitWriterWithString", 0); /* "planarity/full/g6IterationUtils.pyx":200 * RuntimeError if C graphlib version of this function failed. * """ * result = graphLib.g6_InitWriterWithString(self._g6WriteIterator, &(self._outputString)) # <<<<<<<<<<<<<< * if result != graphLib.OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_g6_InitWriterWithString(__pyx_v_self->_g6WriteIterator, (&__pyx_v_self->_outputString)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/g6IterationUtils.pyx":201 * """ * result = graphLib.g6_InitWriterWithString(self._g6WriteIterator, &(self._outputString)) * if result != graphLib.OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Unable to initialize writer with string, as " */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/g6IterationUtils.pyx":202 * result = graphLib.g6_InitWriterWithString(self._g6WriteIterator, &(self._outputString)) * if result != graphLib.OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "Unable to initialize writer with string, as " * "g6_InitWriterWithString() in EAPS graphLib failed." */ __pyx_t_4 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Unable_to_initialize_writer_with}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 202, __pyx_L1_error) /* "planarity/full/g6IterationUtils.pyx":201 * """ * result = graphLib.g6_InitWriterWithString(self._g6WriteIterator, &(self._outputString)) * if result != graphLib.OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Unable to initialize writer with string, as " */ } /* "planarity/full/g6IterationUtils.pyx":193 * ) * * def g6_InitWriterWithString(self) -> None: # <<<<<<<<<<<<<< * """Initializes the G6 write iterator with an internal string to use as the * output source that will receive G6-encoded graphs. */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.g6_InitWriterWithString", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/g6IterationUtils.pyx":207 * ) * * def g6_InitWriterWithFileName(self, str outfileName) -> None: # <<<<<<<<<<<<<< * """Initializes the G6 write iterator with the name of a file to use as the * output source that will receive G6-encoded graphs. */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_7g6_InitWriterWithFileName(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_6g6_InitWriterWithFileName, "G6WriteIterator.g6_InitWriterWithFileName(self, str outfileName) -> None\n\nInitializes the G6 write iterator with the name of a file to use as the \noutput source that will receive G6-encoded graphs.\n\nArgs:\n outfileName: a string containing the name of the file to use as the \n output source\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_7g6_InitWriterWithFileName = {"g6_InitWriterWithFileName", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_7g6_InitWriterWithFileName, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_6g6_InitWriterWithFileName}; static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_7g6_InitWriterWithFileName(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_outfileName = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("g6_InitWriterWithFileName (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_outfileName,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 207, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 207, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "g6_InitWriterWithFileName", 0) < (0)) __PYX_ERR(0, 207, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("g6_InitWriterWithFileName", 1, 1, 1, i); __PYX_ERR(0, 207, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 207, __pyx_L3_error) } __pyx_v_outfileName = ((PyObject*)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("g6_InitWriterWithFileName", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 207, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.g6_InitWriterWithFileName", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_outfileName), (&PyUnicode_Type), 1, "outfileName", 1))) __PYX_ERR(0, 207, __pyx_L1_error) __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_6g6_InitWriterWithFileName(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *)__pyx_v_self), __pyx_v_outfileName); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } goto __pyx_L7_cleaned_up; __pyx_L0:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __pyx_L7_cleaned_up:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_6g6_InitWriterWithFileName(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self, PyObject *__pyx_v_outfileName) { PyObject *__pyx_v_encoded = 0; char const *__pyx_v_encodedOutputFileName; int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; char const *__pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; size_t __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("g6_InitWriterWithFileName", 0); /* "planarity/full/g6IterationUtils.pyx":218 * RuntimeError if C graphlib version of this function failed. * """ * cdef bytes encoded = outfileName.encode('utf-8') # <<<<<<<<<<<<<< * cdef const char *encodedOutputFileName = encoded * */ if (unlikely(__pyx_v_outfileName == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 218, __pyx_L1_error) } __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_outfileName); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_encoded = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "planarity/full/g6IterationUtils.pyx":219 * """ * cdef bytes encoded = outfileName.encode('utf-8') * cdef const char *encodedOutputFileName = encoded # <<<<<<<<<<<<<< * * result = graphLib.g6_InitWriterWithFileName(self._g6WriteIterator, encodedOutputFileName) */ __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_encoded); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L1_error) __pyx_v_encodedOutputFileName = __pyx_t_2; /* "planarity/full/g6IterationUtils.pyx":221 * cdef const char *encodedOutputFileName = encoded * * result = graphLib.g6_InitWriterWithFileName(self._g6WriteIterator, encodedOutputFileName) # <<<<<<<<<<<<<< * if result != graphLib.OK: * raise RuntimeError( */ __pyx_t_3 = __pyx_f_9planarity_4full_8graphLib_g6_InitWriterWithFileName(__pyx_v_self->_g6WriteIterator, __pyx_v_encodedOutputFileName); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L1_error) __pyx_v_result = __pyx_t_3; /* "planarity/full/g6IterationUtils.pyx":222 * * result = graphLib.g6_InitWriterWithFileName(self._g6WriteIterator, encodedOutputFileName) * if result != graphLib.OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Unable to initialize writer with filename, as " */ __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_6)) { /* "planarity/full/g6IterationUtils.pyx":223 * result = graphLib.g6_InitWriterWithFileName(self._g6WriteIterator, encodedOutputFileName) * if result != graphLib.OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "Unable to initialize writer with filename, as " * "g6_InitWriterWithFileName() in EAPS graphLib failed." */ __pyx_t_5 = NULL; __pyx_t_7 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Unable_to_initialize_writer_with_2}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 223, __pyx_L1_error) /* "planarity/full/g6IterationUtils.pyx":222 * * result = graphLib.g6_InitWriterWithFileName(self._g6WriteIterator, encodedOutputFileName) * if result != graphLib.OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Unable to initialize writer with filename, as " */ } /* "planarity/full/g6IterationUtils.pyx":207 * ) * * def g6_InitWriterWithFileName(self, str outfileName) -> None: # <<<<<<<<<<<<<< * """Initializes the G6 write iterator with the name of a file to use as the * output source that will receive G6-encoded graphs. */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.g6_InitWriterWithFileName", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_encoded); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/g6IterationUtils.pyx":228 * ) * * def g6_WriteGraph(self) -> None: # <<<<<<<<<<<<<< * """Writes a G6-encoded graph to the output source. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_9g6_WriteGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_8g6_WriteGraph, "G6WriteIterator.g6_WriteGraph(self) -> None\n\nWrites a G6-encoded graph to the output source.\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_9g6_WriteGraph = {"g6_WriteGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_9g6_WriteGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_8g6_WriteGraph}; static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_9g6_WriteGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("g6_WriteGraph (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("g6_WriteGraph", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("g6_WriteGraph", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_8g6_WriteGraph(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_8g6_WriteGraph(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("g6_WriteGraph", 0); /* "planarity/full/g6IterationUtils.pyx":234 * RuntimeError if C graphlib version of this function failed. * """ * result = graphLib.g6_WriteGraph(self._g6WriteIterator) # <<<<<<<<<<<<<< * if result != graphLib.OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_g6_WriteGraph(__pyx_v_self->_g6WriteIterator); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/g6IterationUtils.pyx":235 * """ * result = graphLib.g6_WriteGraph(self._g6WriteIterator) * if result != graphLib.OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Unable to write graph, as g6_WriteGraph() in EAPS graphLib failed." */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/g6IterationUtils.pyx":236 * result = graphLib.g6_WriteGraph(self._g6WriteIterator) * if result != graphLib.OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "Unable to write graph, as g6_WriteGraph() in EAPS graphLib failed." * ) */ __pyx_t_4 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Unable_to_write_graph_as_g6_Writ}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 236, __pyx_L1_error) /* "planarity/full/g6IterationUtils.pyx":235 * """ * result = graphLib.g6_WriteGraph(self._g6WriteIterator) * if result != graphLib.OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Unable to write graph, as g6_WriteGraph() in EAPS graphLib failed." */ } /* "planarity/full/g6IterationUtils.pyx":228 * ) * * def g6_WriteGraph(self) -> None: # <<<<<<<<<<<<<< * """Writes a G6-encoded graph to the output source. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.g6_WriteGraph", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/g6IterationUtils.pyx":240 * ) * * def g6_FreeWriter(self) -> str | None: # <<<<<<<<<<<<<< * """Frees the underlying G6 write iterator. This method must be * called if the G6 write iterator was initialized to output to a string, */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_11g6_FreeWriter(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_10g6_FreeWriter, "G6WriteIterator.g6_FreeWriter(self) -> str | None\n\nFrees the underlying G6 write iterator. This method must be \ncalled if the G6 write iterator was initialized to output to a string,\nso that the API user can receive the string output. Otherwise, it\nis still best to directly call this method even if the G6 write iterator\nwas initialized to output to a file. The __dealloc__() does also call\nthis method if it has not already been called.\n\nReturns:\n A Python string containing the G6-encoded output if the G6 write iterator\n was initialized to write to a string, or nothing if the G6 write iterator\n was initialized to write to a file.\n\nRaises:\n RuntimeError if the G6 write iterator was initialized to output\n to a string and the string cannot be decoded to a Python string."); static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_11g6_FreeWriter = {"g6_FreeWriter", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_11g6_FreeWriter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_10g6_FreeWriter}; static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_11g6_FreeWriter(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("g6_FreeWriter (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("g6_FreeWriter", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("g6_FreeWriter", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_10g6_FreeWriter(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_10g6_FreeWriter(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self) { PyObject *__pyx_v_output_bytes = NULL; PyObject *__pyx_v_string_conversion_error = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; int __pyx_t_12; char const *__pyx_t_13; PyObject *__pyx_t_14 = NULL; PyObject *__pyx_t_15 = NULL; PyObject *__pyx_t_16 = NULL; PyObject *__pyx_t_17 = NULL; PyObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("g6_FreeWriter", 0); /* "planarity/full/g6IterationUtils.pyx":257 * to a string and the string cannot be decoded to a Python string. * """ * if self._g6WriteIterator == NULL: # <<<<<<<<<<<<<< * raise RuntimeError( * "G6WriteIterator's underlying g6WriteIterator has already been freed." */ __pyx_t_1 = (__pyx_v_self->_g6WriteIterator == NULL); if (unlikely(__pyx_t_1)) { /* "planarity/full/g6IterationUtils.pyx":258 * """ * if self._g6WriteIterator == NULL: * raise RuntimeError( # <<<<<<<<<<<<<< * "G6WriteIterator's underlying g6WriteIterator has already been freed." * ) */ __pyx_t_3 = NULL; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_G6WriteIterator_s_underlying_g6W}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 258, __pyx_L1_error) /* "planarity/full/g6IterationUtils.pyx":257 * to a string and the string cannot be decoded to a Python string. * """ * if self._g6WriteIterator == NULL: # <<<<<<<<<<<<<< * raise RuntimeError( * "G6WriteIterator's underlying g6WriteIterator has already been freed." */ } /* "planarity/full/g6IterationUtils.pyx":267 * # container's theStrBuf and assign the string to the address pointed to * # by pOutputStr (i.e. the G6WriteIterator's self._outputString) * graphLib.g6_FreeWriter(&self._g6WriteIterator) # <<<<<<<<<<<<<< * * if self._outputString != NULL: */ __pyx_f_9planarity_4full_8graphLib_g6_FreeWriter((&__pyx_v_self->_g6WriteIterator)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 267, __pyx_L1_error) /* "planarity/full/g6IterationUtils.pyx":269 * graphLib.g6_FreeWriter(&self._g6WriteIterator) * * if self._outputString != NULL: # <<<<<<<<<<<<<< * output_bytes = self._outputString[:] * free(self._outputString) */ __pyx_t_1 = (__pyx_v_self->_outputString != NULL); if (__pyx_t_1) { /* "planarity/full/g6IterationUtils.pyx":270 * * if self._outputString != NULL: * output_bytes = self._outputString[:] # <<<<<<<<<<<<<< * free(self._outputString) * self._outputString = NULL */ __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_self->_outputString + 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_output_bytes = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/g6IterationUtils.pyx":271 * if self._outputString != NULL: * output_bytes = self._outputString[:] * free(self._outputString) # <<<<<<<<<<<<<< * self._outputString = NULL * try: */ free(__pyx_v_self->_outputString); /* "planarity/full/g6IterationUtils.pyx":272 * output_bytes = self._outputString[:] * free(self._outputString) * self._outputString = NULL # <<<<<<<<<<<<<< * try: * return output_bytes.decode('UTF-8') */ __pyx_v_self->_outputString = NULL; /* "planarity/full/g6IterationUtils.pyx":273 * free(self._outputString) * self._outputString = NULL * try: # <<<<<<<<<<<<<< * return output_bytes.decode('UTF-8') * except Exception as string_conversion_error: */ { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_7); /*try:*/ { /* "planarity/full/g6IterationUtils.pyx":274 * self._outputString = NULL * try: * return output_bytes.decode('UTF-8') # <<<<<<<<<<<<<< * except Exception as string_conversion_error: * raise RuntimeError( */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_decode_bytes(__pyx_v_output_bytes, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L9_try_return; /* "planarity/full/g6IterationUtils.pyx":273 * free(self._outputString) * self._outputString = NULL * try: # <<<<<<<<<<<<<< * return output_bytes.decode('UTF-8') * except Exception as string_conversion_error: */ } __pyx_L5_error:; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; /* "planarity/full/g6IterationUtils.pyx":275 * try: * return output_bytes.decode('UTF-8') * except Exception as string_conversion_error: # <<<<<<<<<<<<<< * raise RuntimeError( * "Failed to convert C string to Python string." */ __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); if (__pyx_t_8) { __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.g6_FreeWriter", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_9) < 0) __PYX_ERR(0, 275, __pyx_L7_except_error) __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_v_string_conversion_error = __pyx_t_3; /*try:*/ { /* "planarity/full/g6IterationUtils.pyx":276 * return output_bytes.decode('UTF-8') * except Exception as string_conversion_error: * raise RuntimeError( # <<<<<<<<<<<<<< * "Failed to convert C string to Python string." * ) from string_conversion_error */ __pyx_t_11 = NULL; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_kp_u_Failed_to_convert_C_string_to_Py}; __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 276, __pyx_L16_error) __Pyx_GOTREF(__pyx_t_10); } /* "planarity/full/g6IterationUtils.pyx":278 * raise RuntimeError( * "Failed to convert C string to Python string." * ) from string_conversion_error # <<<<<<<<<<<<<< */ __Pyx_Raise(__pyx_t_10, 0, 0, __pyx_v_string_conversion_error); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __PYX_ERR(0, 276, __pyx_L16_error) } /* "planarity/full/g6IterationUtils.pyx":275 * try: * return output_bytes.decode('UTF-8') * except Exception as string_conversion_error: # <<<<<<<<<<<<<< * raise RuntimeError( * "Failed to convert C string to Python string." */ /*finally:*/ { __pyx_L16_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19); if ( unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __pyx_t_8 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_13 = __pyx_filename; { __Pyx_DECREF(__pyx_v_string_conversion_error); __pyx_v_string_conversion_error = 0; } __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_XGIVEREF(__pyx_t_19); __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_ErrRestore(__pyx_t_14, __pyx_t_15, __pyx_t_16); __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_13; goto __pyx_L7_except_error; } } } goto __pyx_L7_except_error; /* "planarity/full/g6IterationUtils.pyx":273 * free(self._outputString) * self._outputString = NULL * try: # <<<<<<<<<<<<<< * return output_bytes.decode('UTF-8') * except Exception as string_conversion_error: */ __pyx_L7_except_error:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); goto __pyx_L1_error; __pyx_L9_try_return:; __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); goto __pyx_L0; } /* "planarity/full/g6IterationUtils.pyx":269 * graphLib.g6_FreeWriter(&self._g6WriteIterator) * * if self._outputString != NULL: # <<<<<<<<<<<<<< * output_bytes = self._outputString[:] * free(self._outputString) */ } /* "planarity/full/g6IterationUtils.pyx":240 * ) * * def g6_FreeWriter(self) -> str | None: # <<<<<<<<<<<<<< * """Frees the underlying G6 write iterator. This method must be * called if the G6 write iterator was initialized to output to a string, */ /* function exit code */ __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.g6_FreeWriter", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_output_bytes); __Pyx_XDECREF(__pyx_v_string_conversion_error); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_13__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_12__reduce_cython__, "G6WriteIterator.__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_13__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_13__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_12__reduce_cython__}; static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_13__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_12__reduce_cython__(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_12__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0); __PYX_ERR(1, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_15__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_14__setstate_cython__, "G6WriteIterator.__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_15__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_15__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_14__setstate_cython__}; static PyObject *__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_15__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) } __pyx_v___pyx_state = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_14__setstate_cython__(((struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_16g6IterationUtils_15G6WriteIterator_14__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0); __PYX_ERR(1, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("planarity.full.g6IterationUtils.G6WriteIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* #### Code section: module_exttypes ### */ static PyObject *__pyx_tp_new_9planarity_4full_16g6IterationUtils_G6ReadIterator(PyTypeObject *t, PyObject *a, PyObject *k) { PyObject *o; o = __Pyx_AllocateExtensionType(t, 0); if (unlikely(!o)) return 0; if (unlikely(__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_1__cinit__(o, a, k) < 0)) goto bad; return o; bad: Py_DECREF(o); o = 0; return NULL; } static void __pyx_tp_dealloc_9planarity_4full_16g6IterationUtils_G6ReadIterator(PyObject *o) { #if CYTHON_USE_TP_FINALIZE if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9planarity_4full_16g6IterationUtils_G6ReadIterator) { if (PyObject_CallFinalizerFromDealloc(o)) return; } } #endif { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); __pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_3__dealloc__(o); __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } PyTypeObject *tp = Py_TYPE(o); #if CYTHON_USE_TYPE_SLOTS (*tp->tp_free)(o); #else { freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); if (tp_free) tp_free(o); } #endif #if CYTHON_USE_TYPE_SPECS Py_DECREF(tp); #endif } static PyMethodDef __pyx_methods_9planarity_4full_16g6IterationUtils_G6ReadIterator[] = { {"g6_InitReaderWithString", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_5g6_InitReaderWithString, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_4g6_InitReaderWithString}, {"g6_InitReaderWithFileName", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_7g6_InitReaderWithFileName, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_6g6_InitReaderWithFileName}, {"g6_ReadGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_9g6_ReadGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_8g6_ReadGraph}, {"g6_EndReached", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_11g6_EndReached, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_10g6_EndReached}, {"g6_FreeReader", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_13g6_FreeReader, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_12g6_FreeReader}, {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_15__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_14__reduce_cython__}, {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_14G6ReadIterator_17__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_14G6ReadIterator_16__setstate_cython__}, {0, 0, 0, 0} }; #if CYTHON_USE_TYPE_SPECS static PyType_Slot __pyx_type_9planarity_4full_16g6IterationUtils_G6ReadIterator_slots[] = { {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9planarity_4full_16g6IterationUtils_G6ReadIterator}, {Py_tp_methods, (void *)__pyx_methods_9planarity_4full_16g6IterationUtils_G6ReadIterator}, {Py_tp_new, (void *)__pyx_tp_new_9planarity_4full_16g6IterationUtils_G6ReadIterator}, {0, 0}, }; static PyType_Spec __pyx_type_9planarity_4full_16g6IterationUtils_G6ReadIterator_spec = { "planarity.full.g6IterationUtils.G6ReadIterator", sizeof(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator), 0, Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, __pyx_type_9planarity_4full_16g6IterationUtils_G6ReadIterator_slots, }; #else static PyTypeObject __pyx_type_9planarity_4full_16g6IterationUtils_G6ReadIterator = { PyVarObject_HEAD_INIT(0, 0) "planarity.full.g6IterationUtils.""G6ReadIterator", /*tp_name*/ sizeof(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6ReadIterator), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_9planarity_4full_16g6IterationUtils_G6ReadIterator, /*tp_dealloc*/ 0, /*tp_vectorcall_offset*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_as_async*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_9planarity_4full_16g6IterationUtils_G6ReadIterator, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_9planarity_4full_16g6IterationUtils_G6ReadIterator, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ #else NULL, /*tp_finalize*/ #endif #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 0, /*tp_vectorcall*/ #endif #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030C0000 0, /*tp_watched*/ #endif #if PY_VERSION_HEX >= 0x030d00A4 0, /*tp_versions_used*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; #endif static PyObject *__pyx_tp_new_9planarity_4full_16g6IterationUtils_G6WriteIterator(PyTypeObject *t, PyObject *a, PyObject *k) { PyObject *o; o = __Pyx_AllocateExtensionType(t, 0); if (unlikely(!o)) return 0; if (unlikely(__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_1__cinit__(o, a, k) < 0)) goto bad; return o; bad: Py_DECREF(o); o = 0; return NULL; } static void __pyx_tp_dealloc_9planarity_4full_16g6IterationUtils_G6WriteIterator(PyObject *o) { #if CYTHON_USE_TP_FINALIZE if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9planarity_4full_16g6IterationUtils_G6WriteIterator) { if (PyObject_CallFinalizerFromDealloc(o)) return; } } #endif { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); __pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_3__dealloc__(o); __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } PyTypeObject *tp = Py_TYPE(o); #if CYTHON_USE_TYPE_SLOTS (*tp->tp_free)(o); #else { freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); if (tp_free) tp_free(o); } #endif #if CYTHON_USE_TYPE_SPECS Py_DECREF(tp); #endif } static PyMethodDef __pyx_methods_9planarity_4full_16g6IterationUtils_G6WriteIterator[] = { {"g6_InitWriterWithString", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_5g6_InitWriterWithString, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_4g6_InitWriterWithString}, {"g6_InitWriterWithFileName", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_7g6_InitWriterWithFileName, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_6g6_InitWriterWithFileName}, {"g6_WriteGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_9g6_WriteGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_8g6_WriteGraph}, {"g6_FreeWriter", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_11g6_FreeWriter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_10g6_FreeWriter}, {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_13__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_12__reduce_cython__}, {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_16g6IterationUtils_15G6WriteIterator_15__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_16g6IterationUtils_15G6WriteIterator_14__setstate_cython__}, {0, 0, 0, 0} }; #if CYTHON_USE_TYPE_SPECS static PyType_Slot __pyx_type_9planarity_4full_16g6IterationUtils_G6WriteIterator_slots[] = { {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9planarity_4full_16g6IterationUtils_G6WriteIterator}, {Py_tp_methods, (void *)__pyx_methods_9planarity_4full_16g6IterationUtils_G6WriteIterator}, {Py_tp_new, (void *)__pyx_tp_new_9planarity_4full_16g6IterationUtils_G6WriteIterator}, {0, 0}, }; static PyType_Spec __pyx_type_9planarity_4full_16g6IterationUtils_G6WriteIterator_spec = { "planarity.full.g6IterationUtils.G6WriteIterator", sizeof(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator), 0, Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, __pyx_type_9planarity_4full_16g6IterationUtils_G6WriteIterator_slots, }; #else static PyTypeObject __pyx_type_9planarity_4full_16g6IterationUtils_G6WriteIterator = { PyVarObject_HEAD_INIT(0, 0) "planarity.full.g6IterationUtils.""G6WriteIterator", /*tp_name*/ sizeof(struct __pyx_obj_9planarity_4full_16g6IterationUtils_G6WriteIterator), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_9planarity_4full_16g6IterationUtils_G6WriteIterator, /*tp_dealloc*/ 0, /*tp_vectorcall_offset*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_as_async*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_9planarity_4full_16g6IterationUtils_G6WriteIterator, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_9planarity_4full_16g6IterationUtils_G6WriteIterator, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ #else NULL, /*tp_finalize*/ #endif #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 0, /*tp_vectorcall*/ #endif #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030C0000 0, /*tp_watched*/ #endif #if PY_VERSION_HEX >= 0x030d00A4 0, /*tp_versions_used*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; #endif static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; /* #### Code section: initfunc_declarations ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/ /* #### Code section: init_module ### */ static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); /*--- Global init code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); /*--- Variable export code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); /*--- Function export code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ #if CYTHON_USE_TYPE_SPECS __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9planarity_4full_16g6IterationUtils_G6ReadIterator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator)) __PYX_ERR(0, 17, __pyx_L1_error) if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9planarity_4full_16g6IterationUtils_G6ReadIterator_spec, __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator) < (0)) __PYX_ERR(0, 17, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator = &__pyx_type_9planarity_4full_16g6IterationUtils_G6ReadIterator; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator) < (0)) __PYX_ERR(0, 17, __pyx_L1_error) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator); #endif #if !CYTHON_COMPILING_IN_LIMITED_API if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator->tp_dictoffset && __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator->tp_getattro == PyObject_GenericGetAttr)) { __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator->tp_getattro = PyObject_GenericGetAttr; } #endif if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_G6ReadIterator, (PyObject *) __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator) < (0)) __PYX_ERR(0, 17, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator) < (0)) __PYX_ERR(0, 17, __pyx_L1_error) #if CYTHON_USE_TYPE_SPECS __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9planarity_4full_16g6IterationUtils_G6WriteIterator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator)) __PYX_ERR(0, 132, __pyx_L1_error) if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9planarity_4full_16g6IterationUtils_G6WriteIterator_spec, __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator) < (0)) __PYX_ERR(0, 132, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator = &__pyx_type_9planarity_4full_16g6IterationUtils_G6WriteIterator; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator) < (0)) __PYX_ERR(0, 132, __pyx_L1_error) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator); #endif #if !CYTHON_COMPILING_IN_LIMITED_API if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator->tp_dictoffset && __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator->tp_getattro == PyObject_GenericGetAttr)) { __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator->tp_getattro = PyObject_GenericGetAttr; } #endif if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_G6WriteIterator, (PyObject *) __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator) < (0)) __PYX_ERR(0, 132, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator) < (0)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ __pyx_t_1 = PyImport_ImportModule("planarity.full.graph"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph = __Pyx_ImportType_3_2_6(__pyx_t_1, "planarity.full.graph", "Graph", #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 sizeof(struct __pyx_obj_9planarity_4full_5graph_Graph), __PYX_GET_STRUCT_ALIGNMENT_3_2_6(struct __pyx_obj_9planarity_4full_5graph_Graph), #elif CYTHON_COMPILING_IN_LIMITED_API sizeof(struct __pyx_obj_9planarity_4full_5graph_Graph), __PYX_GET_STRUCT_ALIGNMENT_3_2_6(struct __pyx_obj_9planarity_4full_5graph_Graph), #else sizeof(struct __pyx_obj_9planarity_4full_5graph_Graph), __PYX_GET_STRUCT_ALIGNMENT_3_2_6(struct __pyx_obj_9planarity_4full_5graph_Graph), #endif __Pyx_ImportType_CheckSize_Warn_3_2_6); if (!__pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph) __PYX_ERR(2, 12, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); /*--- Variable import code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); /*--- Function import code ---*/ { __pyx_t_1 = PyImport_ImportModule("planarity.full.graphLib"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_int_G6ReadIteratorP_graphP_int_G); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error) #endif const char * __pyx_import_name = __pyx_import_signature + 256; void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_9planarity_4full_8graphLib_g6_NewReader, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_g6_EndReached, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_g6_ReadGraph, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_g6_InitReaderWithFileName, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_g6_InitReaderWithString, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_g6_NewWriter, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_g6_WriteGraph, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_g6_InitWriterWithFileName, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_g6_InitWriterWithString, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_g6_FreeReader, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_g6_FreeWriter, (void (**)(void)) NULL}; void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers; const char *__pyx_import_current_signature = __pyx_import_signature; while (*__pyx_import_pointer) { if (__Pyx_ImportFunction_3_2_6(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) ++__pyx_import_pointer; __pyx_import_name = strchr(__pyx_import_name, '\0') + 1; __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1; if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_RefNannyFinishContext(); return -1; } #if CYTHON_PEP489_MULTI_PHASE_INIT static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ static int __pyx_pymod_exec_g6IterationUtils(PyObject* module); /*proto*/ static PyModuleDef_Slot __pyx_moduledef_slots[] = { {Py_mod_create, (void*)__pyx_pymod_create}, {Py_mod_exec, (void*)__pyx_pymod_exec_g6IterationUtils}, #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING {Py_mod_gil, __Pyx_FREETHREADING_COMPATIBLE}, #endif #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, #endif {0, NULL} }; #endif #ifdef __cplusplus namespace { struct PyModuleDef __pyx_moduledef = #else static struct PyModuleDef __pyx_moduledef = #endif { PyModuleDef_HEAD_INIT, "g6IterationUtils", __pyx_k_Cython_wrapper_for_the_Edge_Add, /* m_doc */ #if CYTHON_USE_MODULE_STATE sizeof(__pyx_mstatetype), /* m_size */ #else (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */ #endif __pyx_methods /* m_methods */, #if CYTHON_PEP489_MULTI_PHASE_INIT __pyx_moduledef_slots, /* m_slots */ #else NULL, /* m_reload */ #endif #if CYTHON_USE_MODULE_STATE __pyx_m_traverse, /* m_traverse */ __pyx_m_clear, /* m_clear */ NULL /* m_free */ #else NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ #endif }; #ifdef __cplusplus } /* anonymous namespace */ #endif /* PyModInitFuncType */ #ifndef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #else #ifdef __cplusplus #define __Pyx_PyMODINIT_FUNC extern "C" PyObject * #else #define __Pyx_PyMODINIT_FUNC PyObject * #endif #endif __Pyx_PyMODINIT_FUNC PyInit_g6IterationUtils(void) CYTHON_SMALL_CODE; /*proto*/ __Pyx_PyMODINIT_FUNC PyInit_g6IterationUtils(void) #if CYTHON_PEP489_MULTI_PHASE_INIT { return PyModuleDef_Init(&__pyx_moduledef); } /* ModuleCreationPEP489 */ #if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) { { PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think if (!module) { PyErr_Clear(); // just try the 3.8-3.12 version module = PyImport_ImportModule("_xxsubinterpreters"); if (!module) goto bad; } PyObject *current = PyObject_CallMethod(module, "get_current", NULL); Py_DECREF(module); if (!current) goto bad; if (PyTuple_Check(current)) { PyObject *new_current = PySequence_GetItem(current, 0); Py_DECREF(current); current = new_current; if (!new_current) goto bad; } long long as_c_int = PyLong_AsLongLong(current); Py_DECREF(current); return as_c_int; } bad: PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n"); return -1; } #endif #if !CYTHON_USE_MODULE_STATE static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { static PY_INT64_T main_interpreter_id = -1; #if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); #elif CYTHON_COMPILING_IN_GRAAL PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); #elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId(); #elif CYTHON_COMPILING_IN_LIMITED_API PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get()); #else PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); #endif if (unlikely(current_id == -1)) { return -1; } if (main_interpreter_id == -1) { main_interpreter_id = current_id; return 0; } else if (unlikely(main_interpreter_id != current_id)) { PyErr_SetString( PyExc_ImportError, "Interpreter change detected - this module can only be loaded into one interpreter per process."); return -1; } return 0; } #endif static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { if (allow_none || value != Py_None) { result = PyDict_SetItemString(moddict, to_name, value); } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Clear(); } else { result = -1; } return result; } static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; CYTHON_UNUSED_VAR(def); #if !CYTHON_USE_MODULE_STATE if (__Pyx_check_single_interpreter()) return NULL; #endif if (__pyx_m) return __Pyx_NewRef(__pyx_m); modname = PyObject_GetAttrString(spec, "name"); if (unlikely(!modname)) goto bad; module = PyModule_NewObject(modname); Py_DECREF(modname); if (unlikely(!module)) goto bad; moddict = PyModule_GetDict(module); if (unlikely(!moddict)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; return module; bad: Py_XDECREF(module); return NULL; } static CYTHON_SMALL_CODE int __pyx_pymod_exec_g6IterationUtils(PyObject *__pyx_pyinit_module) #endif { int stringtab_initialized = 0; #if CYTHON_USE_MODULE_STATE int pystate_addmodule_run = 0; #endif __pyx_mstatetype *__pyx_mstate = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; Py_ssize_t __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannyDeclarations #if CYTHON_PEP489_MULTI_PHASE_INIT if (__pyx_m) { if (__pyx_m == __pyx_pyinit_module) return 0; PyErr_SetString(PyExc_RuntimeError, "Module 'g6IterationUtils' has already been imported. Re-initialisation is not supported."); return -1; } #else if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif /*--- Module creation code ---*/ #if CYTHON_PEP489_MULTI_PHASE_INIT __pyx_t_1 = __pyx_pyinit_module; Py_INCREF(__pyx_t_1); #else __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) #endif #if CYTHON_USE_MODULE_STATE { int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef); __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "g6IterationUtils" pseudovariable */ if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) pystate_addmodule_run = 1; } #else __pyx_m = __pyx_t_1; #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED); #endif __pyx_mstate = __pyx_mstate_global; CYTHON_UNUSED_VAR(__pyx_t_1); __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_mstate->__pyx_d); __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) /* ImportRefnannyAPI */ #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("PyInit_g6IterationUtils", 0); __Pyx_init_runtime_version(); if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Library function declarations ---*/ /*--- Initialize various global constants etc. ---*/ if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) stringtab_initialized = 1; if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error) if (__pyx_module_is_main_planarity__full__g6IterationUtils) { if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) } { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "planarity.full.g6IterationUtils")) { if (unlikely((PyDict_SetItemString(modules, "planarity.full.g6IterationUtils", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) } } /*--- Builtin init code ---*/ if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Global type/function init code ---*/ (void)__Pyx_modinit_global_init_code(__pyx_mstate); (void)__Pyx_modinit_variable_export_code(__pyx_mstate); (void)__Pyx_modinit_function_export_code(__pyx_mstate); if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) if (unlikely((__Pyx_modinit_type_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) (void)__Pyx_modinit_variable_import_code(__pyx_mstate); if (unlikely((__Pyx_modinit_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Execution code ---*/ /* "planarity/full/g6IterationUtils.pyx":14 * from planarity.full cimport graph * * from planarity.full import graphLib # <<<<<<<<<<<<<< * * */ { PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_graphLib}; __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_planarity_full, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) } __pyx_t_2 = __pyx_t_1; __Pyx_GOTREF(__pyx_t_2); { PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_graphLib}; __pyx_t_3 = 0; { __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/g6IterationUtils.pyx":56 * graphLib.g6_FreeReader(&self._g6ReadIterator) * * def g6_InitReaderWithString(self, str inputString) -> None: # <<<<<<<<<<<<<< * """Initializes the G6 read iterator with a string to use as the * input sourceof G6-encoded graphs. */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 56, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_5g6_InitReaderWithString, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6ReadIterator_g6_InitReaderWith, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator, __pyx_mstate_global->__pyx_n_u_g6_InitReaderWithString, __pyx_t_4) < (0)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/g6IterationUtils.pyx":76 * ) * * def g6_InitReaderWithFileName(self, str infileName) -> None: # <<<<<<<<<<<<<< * """Initializes the G6 read iterator with the name of a file to use as the * input source of G6-encoded graphs. */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 76, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_7g6_InitReaderWithFileName, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6ReadIterator_g6_InitReaderWith_2, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator, __pyx_mstate_global->__pyx_n_u_g6_InitReaderWithFileName, __pyx_t_2) < (0)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/g6IterationUtils.pyx":96 * ) * * def g6_ReadGraph(self) -> None: # <<<<<<<<<<<<<< * """Reads a G6-encoded graph from the input source. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 96, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_9g6_ReadGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6ReadIterator_g6_ReadGraph, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator, __pyx_mstate_global->__pyx_n_u_g6_ReadGraph, __pyx_t_4) < (0)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/g6IterationUtils.pyx":108 * ) * * def g6_EndReached(self) -> int: # <<<<<<<<<<<<<< * """Indicates whether or not the end of the input source has been reached. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 108, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_11g6_EndReached, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6ReadIterator_g6_EndReached, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator, __pyx_mstate_global->__pyx_n_u_g6_EndReached, __pyx_t_2) < (0)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/g6IterationUtils.pyx":115 * return graphLib.g6_EndReached(self._g6ReadIterator) * * def g6_FreeReader(self) -> None: # <<<<<<<<<<<<<< * """Frees the underlying G6 read iterator. Although the __dealloc__() * will do so if the API user does not, it is cleanest to directly call */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 115, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_13g6_FreeReader, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6ReadIterator_g6_FreeReader, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6ReadIterator, __pyx_mstate_global->__pyx_n_u_g6_FreeReader, __pyx_t_4) < (0)) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_15__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6ReadIterator___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_14G6ReadIterator_17__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6ReadIterator___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 3, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/g6IterationUtils.pyx":193 * ) * * def g6_InitWriterWithString(self) -> None: # <<<<<<<<<<<<<< * """Initializes the G6 write iterator with an internal string to use as the * output source that will receive G6-encoded graphs. */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 193, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_5g6_InitWriterWithString, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6WriteIterator_g6_InitWriterWit, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator, __pyx_mstate_global->__pyx_n_u_g6_InitWriterWithString, __pyx_t_2) < (0)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/g6IterationUtils.pyx":207 * ) * * def g6_InitWriterWithFileName(self, str outfileName) -> None: # <<<<<<<<<<<<<< * """Initializes the G6 write iterator with the name of a file to use as the * output source that will receive G6-encoded graphs. */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 207, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_7g6_InitWriterWithFileName, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6WriteIterator_g6_InitWriterWit_2, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator, __pyx_mstate_global->__pyx_n_u_g6_InitWriterWithFileName, __pyx_t_4) < (0)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/g6IterationUtils.pyx":228 * ) * * def g6_WriteGraph(self) -> None: # <<<<<<<<<<<<<< * """Writes a G6-encoded graph to the output source. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 228, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_9g6_WriteGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6WriteIterator_g6_WriteGraph, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator, __pyx_mstate_global->__pyx_n_u_g6_WriteGraph, __pyx_t_2) < (0)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/g6IterationUtils.pyx":240 * ) * * def g6_FreeWriter(self) -> str | None: # <<<<<<<<<<<<<< * """Frees the underlying G6 write iterator. This method must be * called if the G6 write iterator was initialized to output to a string, */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_kp_u_str_None) < (0)) __PYX_ERR(0, 240, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_11g6_FreeWriter, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6WriteIterator_g6_FreeWriter, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_16g6IterationUtils_G6WriteIterator, __pyx_mstate_global->__pyx_n_u_g6_FreeWriter, __pyx_t_4) < (0)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_13__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6WriteIterator___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_16g6IterationUtils_15G6WriteIterator_15__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_G6WriteIterator___setstate_cytho, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_g6IterationUtils, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < (0)) __PYX_ERR(1, 3, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/g6IterationUtils.pyx":1 * #!/usr/bin/env python # <<<<<<<<<<<<<< * # cython: embedsignature=True * """ */ __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_4) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); if (__pyx_m) { if (__pyx_mstate->__pyx_d && stringtab_initialized) { __Pyx_AddTraceback("init planarity.full.g6IterationUtils", __pyx_clineno, __pyx_lineno, __pyx_filename); } #if !CYTHON_USE_MODULE_STATE Py_CLEAR(__pyx_m); #else Py_DECREF(__pyx_m); if (pystate_addmodule_run) { PyObject *tp, *value, *tb; PyErr_Fetch(&tp, &value, &tb); PyState_RemoveModule(&__pyx_moduledef); PyErr_Restore(tp, value, tb); } #endif } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init planarity.full.g6IterationUtils"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if CYTHON_PEP489_MULTI_PHASE_INIT return (__pyx_m != NULL) ? 0 : -1; #else return __pyx_m; #endif } /* #### Code section: pystring_table ### */ /* #### Code section: cached_builtins ### */ static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); /* Cached unbound methods */ __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items; __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type; __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop; __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type; __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values; return 0; } /* #### Code section: cached_constants ### */ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); __Pyx_RefNannyFinishContext(); return 0; } /* #### Code section: init_constants ### */ static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); { const struct { const unsigned int length: 9; } index[] = {{1},{44},{66},{68},{156},{35},{32},{34},{179},{87},{80},{99},{100},{94},{98},{64},{66},{1},{8},{7},{6},{2},{9},{50},{35},{10},{14},{14},{32},{34},{28},{28},{38},{40},{27},{15},{33},{35},{29},{39},{41},{29},{4},{2},{20},{18},{18},{10},{7},{17},{18},{21},{8},{13},{13},{13},{25},{23},{25},{23},{12},{13},{12},{7},{8},{14},{10},{11},{3},{13},{5},{8},{10},{8},{11},{12},{14},{31},{3},{11},{12},{10},{17},{13},{6},{6},{4},{12},{10},{12},{19},{23},{8},{6},{450},{47},{59},{59},{9},{39},{42},{113},{18},{59},{39}}; #if (CYTHON_COMPRESS_STRINGS) == 3 && __PYX_LIMITED_VERSION_HEX >= 0x030e0000 /* compression: zstd (1301 bytes) */ const char* const cstring = "(\265/\375`\245\014](\00067\2669\000\227\332\374\377\227\357\177O\245\377/\337\333/\375V\242\322\227e\254\360\233D\266[\341\001i\373\\\271\356\027W\324\226\022\016`\025\034\n\251\301\230\321\221R\202a\212\024\016\320\006\231\000\232\000\237\0006S\351Bq\215\300d`2\357\3575\207?v\361[J\353\372\005\332\252\371\225\337)\016k\272F\003\346\357\375n\234\374\3758\311i5\272g\322d\006\322\352\245\341\236v\273_\177\377Ms\311\002\371\330\377{fbL\253\354:K{\255\014uN\3660&Y\264~q\322\376\321\305\364\366\233/N~\277\373\307\376o\231\314\3771\231\333\230JNir\226\303\373m\016%\367\330\272\323\375\335\306\322\3471\241\001\263\246\365\034l\226\357\356\\\302\310\276\377\226u\225\272K\373\370\322\03102\235v\336\237\317Y\301\226\257;\324|\345\263~I$\271;7\312\325@\216o\3671\231\221`\034\312Hr4S\\\233\263bzow\367\221\254sh\345\234_C\373{N\331qHeo\245\316\226\337:{~\355w\235\247\265\324%\363\231/\242/\331\217MO\017k[&c7\247\007\366\"#q\377\342T\262$\216\321\354\003>\307t\346o\267\327\337\327J\217\231\365\355\264\353\234\251G\177N\355\177\226\331H\220\177-\327e\276\035_\231\226\3749\247\270\306B.y\257?\364[\006>\033\317\305k\340\331\230\364:\232\030\232Z\024\275\212\002\224\302\217a\004I\365P(\024\ne\257\276\205\310MiU\262P 0\311\n\221\260\017\331\363\345\037bz\343\337\347\334z\357\277|N\031~\236w\330\177w\034r\243\3074\264\201 \377\236\213M\235\037\207V\317\231/-\232\223\027M~g\317w\352>_\375ifm\316\232C\331\234=\324\261\261ou\315?\367\016+Q\245\261\257t\367\231\357\374|q\345\237o\017\365\326\025\324\267\346\034\2472\243\177\315^o\214Q\0166'\216\216}Z\2659\276\22715\332\304\014\000^\r\035\301\207\337\312)%\325[\215V\334\021\223t\023\005(\203\013\013\037\304\203o%b]\204\312\007 \262\350\034\306\325x\"\"\351$T\276\204\225\252\247{\320\001\350Tc\322\316\265\263@\3601\210u\247\304\344zR\275\210\016\342j\343EL\211\266\035\335i0\240\004~-1@\224\013=\027\023B\001\252\341g\333i\264\306.R\021c\207\360\243\273\214ToG'\302d\220\362\001,\265x8\004>\200&\33380\nE\374^\234VV\274\033\224^LS\253\251\204""\242GA\360\2643\216\214t\304\211A\273\214\002\324\303\257\345\244\222\3521\250|t\307\3225 \370vv@:\016\335\t\323\001A\200\375\250\261\241A\010\311\210\310\210$IRh\0140\204\020\305l\254\016ri\250\003!\212B\0102B\244`d\304\002\005\005\005)J\265\030\244\204^\344\272\245\022\223\344}C?\241\361\274\317\321A7\t\262\206\315\236\034\350\016\232\264\244\021\235\301\026\352\312\245\030\257\010.\230\325ip\312\371u\002\224\257\233\2715S\032\263#A\252\034\312Q\236\243\303\335\003\004r( _S\242\241!\251\254!\330\222\335\005\007\272\242\374\220Yt\331\360\353\002\231\244\251\217U\000\361\265\nS\205\014\035\272\336\035\343\025\375{\233\032\313N\372E\250:={\321\331\236\017\231\345\224*K\232]i\266\204RlKZ\020Ex\005G\006>\210O\350\277|nn0&\377\254\177[\214\301\0051\021\277\005b-g\034\375:&U\243LM*<)M\275\365\361f\261w\224\343s\250\324.\203\224\200\332_\367>\304\022\254\247\034\336\004E~k\004\240\364\211H\323+\325\272\242\017M\034\035$*\221\217dM*I\244\\;~\242g\025\373\350%ue4\214(\320\321\201\332\315\226;\0311\306N\270(\312x\233\357\303b\231\230AZ\t`;\\\026\324\300%\201\375\022\266\302\300\317Ey\243{\020H\261\240R, KS])\224g\271 U\340\257]E\370pG\345\302\250\034V\310\344\231B\341n4\"\3165\204lP\230\2040\274\201\220\213\r\307d@\215\331\0355l\263\360.\346\241\262b\225~)\306w\256\016\245\177\t\221-\177\246\372\327\025\302X\365\332\242MA\n\024\ri!\"\301%\361\3338e\033\260\021\306\265\033r!\207\335\205o\244W\023\224R`\322L\364Y)K1\2337\323\246\215\345f!\341\014\211\025\374\001\220C\215uRb\304\353\207\242|\364\351\032\033(\006\207#\n\233\353\312\033*\231C\016\351\366\336<5j]q\025\355~[\000],G\350l\215\210\244%-\017\304^9#\326!U\353\221\232\302\207\024p\237q\306\302\361\206\351#\351\340\227\"\205\374\300\212\n"; PyObject *data = __Pyx_DecompressString(cstring, 1301, 3); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif #elif (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (1436 bytes) */ const char* const cstring = "BZh91AY&SY)\230\322x\000\000\357\377\377\355\377\377\377\374\377\255\337\257\375\372\330\277\377\377\365\300@@@@@@@\000@@@@\000@\000P\005\257m+\002\212\016\200\r\0160\224SHD\365?\325O\023\325\006L\214\236\223\320\324\3654z\232\006\206\000\230\365L\000\236F\232\206\217P=\252l\246a\246\240\224M\001\t\246\211\250l\223 \006\215\000\000\000\000\000\000\000\000\000\r\0063\324\244i\211\210\323\t\220\323\004\311\200\023\010di\210`\206\020\300\0012`\232\000\310p\000\000\003@\000\000\r\0004\000\003@\000\r\000\000\000\002D\2044\2152\032\231\032\247\2654\325\037\244\321\246P\300\001\031\000\014\000\004\000\323L4\0324\204\342g\212KI]\263\273\331{\236\222\323\244\252\327iFd\241S\210E,\330\271l\264C\n\003\205\330\231\377\250&\232\322\202|z\022\202h]s\204\257\034\304D\213M\306\221\206\221\316\261g\020/,X\245\374m\"\313\002\3629%M\r\027\245\316\327\216\014y\177DU\014t\325UGXW\002\006\0327\035v\010\351d\327\324\002\331]\310\321\234I\003\235:\231\025\300\236\323b[0\242\246,>\240/\035=)\177@\013\325\tV\006\266\264\224bX\257VG\022|k\312\356\306\242\024,}!H>\346\271\221\035\007=\\N$\326\307\004\234\221J;\0247\372\305\236O\237\026W\220J\006\006\264\221\345b\254\261\214u\002k\342\242\243\350\023\235F(E\036\372\212\256\240\352$\214\353\000l{L\2313\350\342\n\226*%\201\2238\2735\350\025W\007\362Ir\034\3348>\026\036\307\251\315\333\272\014\374V7\374\204\233I1 \220\264v\350u\215\357\300\217\305\361\001n\266k\3457f@\034{\212\262\351\027e\223Js\347\221\326\316X\373\375Aqu.-\213kj)Y\334\234\014}\272\305\000\034\211\303m\266\333cc\033lcm\2629\377\313\252\t\241X\214.\235i]\010\230\303;> +\017=\333\237\021E\352\201\222K\356\301\274@o\220\014B\030\330\362\003\260k\000\250T\002\245K@f\002\301X\225\202\030w\240\021g~r\001\211*\203\326\3029\221W\n\375\257\273=j\255\321\270\263n\370\274\253\003\026fW!\"\257\010\305\222y\302\025\354\302\322;P\202\256\265^K\004\177f\200\377\030\201\366\375\21036\236c,\357\374\310\301\215\261\243_\214\254\3642HSV&L\016\267\013Li\034\242\324UCI*\024\342t\364\300\r\354\003=""\246\242Gy\"\016\032\340\340ah\2439\305\031'<\326\310f\2406\274;\2737\031\370!\330i\261\235(\035\347>@D\366a\"|\232\017 f\266%\266\210)\317\314.\024\2517\225\241\246)\275\001x\n\366\001\275\035\340\t\201 \255#\020\"\334\244\030\251\032\371\200\352B\206\202\023\264\235\242(1\273S(\334\206\342\227\035\314f\200\333K@\224\033\333\223\206(i\276\360\022W\331m\252\375\326\004\274U2\245\374\215t\261!\2004\026n\230\263\321K\036L\013\214\325\215%\276q\221\264?\016\216\203\254V\342\004\316\271i\314^\222XH\264T|\213\014\25499\365\343ni\t\354\255],\303Bt\351~\021\341v\217A\3101Z\225\3446\025\202\023\000m\264\014\001\345.\312Z\306\320667A\001\340s;)\345\263\200\t9g!\231g\300\004\345\244\2418\0276Jm\0148j;S\337'\2171.5\017\341{\03765\354\246C \250BT\223{L\270\236\220\"\204\205L\225\027\300/f""\260[%\361h\231x\177z\241\224\330\266+\345\236\360\251\337\377\333\036\256\215\241`\270\252\372\222'\241\006\321 F\214+!\3670\316T?S\356\014E\271e\314\351\202\\nr\270M\227?C\027D8\250%\256\326\361C\252w\006\323j\377\261\026\330\216\371hq\246\2664\343\0323\205\207\214\002nOa\274G\200S\370\354\t?\014\250\271\342\226\022\000\r\214\010\313\026.75U\303\331u\315\354f\357\334\263\223\014\217~\230v(n?\350\375\220\004\211\365\321\246\030\353\340\241\200\036\232K\005\213ER\035J\256hP\261\355\334\217\020\256\372\213'\325\344xB\303'\033\004'ou\312<\237\251\224Bb\014\371\300\331\003\022\204T\001=\350fv\020K\350\326J\262\017K\313\316$\375\2623Q\274\202\274\032\221\350\326H\235\231\201If\263\200\034\361\310\356k\325\240?\020\360\2227\236\315Hq6\240e'\375\236\341d&\301I7\244\223\333\375NN\373;\3517\016'\323\320N\356h89\263\341d\306\322\311\314e\267\260\034\317\235\276\357L\177\322]X;\236;\376\262\273\261\335\271\322Y\357\354\367.\275{t\247\365E\353\327\366no\346Jk\245Mz\263s\335\302\267'k\247\363\316\364b\373\267\250\021\223\030`\253\361\356\253K\013\335\205\257\217\327\216\357w\357>\352\024s\216\336;\331<\275f\216\376\036\277\023\357\037O\365.\201\307\364\321\307\235\265\211G\377\231\352\025.\037}\325\332\355\026\026\333\344t\006\242m\177\026\221H\307k9\256n\264\367O\2578\3233G\353\335\017P\364V\2646R\236\276\355\314\335h\223\366~T\2106\023\344\347}d1\272\032m\246\220\263)\344+p\264~\364w\333\213\346z3\327\333\353\355\2271x\234mM\265\346[\346\242;[4\232\367z\263\037\265^Dw\342\"\3046s\265\365]4\325\233\275\326\n\242bo\376\303\336\365O\023\207\227\235\351\217[/\243\335\310\217\213\335\3027'\305\204\322!/nL,/\375\212\374\324\231zM\236\226\216\305h?.\304\233\023a\377\002\333\320\014#"; PyObject *data = __Pyx_DecompressString(cstring, 1295, 1); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif #else /* compression: none (3493 bytes) */ const char* const bytes = ".Failed to convert C string to Python string.G6ReadIterator's underlying g6ReadIterator has already been freed.G6WriteIterator's underlying g6WriteIterator has already been freed.G6WriteIterator was initialized with string, but you did not call g6_FreeWriter(), so you have not received the string to which the .g6 graphs were written.Graph to populate is not allocated.Graph to write is not allocated.Graph to write is not initialized.Note that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.Unable to initialize G6ReadIterator, as call to g6_NewReader() in EAPS graphLib failed.Unable to initialize G6WriteIterator, as g6_NewWriter() in EAPS graphLib failed.Unable to initialize reader with inputString, as g6_InitReaderWithString() in EAPS graphLib failed.Unable to initialize reader with infileName, as g6_InitReaderWithFileName() in EAPS graphLib failed.Unable to initialize writer with string, as g6_InitWriterWithString() in EAPS graphLib failed.Unable to initialize writer with filename, as g6_InitWriterWithFileName() in EAPS graphLib failed.Unable to read graph, as g6_ReadGraph() in EAPS graphLib failed.Unable to write graph, as g6_WriteGraph() in EAPS graphLib failed.?add_notedisableenablegcisenabledno default __reduce__ due to non-trivial __cinit__planarity/full/g6IterationUtils.pyxstr | NoneG6ReadIteratorG6ReadIterator.__reduce_cython__G6ReadIterator.__setstate_cython__G6ReadIterator.g6_EndReachedG6ReadIterator.g6_FreeReaderG6ReadIterator.g6_InitReaderWithStringG6ReadIterator.g6_InitReaderWithFileNameG6ReadIterator.g6_ReadGraphG6WriteIteratorG6WriteIterator.__reduce_cython__G6WriteIterator.__setstate_cython__G6WriteIterator.g6_FreeWriterG6WriteIterator.g6_InitWriterWithStringG6WriteIterator.g6_InitWriterWithFileNameG6WriteIterator.g6_WriteGraphNoneOK__Pyx_PyDict_NextRefasyncio.coroutinescline_in_tracebackcurr_graphencodedencodedInfileN""ameencodedInputStringencodedOutputFileName__func__g6_EndReachedg6_FreeReaderg6_FreeWriterg6_InitReaderWithFileNameg6_InitReaderWithStringg6_InitWriterWithFileNameg6_InitWriterWithStringg6_ReadGraphg6_WriteGraph__getstate__gp_GetNgraphLibgraph_to_writeinfileNameinputStringint_is_coroutineitems__main____module____name__outfileNameoutput_bytesplanarity.fullplanarity.full.g6IterationUtilspop__pyx_state__qualname____reduce____reduce_cython____reduce_ex__resultreturnself__set_name__setdefault__setstate____setstate_cython__string_conversion_error__test__valuesint (G6ReadIteratorP *, graphP)\000int (G6ReadIteratorP)\000\000int (G6ReadIteratorP, char *)\000\000int (G6WriteIteratorP *, graphP)\000int (G6WriteIteratorP)\000int (G6WriteIteratorP, char *)\000int (G6WriteIteratorP, char **)\000void (G6ReadIteratorP *)\000void (G6WriteIteratorP *)\000g6_NewReader\000g6_EndReached\000g6_ReadGraph\000g6_InitReaderWithFileName\000g6_InitReaderWithString\000g6_NewWriter\000g6_WriteGraph\000g6_InitWriterWithFileName\000g6_InitWriterWithString\000g6_FreeReader\000g6_FreeWriter\320\004)\250\021\360\016\000\t\032\320\0311\260\021\260$\3206I\310\022\3104\310q\330\010\013\2107\220#\220X\230Q\330\014\022\220,\230a\330\020\021\320\004;\2701\360\024\000\t\036\230Z\240w\250a\250q\330\010-\250Q\340\010\031\320\0313\2601\260D\3208J\310!\330\010\013\2107\220#\220X\230Q\330\014\022\220,\230a\330\020\021\320\004<\270A\360\026\000\t\036\230[\250\007\250q\260\001\330\0101\260\021\340\010\031\320\0313\2601\260D\3208K\3101\330\010\013\2107\220#\220X\230Q\330\014\022\220,\230a\330\020\021\200\001\330\004\n\210+\220Q\320\004\036\230a\360\014\000\t\032\230\035\240a\240t\2501\330\010\013\2107\220#\220X\230Q\330\014\022\220,\230a\330\020\021\320\004\037\230q\360\022\000\t\014\2104\320\017 \240\003\2401\330\014\022\220,\230a\330\020\021\360\006\000\021\037\230a\230q\240\004\240A\320\004\037\230q\360\"\000\t\014\2104\320\017!\240\023\240A\330\014\022\220,\230a\330\020\021\360\020\000\021\037\230a\230q\240\004""\240A\340\010\013\2104\210\177\230c\240\021\330\014\033\2304\230~\250Q\330\014\020\220\001\220\024\220Q\330\014\020\320\020!\240\021\330\014\r\330\020\027\220|\2407\250!\2501\330\014\023\220=\240\001\330\020\026\220l\240!\330\024\025\330\033\034\320\004\037\230q\360\n\000\t\030\220~\240Q\240d\250!\320\004:\270!\360\024\000\t\036\230[\250\007\250q\260\001\330\010.\250a\340\010\031\320\0311\260\021\260$\3206H\310\001\330\010\013\2107\220#\220X\230Q\330\014\022\220,\230a\330\020\021\320\004\037\230q\360\014\000\t\032\230\036\240q\250\004\250A\330\010\013\2107\220#\220X\230Q\330\014\022\220,\230a\330\020\021"; PyObject *data = NULL; CYTHON_UNUSED_VAR(__Pyx_DecompressString); #endif PyObject **stringtab = __pyx_mstate->__pyx_string_tab; Py_ssize_t pos = 0; for (int i = 0; i < 94; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); if (likely(string) && i >= 27) PyUnicode_InternInPlace(&string); if (unlikely(!string)) { Py_XDECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } stringtab[i] = string; pos += bytes_length; } for (int i = 94; i < 105; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); stringtab[i] = string; pos += bytes_length; if (unlikely(!string)) { Py_XDECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } } Py_XDECREF(data); for (Py_ssize_t i = 0; i < 105; i++) { if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { __PYX_ERR(0, 1, __pyx_L1_error) } } #if CYTHON_IMMORTAL_CONSTANTS { PyObject **table = stringtab + 94; for (Py_ssize_t i=0; i<11; ++i) { #if PY_VERSION_HEX >= 0x030F0000 PyUnstable_SetImmortal(table[i]); #elif CYTHON_COMPILING_IN_CPYTHON_FREETHREADING if ((PY_SSIZE_T_MAX <= _Py_IMMORTAL_REFCNT_LOCAL)) break; #if PY_VERSION_HEX < 0x030E0000 if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1) #else if (PyUnstable_Object_IsUniquelyReferenced(table[i])) #endif { Py_SET_REFCNT(table[i], ((Py_ssize_t)_Py_IMMORTAL_REFCNT_LOCAL + 1)); } #else if ((PY_SSIZE_T_MAX < _Py_IMMORTAL_INITIAL_REFCNT)) break; Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); #endif } } #endif } { PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 0; int8_t const cint_constants_1[] = {0}; for (int i = 0; i < 1; i++) { numbertab[i] = PyLong_FromLong(cint_constants_1[i - 0]); if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error) } } #if CYTHON_IMMORTAL_CONSTANTS { PyObject **table = __pyx_mstate->__pyx_number_tab; for (Py_ssize_t i=0; i<1; ++i) { #if PY_VERSION_HEX >= 0x030F0000 PyUnstable_SetImmortal(table[i]); #elif CYTHON_COMPILING_IN_CPYTHON_FREETHREADING if ((PY_SSIZE_T_MAX <= _Py_IMMORTAL_REFCNT_LOCAL)) break; #if PY_VERSION_HEX < 0x030E0000 if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1) #else if (PyUnstable_Object_IsUniquelyReferenced(table[i])) #endif { Py_SET_REFCNT(table[i], ((Py_ssize_t)_Py_IMMORTAL_REFCNT_LOCAL + 1)); } #else if ((PY_SSIZE_T_MAX < _Py_IMMORTAL_INITIAL_REFCNT)) break; Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); #endif } } #endif return 0; __pyx_L1_error:; return -1; } /* #### Code section: init_codeobjects ### */ typedef struct { unsigned int argcount : 2; unsigned int num_posonly_args : 1; unsigned int num_kwonly_args : 1; unsigned int nlocals : 3; unsigned int flags : 10; unsigned int first_line : 8; } __Pyx_PyCode_New_function_description; /* NewCodeObj.proto */ static PyObject* __Pyx_PyCode_New( const __Pyx_PyCode_New_function_description descr, PyObject * const *varnames, PyObject *filename, PyObject *funcname, PyObject *line_table, PyObject *tuple_dedup_map ); static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { PyObject* tuple_dedup_map = PyDict_New(); if (unlikely(!tuple_dedup_map)) return -1; { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 56}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_inputString, __pyx_mstate->__pyx_n_u_encoded, __pyx_mstate->__pyx_n_u_encodedInputString, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_g6_InitReaderWithString, __pyx_mstate->__pyx_kp_b_iso88591_q_a_1_6H_7_XQ_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 76}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_infileName, __pyx_mstate->__pyx_n_u_encoded, __pyx_mstate->__pyx_n_u_encodedInfileName, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_g6_InitReaderWithFileName, __pyx_mstate->__pyx_kp_b_iso88591_1_Zwaq_Q_31D8J_7_XQ_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 96}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_g6_ReadGraph, __pyx_mstate->__pyx_kp_b_iso88591_a_at1_7_XQ_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 108}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_g6_EndReached, __pyx_mstate->__pyx_kp_b_iso88591_q_Qd, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 115}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_g6_FreeReader, __pyx_mstate->__pyx_kp_b_iso88591_q_4_1_a_aq_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 193}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_g6_InitWriterWithString, __pyx_mstate->__pyx_kp_b_iso88591_1_6I_4q_7_XQ_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 207}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_outfileName, __pyx_mstate->__pyx_n_u_encoded, __pyx_mstate->__pyx_n_u_encodedOutputFileName, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_g6_InitWriterWithFileName, __pyx_mstate->__pyx_kp_b_iso88591_A_q_1_31D8K1_7_XQ_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 228}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_g6_WriteGraph, __pyx_mstate->__pyx_kp_b_iso88591_q_q_A_7_XQ_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 240}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_output_bytes, __pyx_mstate->__pyx_n_u_string_conversion_error}; __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_g6IterationUtils_2, __pyx_mstate->__pyx_n_u_g6_FreeWriter, __pyx_mstate->__pyx_kp_b_iso88591_q_4_A_a_aq_A_4_c_4_Q_Q_7_1_l, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad; } Py_DECREF(tuple_dedup_map); return 0; bad: Py_DECREF(tuple_dedup_map); return -1; } /* #### Code section: init_globals ### */ static int __Pyx_InitGlobals(void) { /* PythonCompatibility.init */ if (likely(__Pyx_init_co_variables() == 0)); else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) /* CommonTypesMetaclass.init */ if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) /* CachedMethodType.init */ #if CYTHON_COMPILING_IN_LIMITED_API { PyObject *typesModule=NULL; typesModule = PyImport_ImportModule("types"); if (typesModule) { __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType"); Py_DECREF(typesModule); } } // error handling follows #endif if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) /* CythonFunctionShared.init */ if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } /* #### Code section: cleanup_globals ### */ /* #### Code section: cleanup_module ### */ /* #### Code section: main_method ### */ /* #### Code section: utility_code_pragmas ### */ #ifdef _MSC_VER #pragma warning( push ) /* Warning 4127: conditional expression is constant * Cython uses constant conditional expressions to allow in inline functions to be optimized at * compile-time, so this warning is not useful */ #pragma warning( disable : 4127 ) #endif /* #### Code section: utility_code_def ### */ /* --- Runtime support code --- */ /* Refnanny */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule(modname); if (!m) goto end; p = PyObject_GetAttrString(m, "RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* TupleAndListFromArray (used by fastcall) */ #if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL static CYTHON_INLINE PyObject * __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) { PyObject *res; Py_ssize_t i; if (n <= 0) { return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); } res = PyTuple_New(n); if (unlikely(res == NULL)) return NULL; for (i = 0; i < n; i++) { Py_INCREF(src[i]); if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { Py_DECREF(res); return NULL; } } return res; } #elif CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { PyObject *v; Py_ssize_t i; for (i = 0; i < length; i++) { v = dest[i] = src[i]; Py_INCREF(v); } } static CYTHON_INLINE PyObject * __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) { PyObject *res; if (n <= 0) { return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); } res = PyTuple_New(n); if (unlikely(res == NULL)) return NULL; __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); return res; } static CYTHON_INLINE PyObject * __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) { PyObject *res; if (n <= 0) { return PyList_New(0); } res = PyList_New(n); if (unlikely(res == NULL)) return NULL; __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); return res; } #endif /* BytesEquals (used by UnicodeEquals) */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\ !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) return PyObject_RichCompareBool(s1, s2, equals); #else if (s1 == s2) { return (equals == Py_EQ); } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { const char *ps1, *ps2; Py_ssize_t length = PyBytes_GET_SIZE(s1); if (length != PyBytes_GET_SIZE(s2)) return (equals == Py_NE); ps1 = PyBytes_AS_STRING(s1); ps2 = PyBytes_AS_STRING(s2); if (ps1[0] != ps2[0]) { return (equals == Py_NE); } else if (length == 1) { return (equals == Py_EQ); } else { int result; #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) Py_hash_t hash1, hash2; hash1 = ((PyBytesObject*)s1)->ob_shash; hash2 = ((PyBytesObject*)s2)->ob_shash; if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { return (equals == Py_NE); } #endif result = memcmp(ps1, ps2, (size_t)length); return (equals == Py_EQ) ? (result == 0) : (result != 0); } } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { return (equals == Py_NE); } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { return (equals == Py_NE); } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); Py_DECREF(py_result); return result; } #endif } /* UnicodeEquals (used by fastcall) */ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL return PyObject_RichCompareBool(s1, s2, equals); #else int s1_is_unicode, s2_is_unicode; if (s1 == s2) { goto return_eq; } s1_is_unicode = PyUnicode_CheckExact(s1); s2_is_unicode = PyUnicode_CheckExact(s2); if (s1_is_unicode & s2_is_unicode) { Py_ssize_t length, length2; int kind; void *data1, *data2; #if !CYTHON_COMPILING_IN_LIMITED_API if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) return -1; #endif length = __Pyx_PyUnicode_GET_LENGTH(s1); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(length < 0)) return -1; #endif length2 = __Pyx_PyUnicode_GET_LENGTH(s2); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(length2 < 0)) return -1; #endif if (length != length2) { goto return_ne; } #if CYTHON_USE_UNICODE_INTERNALS { Py_hash_t hash1, hash2; hash1 = ((PyASCIIObject*)s1)->hash; hash2 = ((PyASCIIObject*)s2)->hash; if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { goto return_ne; } } #endif kind = __Pyx_PyUnicode_KIND(s1); if (kind != __Pyx_PyUnicode_KIND(s2)) { goto return_ne; } data1 = __Pyx_PyUnicode_DATA(s1); data2 = __Pyx_PyUnicode_DATA(s2); if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { goto return_ne; } else if (length == 1) { goto return_eq; } else { int result = memcmp(data1, data2, (size_t)(length * kind)); return (equals == Py_EQ) ? (result == 0) : (result != 0); } } else if ((s1 == Py_None) & s2_is_unicode) { goto return_ne; } else if ((s2 == Py_None) & s1_is_unicode) { goto return_ne; } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); Py_DECREF(py_result); return result; } return_eq: return (equals == Py_EQ); return_ne: return (equals == Py_NE); #endif } /* fastcall */ #if CYTHON_METH_FASTCALL static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) { Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(n == -1)) return NULL; #endif for (i = 0; i < n; i++) { PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely(!namei)) return NULL; #endif if (s == namei) return kwvalues[i]; } for (i = 0; i < n; i++) { PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely(!namei)) return NULL; #endif int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ); if (unlikely(eq != 0)) { if (unlikely(eq < 0)) return NULL; return kwvalues[i]; } } return NULL; } #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { Py_ssize_t i, nkwargs; PyObject *dict; #if !CYTHON_ASSUME_SAFE_SIZE nkwargs = PyTuple_Size(kwnames); if (unlikely(nkwargs < 0)) return NULL; #else nkwargs = PyTuple_GET_SIZE(kwnames); #endif dict = PyDict_New(); if (unlikely(!dict)) return NULL; for (i=0; itp_call; if (unlikely(!call)) return PyObject_Call(func, arg, kw); if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) return NULL; result = (*call)(func, arg, kw); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* PyObjectCallMethO (used by PyObjectFastCall) */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { PyObject *self, *result; PyCFunction cfunc; cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); self = __Pyx_CyOrPyCFunction_GET_SELF(func); if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) return NULL; result = cfunc(self, arg); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* PyObjectFastCall (used by PyObjectCallOneArg) */ #if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) { PyObject *argstuple; PyObject *result = 0; size_t i; argstuple = PyTuple_New((Py_ssize_t)nargs); if (unlikely(!argstuple)) return NULL; for (i = 0; i < nargs; i++) { Py_INCREF(args[i]); if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad; } result = __Pyx_PyObject_Call(func, argstuple, kwargs); bad: Py_DECREF(argstuple); return result; } #endif #if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API #if PY_VERSION_HEX < 0x03090000 #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable) #elif CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) { PyTypeObject *tp = Py_TYPE(callable); #if defined(__Pyx_CyFunction_USED) if (__Pyx_CyFunction_CheckExact(callable)) { return __Pyx_CyFunction_func_vectorcall(callable); } #endif if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) { return NULL; } assert(PyCallable_Check(callable)); Py_ssize_t offset = tp->tp_vectorcall_offset; assert(offset > 0); vectorcallfunc ptr; memcpy(&ptr, (char *) callable + offset, sizeof(ptr)); return ptr; } #else #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable) #endif #endif static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) { Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); #if CYTHON_COMPILING_IN_CPYTHON if (nargs == 0 && kwargs == NULL) { if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) return __Pyx_PyObject_CallMethO(func, NULL); } else if (nargs == 1 && kwargs == NULL) { if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) return __Pyx_PyObject_CallMethO(func, args[0]); } #endif if (kwargs == NULL) { #if CYTHON_VECTORCALL #if CYTHON_COMPILING_IN_LIMITED_API return PyObject_Vectorcall(func, args, _nargs, NULL); #else vectorcallfunc f = __Pyx_PyVectorcall_Function(func); if (f) { return f(func, args, _nargs, NULL); } #endif #endif } if (nargs == 0) { return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs); } #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); #else return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); #endif } /* PyObjectCallOneArg (used by CallUnboundCMethod0) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *args[2] = {NULL, arg}; return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } /* PyObjectGetAttrStr (used by UnpackUnboundCMethod) */ #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); return PyObject_GetAttr(obj, attr_name); } #endif /* UnpackUnboundCMethod (used by CallUnboundCMethod0) */ #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { PyObject *result; PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); if (unlikely(!selfless_args)) return NULL; result = PyObject_Call(method, selfless_args, kwargs); Py_DECREF(selfless_args); return result; } #elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000 static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { return _PyObject_Vectorcall (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames); } #else static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { return #if PY_VERSION_HEX < 0x03090000 _PyObject_Vectorcall #else PyObject_Vectorcall #endif (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames); } #endif static PyMethodDef __Pyx_UnboundCMethod_Def = { "CythonUnboundCMethod", __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall), #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 METH_VARARGS | METH_KEYWORDS, #else METH_FASTCALL | METH_KEYWORDS, #endif NULL }; static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { PyObject *method, *result=NULL; method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); if (unlikely(!method)) return -1; result = method; #if CYTHON_COMPILING_IN_CPYTHON if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) { PyMethodDescrObject *descr = (PyMethodDescrObject*) method; target->func = descr->d_method->ml_meth; target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); } else #endif #if CYTHON_COMPILING_IN_PYPY #else if (PyCFunction_Check(method)) #endif { PyObject *self; int self_found; #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY self = PyObject_GetAttrString(method, "__self__"); if (!self) { PyErr_Clear(); } #else self = PyCFunction_GET_SELF(method); #endif self_found = (self && self != Py_None); #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY Py_XDECREF(self); #endif if (self_found) { PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method); if (unlikely(!unbound_method)) return -1; Py_DECREF(method); result = unbound_method; } } #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING if (unlikely(target->method)) { Py_DECREF(result); } else #endif target->method = result; return 0; } /* CallUnboundCMethod0 */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); if (likely(was_initialized == 2 && cfunc->func)) { if (likely(cfunc->flag == METH_NOARGS)) return __Pyx_CallCFunction(cfunc, self, NULL); if (likely(cfunc->flag == METH_FASTCALL)) return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0); if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL); if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS))) return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL); if (cfunc->flag == METH_VARARGS) return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple); return __Pyx__CallUnboundCMethod0(cfunc, self); } #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING else if (unlikely(was_initialized == 1)) { __Pyx_CachedCFunction tmp_cfunc = { #ifndef __cplusplus 0 #endif }; tmp_cfunc.type = cfunc->type; tmp_cfunc.method_name = cfunc->method_name; return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self); } #endif PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self); __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); return result; } #endif static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { PyObject *result; if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; result = __Pyx_PyObject_CallOneArg(cfunc->method, self); return result; } /* py_dict_items (used by OwnedDictNext) */ static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) { return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d); } /* py_dict_values (used by OwnedDictNext) */ static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) { return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d); } /* OwnedDictNext (used by ParseKeywordsImpl) */ #if CYTHON_AVOID_BORROWED_REFS static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) { PyObject *next = NULL; if (!*ppos) { if (pvalue) { PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p); if (unlikely(!dictview)) goto bad; *ppos = PyObject_GetIter(dictview); Py_DECREF(dictview); } else { *ppos = PyObject_GetIter(p); } if (unlikely(!*ppos)) goto bad; } next = PyIter_Next(*ppos); if (!next) { if (PyErr_Occurred()) goto bad; return 0; } if (pkey && pvalue) { *pkey = __Pyx_PySequence_ITEM(next, 0); if (unlikely(*pkey)) goto bad; *pvalue = __Pyx_PySequence_ITEM(next, 1); if (unlikely(*pvalue)) goto bad; Py_DECREF(next); } else if (pkey) { *pkey = next; } else { assert(pvalue); *pvalue = next; } return 1; bad: Py_XDECREF(next); #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef"); #else PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef); #endif if (pkey) *pkey = NULL; if (pvalue) *pvalue = NULL; return 0; } #else // !CYTHON_AVOID_BORROWED_REFS static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) { int result = PyDict_Next(p, ppos, pkey, pvalue); if (likely(result == 1)) { if (pkey) Py_INCREF(*pkey); if (pvalue) Py_INCREF(*pvalue); } return result; } #endif /* RaiseDoubleKeywords (used by ParseKeywordsImpl) */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, "%s() got multiple values for keyword argument '%U'", func_name, kw_name); } /* CallUnboundCMethod2 */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); if (likely(was_initialized == 2 && cfunc->func)) { PyObject *args[2] = {arg1, arg2}; if (cfunc->flag == METH_FASTCALL) { return __Pyx_CallCFunctionFast(cfunc, self, args, 2); } if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL); } #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING else if (unlikely(was_initialized == 1)) { __Pyx_CachedCFunction tmp_cfunc = { #ifndef __cplusplus 0 #endif }; tmp_cfunc.type = cfunc->type; tmp_cfunc.method_name = cfunc->method_name; return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2); } #endif PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2); __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); return result; } #endif static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){ if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; #if CYTHON_COMPILING_IN_CPYTHON if (cfunc->func && (cfunc->flag & METH_VARARGS)) { PyObject *result = NULL; PyObject *args = PyTuple_New(2); if (unlikely(!args)) return NULL; Py_INCREF(arg1); PyTuple_SET_ITEM(args, 0, arg1); Py_INCREF(arg2); PyTuple_SET_ITEM(args, 1, arg2); if (cfunc->flag & METH_KEYWORDS) result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL); else result = __Pyx_CallCFunction(cfunc, self, args); Py_DECREF(args); return result; } #endif { PyObject *args[4] = {NULL, self, arg1, arg2}; return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } } /* ParseKeywordsImpl (used by ParseKeywords) */ static int __Pyx_ValidateDuplicatePosArgs( PyObject *kwds, PyObject ** const argnames[], PyObject ** const *first_kw_arg, const char* function_name) { PyObject ** const *name = argnames; while (name != first_kw_arg) { PyObject *key = **name; int found = PyDict_Contains(kwds, key); if (unlikely(found)) { if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; } name++; } return 0; bad: return -1; } #if CYTHON_USE_UNICODE_INTERNALS static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) { int kind; Py_ssize_t len = PyUnicode_GET_LENGTH(s1); if (len != PyUnicode_GET_LENGTH(s2)) return 0; kind = PyUnicode_KIND(s1); if (kind != PyUnicode_KIND(s2)) return 0; const void *data1 = PyUnicode_DATA(s1); const void *data2 = PyUnicode_DATA(s2); return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0); } #endif static int __Pyx_MatchKeywordArg_str( PyObject *key, PyObject ** const argnames[], PyObject ** const *first_kw_arg, size_t *index_found, const char *function_name) { PyObject ** const *name; #if CYTHON_USE_UNICODE_INTERNALS Py_hash_t key_hash = ((PyASCIIObject*)key)->hash; if (unlikely(key_hash == -1)) { key_hash = PyObject_Hash(key); if (unlikely(key_hash == -1)) goto bad; } #endif name = first_kw_arg; while (*name) { PyObject *name_str = **name; #if CYTHON_USE_UNICODE_INTERNALS if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) { *index_found = (size_t) (name - argnames); return 1; } #else #if CYTHON_ASSUME_SAFE_SIZE if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) #endif { int cmp = PyUnicode_Compare(name_str, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { *index_found = (size_t) (name - argnames); return 1; } } #endif name++; } name = argnames; while (name != first_kw_arg) { PyObject *name_str = **name; #if CYTHON_USE_UNICODE_INTERNALS if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) { if (__Pyx_UnicodeKeywordsEqual(name_str, key)) goto arg_passed_twice; } #else #if CYTHON_ASSUME_SAFE_SIZE if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) #endif { if (unlikely(name_str == key)) goto arg_passed_twice; int cmp = PyUnicode_Compare(name_str, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; } #endif name++; } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; bad: return -1; } static int __Pyx_MatchKeywordArg_nostr( PyObject *key, PyObject ** const argnames[], PyObject ** const *first_kw_arg, size_t *index_found, const char *function_name) { PyObject ** const *name; if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type; name = first_kw_arg; while (*name) { int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); if (cmp == 1) { *index_found = (size_t) (name - argnames); return 1; } if (unlikely(cmp == -1)) goto bad; name++; } name = argnames; while (name != first_kw_arg) { int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); if (unlikely(cmp != 0)) { if (cmp == 1) goto arg_passed_twice; else goto bad; } name++; } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%.200s() keywords must be strings", function_name); goto bad; bad: return -1; } static CYTHON_INLINE int __Pyx_MatchKeywordArg( PyObject *key, PyObject ** const argnames[], PyObject ** const *first_kw_arg, size_t *index_found, const char *function_name) { return likely(PyUnicode_CheckExact(key)) ? __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) : __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name); } static void __Pyx_RejectUnknownKeyword( PyObject *kwds, PyObject ** const argnames[], PyObject ** const *first_kw_arg, const char *function_name) { #if CYTHON_AVOID_BORROWED_REFS PyObject *pos = NULL; #else Py_ssize_t pos = 0; #endif PyObject *key = NULL; __Pyx_BEGIN_CRITICAL_SECTION(kwds); while ( #if CYTHON_AVOID_BORROWED_REFS __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL) #else PyDict_Next(kwds, &pos, &key, NULL) #endif ) { PyObject** const *name = first_kw_arg; while (*name && (**name != key)) name++; if (!*name) { size_t index_found = 0; int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); if (cmp != 1) { if (cmp == 0) { PyErr_Format(PyExc_TypeError, "%s() got an unexpected keyword argument '%U'", function_name, key); } #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(key); #endif break; } } #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(key); #endif } __Pyx_END_CRITICAL_SECTION(); #if CYTHON_AVOID_BORROWED_REFS Py_XDECREF(pos); #endif assert(PyErr_Occurred()); } static int __Pyx_ParseKeywordDict( PyObject *kwds, PyObject ** const argnames[], PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs) { PyObject** const *name; PyObject** const *first_kw_arg = argnames + num_pos_args; Py_ssize_t extracted = 0; #if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; #endif name = first_kw_arg; while (*name && num_kwargs > extracted) { PyObject * key = **name; PyObject *value; int found = 0; #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 found = PyDict_GetItemRef(kwds, key, &value); #else value = PyDict_GetItemWithError(kwds, key); if (value) { Py_INCREF(value); found = 1; } else { if (unlikely(PyErr_Occurred())) goto bad; } #endif if (found) { if (unlikely(found < 0)) goto bad; values[name-argnames] = value; extracted++; } name++; } if (num_kwargs > extracted) { if (ignore_unknown_kwargs) { if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1)) goto bad; } else { __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name); goto bad; } } return 0; bad: return -1; } static int __Pyx_ParseKeywordDictToDict( PyObject *kwds, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject** const *name; PyObject** const *first_kw_arg = argnames + num_pos_args; Py_ssize_t len; #if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; #endif if (PyDict_Update(kwds2, kwds) < 0) goto bad; name = first_kw_arg; while (*name) { PyObject *key = **name; PyObject *value; #if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop)) int found = PyDict_Pop(kwds2, key, &value); if (found) { if (unlikely(found < 0)) goto bad; values[name-argnames] = value; } #elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 int found = PyDict_GetItemRef(kwds2, key, &value); if (found) { if (unlikely(found < 0)) goto bad; values[name-argnames] = value; if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad; } #else #if CYTHON_COMPILING_IN_CPYTHON value = _PyDict_Pop(kwds2, key, kwds2); #else value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2); #endif if (value == kwds2) { Py_DECREF(value); } else { if (unlikely(!value)) goto bad; values[name-argnames] = value; } #endif name++; } len = PyDict_Size(kwds2); if (len > 0) { return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name); } else if (unlikely(len == -1)) { goto bad; } return 0; bad: return -1; } static int __Pyx_ParseKeywordsTuple( PyObject *kwds, PyObject * const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs) { PyObject *key = NULL; PyObject** const * name; PyObject** const *first_kw_arg = argnames + num_pos_args; for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) { #if CYTHON_AVOID_BORROWED_REFS key = __Pyx_PySequence_ITEM(kwds, pos); #else key = __Pyx_PyTuple_GET_ITEM(kwds, pos); #endif #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely(!key)) goto bad; #endif name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { PyObject *value = kwvalues[pos]; values[name-argnames] = __Pyx_NewRef(value); } else { size_t index_found = 0; int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); if (cmp == 1) { PyObject *value = kwvalues[pos]; values[index_found] = __Pyx_NewRef(value); } else { if (unlikely(cmp == -1)) goto bad; if (kwds2) { PyObject *value = kwvalues[pos]; if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else if (!ignore_unknown_kwargs) { goto invalid_keyword; } } } #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(key); key = NULL; #endif } return 0; invalid_keyword: PyErr_Format(PyExc_TypeError, "%s() got an unexpected keyword argument '%U'", function_name, key); goto bad; bad: #if CYTHON_AVOID_BORROWED_REFS Py_XDECREF(key); #endif return -1; } /* ParseKeywords */ static int __Pyx_ParseKeywords( PyObject *kwds, PyObject * const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs) { if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); else if (kwds2) return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name); else return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); } /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } /* ArgTypeTestFunc (used by ArgTypeTest) */ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) { __Pyx_TypeName type_name; __Pyx_TypeName obj_type_name; PyObject *extra_info = __pyx_mstate_global->__pyx_empty_unicode; int from_annotation_subclass = 0; if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } else if (!exact) { if (likely(__Pyx_TypeCheck(obj, type))) return 1; } else if (exact == 2) { if (__Pyx_TypeCheck(obj, type)) { from_annotation_subclass = 1; extra_info = __pyx_mstate_global->__pyx_kp_u_Note_that_Cython_is_deliberately; } } type_name = __Pyx_PyType_GetFullyQualifiedName(type); obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); PyErr_Format(PyExc_TypeError, "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME ", got " __Pyx_FMT_TYPENAME ")" #if __PYX_LIMITED_VERSION_HEX < 0x030C0000 "%s%U" #endif , name, type_name, obj_type_name #if __PYX_LIMITED_VERSION_HEX < 0x030C0000 , (from_annotation_subclass ? ". " : ""), extra_info #endif ); #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 if (exact == 2 && from_annotation_subclass) { PyObject *res; PyObject *vargs[2]; vargs[0] = PyErr_GetRaisedException(); vargs[1] = extra_info; res = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_kp_u_add_note, vargs, 2, NULL); Py_XDECREF(res); PyErr_SetRaisedException(vargs[0]); } #endif __Pyx_DECREF_TypeName(type_name); __Pyx_DECREF_TypeName(obj_type_name); return 0; } /* PyObjectFastCallMethod */ #if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) { PyObject *result; PyObject *attr = PyObject_GetAttr(args[0], name); if (unlikely(!attr)) return NULL; result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1); Py_DECREF(attr); return result; } #endif /* GetTopmostException (used by SaveResetException) */ #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) { _PyErr_StackItem *exc_info = tstate->exc_info; while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && exc_info->previous_item != NULL) { exc_info = exc_info->previous_item; } return exc_info; } #endif /* SaveResetException */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); PyObject *exc_value = exc_info->exc_value; if (exc_value == NULL || exc_value == Py_None) { *value = NULL; *type = NULL; *tb = NULL; } else { *value = exc_value; Py_INCREF(*value); *type = (PyObject*) Py_TYPE(exc_value); Py_INCREF(*type); *tb = PyException_GetTraceback(exc_value); } #elif CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); *type = exc_info->exc_type; *value = exc_info->exc_value; *tb = exc_info->exc_traceback; Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); #else *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); #endif } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 _PyErr_StackItem *exc_info = tstate->exc_info; PyObject *tmp_value = exc_info->exc_value; exc_info->exc_value = value; Py_XDECREF(tmp_value); Py_XDECREF(type); Py_XDECREF(tb); #else PyObject *tmp_type, *tmp_value, *tmp_tb; #if CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = type; exc_info->exc_value = value; exc_info->exc_traceback = tb; #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = type; tstate->exc_value = value; tstate->exc_traceback = tb; #endif Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #endif } #endif /* PyErrExceptionMatches */ #if CYTHON_FAST_THREAD_STATE static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(tuple); for (i=0; i= 0x030C00A6 PyObject *current_exception = tstate->current_exception; if (unlikely(!current_exception)) return 0; exc_type = (PyObject*) Py_TYPE(current_exception); if (exc_type == err) return 1; #else exc_type = tstate->curexc_type; if (exc_type == err) return 1; if (unlikely(!exc_type)) return 0; #endif #if CYTHON_AVOID_BORROWED_REFS Py_INCREF(exc_type); #endif if (unlikely(PyTuple_Check(err))) { result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); } else { result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); } #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(exc_type); #endif return result; } #endif /* GetException */ #if CYTHON_FAST_THREAD_STATE static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) #else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #endif { PyObject *local_type = NULL, *local_value, *local_tb = NULL; #if CYTHON_FAST_THREAD_STATE PyObject *tmp_type, *tmp_value, *tmp_tb; #if PY_VERSION_HEX >= 0x030C0000 local_value = tstate->current_exception; tstate->current_exception = 0; #else local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; #endif #elif __PYX_LIMITED_VERSION_HEX > 0x030C0000 local_value = PyErr_GetRaisedException(); #else PyErr_Fetch(&local_type, &local_value, &local_tb); #endif #if __PYX_LIMITED_VERSION_HEX > 0x030C0000 if (likely(local_value)) { local_type = (PyObject*) Py_TYPE(local_value); Py_INCREF(local_type); local_tb = PyException_GetTraceback(local_value); } #else PyErr_NormalizeException(&local_type, &local_value, &local_tb); #if CYTHON_FAST_THREAD_STATE if (unlikely(tstate->curexc_type)) #else if (unlikely(PyErr_Occurred())) #endif goto bad; if (local_tb) { if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) goto bad; } #endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000 Py_XINCREF(local_tb); Py_XINCREF(local_type); Py_XINCREF(local_value); *type = local_type; *value = local_value; *tb = local_tb; #if CYTHON_FAST_THREAD_STATE #if CYTHON_USE_EXC_INFO_STACK { _PyErr_StackItem *exc_info = tstate->exc_info; #if PY_VERSION_HEX >= 0x030B00a4 tmp_value = exc_info->exc_value; exc_info->exc_value = local_value; tmp_type = NULL; tmp_tb = NULL; Py_XDECREF(local_type); Py_XDECREF(local_tb); #else tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = local_type; exc_info->exc_value = local_value; exc_info->exc_traceback = local_tb; #endif } #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = local_type; tstate->exc_value = local_value; tstate->exc_traceback = local_tb; #endif Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000 PyErr_SetHandledException(local_value); Py_XDECREF(local_value); Py_XDECREF(local_type); Py_XDECREF(local_tb); #else PyErr_SetExcInfo(local_type, local_value, local_tb); #endif return 0; #if __PYX_LIMITED_VERSION_HEX <= 0x030C0000 bad: *type = 0; *value = 0; *tb = 0; Py_XDECREF(local_type); Py_XDECREF(local_value); Py_XDECREF(local_tb); return -1; #endif } /* PyErrFetchRestore (used by RaiseException) */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { #if PY_VERSION_HEX >= 0x030C00A6 PyObject *tmp_value; assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); if (value) { #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) #endif PyException_SetTraceback(value, tb); } tmp_value = tstate->current_exception; tstate->current_exception = value; Py_XDECREF(tmp_value); Py_XDECREF(type); Py_XDECREF(tb); #else 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); #endif } static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { #if PY_VERSION_HEX >= 0x030C00A6 PyObject* exc_value; exc_value = tstate->current_exception; tstate->current_exception = 0; *value = exc_value; *type = NULL; *tb = NULL; if (exc_value) { *type = (PyObject*) Py_TYPE(exc_value); Py_INCREF(*type); #if CYTHON_COMPILING_IN_CPYTHON *tb = ((PyBaseExceptionObject*) exc_value)->traceback; Py_XINCREF(*tb); #else *tb = PyException_GetTraceback(exc_value); #endif } #else *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 } #endif /* RaiseException */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *instance_class = NULL; if (value && PyExceptionInstance_Check(value)) { instance_class = (PyObject*) Py_TYPE(value); if (instance_class != type) { int is_subclass = PyObject_IsSubclass(instance_class, type); if (!is_subclass) { instance_class = NULL; } else if (unlikely(is_subclass == -1)) { goto bad; } else { type = instance_class; } } } if (!instance_class) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyObject_Call(type, args, NULL); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } if (cause) { PyObject *fixed_cause; if (cause == Py_None) { fixed_cause = NULL; } else if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { #if PY_VERSION_HEX >= 0x030C00A6 PyException_SetTraceback(value, tb); #elif CYTHON_FAST_THREAD_STATE PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } #else PyObject *tmp_type, *tmp_value, *tmp_tb; PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); Py_INCREF(tb); PyErr_Restore(tmp_type, tmp_value, tb); Py_XDECREF(tmp_tb); #endif } bad: Py_XDECREF(owned_instance); return; } /* SwapException */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 _PyErr_StackItem *exc_info = tstate->exc_info; tmp_value = exc_info->exc_value; exc_info->exc_value = *value; if (tmp_value == NULL || tmp_value == Py_None) { Py_XDECREF(tmp_value); tmp_value = NULL; tmp_type = NULL; tmp_tb = NULL; } else { tmp_type = (PyObject*) Py_TYPE(tmp_value); Py_INCREF(tmp_type); #if CYTHON_COMPILING_IN_CPYTHON tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; Py_XINCREF(tmp_tb); #else tmp_tb = PyException_GetTraceback(tmp_value); #endif } #elif CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = *type; exc_info->exc_value = *value; exc_info->exc_traceback = *tb; #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = *type; tstate->exc_value = *value; tstate->exc_traceback = *tb; #endif *type = tmp_type; *value = tmp_value; *tb = tmp_tb; } #else static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); PyErr_SetExcInfo(*type, *value, *tb); *type = tmp_type; *value = tmp_value; *tb = tmp_tb; } #endif /* PyObjectGetAttrStrNoError (used by GetBuiltinName) */ #if __PYX_LIMITED_VERSION_HEX < 0x030d0000 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) __Pyx_PyErr_Clear(); } #endif static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { PyObject *result; #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 (void) PyObject_GetOptionalAttr(obj, attr_name, &result); return result; #else #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); } #endif result = __Pyx_PyObject_GetAttrStr(obj, attr_name); if (unlikely(!result)) { __Pyx_PyObject_GetAttrStr_ClearAttributeError(); } return result; #endif } /* GetBuiltinName (used by GetModuleGlobalName) */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name); if (unlikely(!result) && !PyErr_Occurred()) { PyErr_Format(PyExc_NameError, "name '%U' is not defined", name); } return result; } /* PyDictVersioning (used by GetModuleGlobalName) */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { PyObject *dict = Py_TYPE(obj)->tp_dict; return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; } static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { PyObject **dictptr = NULL; Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; if (offset) { #if CYTHON_COMPILING_IN_CPYTHON dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); #else dictptr = _PyObject_GetDictPtr(obj); #endif } return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; } static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { PyObject *dict = Py_TYPE(obj)->tp_dict; if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) return 0; return obj_dict_version == __Pyx_get_object_dict_version(obj); } #endif /* GetModuleGlobalName */ #if CYTHON_USE_DICT_VERSIONS static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) #else static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) #endif { PyObject *result; #if CYTHON_COMPILING_IN_LIMITED_API if (unlikely(!__pyx_m)) { if (!PyErr_Occurred()) PyErr_SetNone(PyExc_NameError); return NULL; } result = PyObject_GetAttr(__pyx_m, name); if (likely(result)) { return result; } PyErr_Clear(); #elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear(); __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { return result; } #else result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash); __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { return __Pyx_NewRef(result); } PyErr_Clear(); #endif return __Pyx_GetBuiltinName(name); } /* WriteUnraisableException */ static void __Pyx_WriteUnraisable(const char *name, int clineno, int lineno, const char *filename, int full_traceback, int nogil) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; __Pyx_PyThreadState_declare PyGILState_STATE state; if (nogil) state = PyGILState_Ensure(); else state = (PyGILState_STATE)0; CYTHON_UNUSED_VAR(clineno); CYTHON_UNUSED_VAR(lineno); CYTHON_UNUSED_VAR(filename); CYTHON_MAYBE_UNUSED_VAR(nogil); __Pyx_PyThreadState_assign __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); if (full_traceback) { Py_XINCREF(old_exc); Py_XINCREF(old_val); Py_XINCREF(old_tb); __Pyx_ErrRestore(old_exc, old_val, old_tb); PyErr_PrintEx(0); } ctx = PyUnicode_FromString(name); __Pyx_ErrRestore(old_exc, old_val, old_tb); if (!ctx) { PyErr_WriteUnraisable(Py_None); } else { PyErr_WriteUnraisable(ctx); Py_DECREF(ctx); } if (nogil) PyGILState_Release(state); } /* RejectKeywords */ static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) { PyObject *key = NULL; if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) { key = __Pyx_PySequence_ITEM(kwds, 0); } else { #if CYTHON_AVOID_BORROWED_REFS PyObject *pos = NULL; #else Py_ssize_t pos = 0; #endif #if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return; #endif __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL); #if CYTHON_AVOID_BORROWED_REFS Py_XDECREF(pos); #endif } if (likely(key)) { PyErr_Format(PyExc_TypeError, "%s() got an unexpected keyword argument '%U'", function_name, key); Py_DECREF(key); } } /* pybuiltin_invalid (used by pyint_simplify) */ static void __Pyx_PyBuiltin_Invalid(PyObject *obj, const char *type_name, const char *argname) { __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); if (argname) { PyErr_Format(PyExc_TypeError, "Argument '%.200s' has incorrect type (expected %.200s, got " __Pyx_FMT_TYPENAME ")", argname, type_name, obj_type_name ); } else { PyErr_Format(PyExc_TypeError, "Expected %.200s, got " __Pyx_FMT_TYPENAME, type_name, obj_type_name ); } __Pyx_DECREF_TypeName(obj_type_name); } /* pyint_simplify */ static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none) { PyObject *number = *number_var; if (likely((accept_none && number == Py_None) || PyLong_CheckExact(number))) { return 0; } PyObject *int_object; if (likely(PyNumber_Check(number))) { int_object = PyNumber_Long(number); if (unlikely(!int_object)) goto bad; } else { __Pyx_PyBuiltin_Invalid(number, "int", argname); goto bad; } *number_var = int_object; Py_DECREF(number); return 0; bad: *number_var = NULL; Py_DECREF(number); return -1; } /* PyLongCompare */ static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { CYTHON_MAYBE_UNUSED_VAR(intval); CYTHON_UNUSED_VAR(inplace); if (op1 == op2) { return 1; } #if CYTHON_USE_PYLONG_INTERNALS if (likely(PyLong_CheckExact(op1))) { int unequal; unsigned long uintval; Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); const digit* digits = __Pyx_PyLong_Digits(op1); if (intval == 0) { return (__Pyx_PyLong_IsZero(op1) == 1); } else if (intval < 0) { if (__Pyx_PyLong_IsNonNeg(op1)) return 0; intval = -intval; } else { if (__Pyx_PyLong_IsNeg(op1)) return 0; } uintval = (unsigned long) intval; #if PyLong_SHIFT * 4 < SIZEOF_LONG*8 if (uintval >> (PyLong_SHIFT * 4)) { unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); } else #endif #if PyLong_SHIFT * 3 < SIZEOF_LONG*8 if (uintval >> (PyLong_SHIFT * 3)) { unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); } else #endif #if PyLong_SHIFT * 2 < SIZEOF_LONG*8 if (uintval >> (PyLong_SHIFT * 2)) { unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); } else #endif #if PyLong_SHIFT * 1 < SIZEOF_LONG*8 if (uintval >> (PyLong_SHIFT * 1)) { unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); } else #endif unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); return (unequal == 0); } #endif if (PyFloat_CheckExact(op1)) { const long b = intval; double a = __Pyx_PyFloat_AS_DOUBLE(op1); return ((double)a == (double)b); } return __Pyx_PyObject_IsTrueAndDecref( PyObject_RichCompare(op1, op2, Py_EQ)); } /* decode_c_bytes (used by decode_bytes) */ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { if (unlikely((start < 0) | (stop < 0))) { if (start < 0) { start += length; if (start < 0) start = 0; } if (stop < 0) stop += length; } if (stop > length) stop = length; if (unlikely(stop <= start)) return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_unicode); length = stop - start; cstring += start; if (decode_func) { return decode_func(cstring, length, errors); } else { return PyUnicode_Decode(cstring, length, encoding, errors); } } /* AllocateExtensionType */ static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) { if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc); return alloc_func(t, 0); } else { newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc); #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 if (!tp_new) { PyObject *new_str = PyUnicode_FromString("__new__"); if (likely(new_str)) { PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL); Py_DECREF(new_str); return o; } else return NULL; } else #endif return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0); } } /* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */ #if CYTHON_COMPILING_IN_LIMITED_API static Py_ssize_t __Pyx_GetTypeDictOffset(void) { PyObject *tp_dictoffset_o; Py_ssize_t tp_dictoffset; tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__"); if (unlikely(!tp_dictoffset_o)) return -1; tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o); Py_DECREF(tp_dictoffset_o); if (unlikely(tp_dictoffset == 0)) { PyErr_SetString( PyExc_TypeError, "'type' doesn't have a dictoffset"); return -1; } else if (unlikely(tp_dictoffset < 0)) { PyErr_SetString( PyExc_TypeError, "'type' has an unexpected negative dictoffset. " "Please report this as Cython bug"); return -1; } return tp_dictoffset; } static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) { static Py_ssize_t tp_dictoffset = 0; if (unlikely(tp_dictoffset == 0)) { tp_dictoffset = __Pyx_GetTypeDictOffset(); if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) { tp_dictoffset = 0; // try again next time? return NULL; } } return *(PyObject**)((char*)tp + tp_dictoffset); } #endif /* SetItemOnTypeDict (used by FixUpExtensionType) */ static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) { int result; PyObject *tp_dict; #if CYTHON_COMPILING_IN_LIMITED_API tp_dict = __Pyx_GetTypeDict(tp); if (unlikely(!tp_dict)) return -1; #else tp_dict = tp->tp_dict; #endif result = PyDict_SetItem(tp_dict, k, v); if (likely(!result)) { PyType_Modified(tp); if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) { PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name, (PyObject *) tp, k, NULL); if (!setNameResult) return -1; Py_DECREF(setNameResult); } } return result; } /* FixUpExtensionType */ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { #if __PYX_LIMITED_VERSION_HEX > 0x030900B1 CYTHON_UNUSED_VAR(spec); CYTHON_UNUSED_VAR(type); CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); #else const PyType_Slot *slot = spec->slots; int changed = 0; #if !CYTHON_COMPILING_IN_LIMITED_API while (slot && slot->slot && slot->slot != Py_tp_members) slot++; if (slot && slot->slot == Py_tp_members) { #if !CYTHON_COMPILING_IN_CPYTHON const #endif // !CYTHON_COMPILING_IN_CPYTHON) PyMemberDef *memb = (PyMemberDef*) slot->pfunc; while (memb && memb->name) { if (memb->name[0] == '_' && memb->name[1] == '_') { if (strcmp(memb->name, "__weaklistoffset__") == 0) { assert(memb->type == T_PYSSIZET); assert(memb->flags == READONLY); type->tp_weaklistoffset = memb->offset; changed = 1; } else if (strcmp(memb->name, "__dictoffset__") == 0) { assert(memb->type == T_PYSSIZET); assert(memb->flags == READONLY); type->tp_dictoffset = memb->offset; changed = 1; } #if CYTHON_METH_FASTCALL else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { assert(memb->type == T_PYSSIZET); assert(memb->flags == READONLY); type->tp_vectorcall_offset = memb->offset; changed = 1; } #endif // CYTHON_METH_FASTCALL #if !CYTHON_COMPILING_IN_PYPY else if (strcmp(memb->name, "__module__") == 0) { PyObject *descr; assert(memb->type == T_OBJECT); assert(memb->flags == 0 || memb->flags == READONLY); descr = PyDescr_NewMember(type, memb); if (unlikely(!descr)) return -1; int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); Py_DECREF(descr); if (unlikely(set_item_result < 0)) { return -1; } changed = 1; } #endif // !CYTHON_COMPILING_IN_PYPY } memb++; } } #endif // !CYTHON_COMPILING_IN_LIMITED_API #if !CYTHON_COMPILING_IN_PYPY slot = spec->slots; while (slot && slot->slot && slot->slot != Py_tp_getset) slot++; if (slot && slot->slot == Py_tp_getset) { PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc; while (getset && getset->name) { if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) { PyObject *descr = PyDescr_NewGetSet(type, getset); if (unlikely(!descr)) return -1; #if CYTHON_COMPILING_IN_LIMITED_API PyObject *pyname = PyUnicode_FromString(getset->name); if (unlikely(!pyname)) { Py_DECREF(descr); return -1; } int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr); Py_DECREF(pyname); #else CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); #endif Py_DECREF(descr); if (unlikely(set_item_result < 0)) { return -1; } changed = 1; } ++getset; } } #else CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); #endif // !CYTHON_COMPILING_IN_PYPY if (changed) PyType_Modified(type); #endif // PY_VERSION_HEX > 0x030900B1 return 0; } /* PyObjectCallNoArg (used by PyObjectCallMethod0) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { PyObject *arg[2] = {NULL, NULL}; return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } /* PyObjectGetMethod (used by PyObjectCallMethod0) */ #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { PyObject *attr; #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP __Pyx_TypeName type_name; PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; descrgetfunc f = NULL; PyObject **dictptr, *dict; int meth_found = 0; assert (*method == NULL); if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { attr = __Pyx_PyObject_GetAttrStr(obj, name); goto try_unpack; } if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { return 0; } descr = _PyType_Lookup(tp, name); if (likely(descr != NULL)) { Py_INCREF(descr); #if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) #else #ifdef __Pyx_CyFunction_USED if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) #else if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) #endif #endif { meth_found = 1; } else { f = Py_TYPE(descr)->tp_descr_get; if (f != NULL && PyDescr_IsData(descr)) { attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); Py_DECREF(descr); goto try_unpack; } } } dictptr = _PyObject_GetDictPtr(obj); if (dictptr != NULL && (dict = *dictptr) != NULL) { Py_INCREF(dict); attr = __Pyx_PyDict_GetItemStr(dict, name); if (attr != NULL) { Py_INCREF(attr); Py_DECREF(dict); Py_XDECREF(descr); goto try_unpack; } Py_DECREF(dict); } if (meth_found) { *method = descr; return 1; } if (f != NULL) { attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); Py_DECREF(descr); goto try_unpack; } if (likely(descr != NULL)) { *method = descr; return 0; } type_name = __Pyx_PyType_GetFullyQualifiedName(tp); PyErr_Format(PyExc_AttributeError, "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", type_name, name); __Pyx_DECREF_TypeName(type_name); return 0; #else attr = __Pyx_PyObject_GetAttrStr(obj, name); goto try_unpack; #endif try_unpack: #if CYTHON_UNPACK_METHODS if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { PyObject *function = PyMethod_GET_FUNCTION(attr); Py_INCREF(function); Py_DECREF(attr); *method = function; return 1; } #endif *method = attr; return 0; } #endif /* PyObjectCallMethod0 (used by PyType_Ready) */ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) PyObject *args[1] = {obj}; (void) __Pyx_PyObject_CallOneArg; (void) __Pyx_PyObject_CallNoArg; return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); #else PyObject *method = NULL, *result = NULL; int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); if (likely(is_method)) { result = __Pyx_PyObject_CallOneArg(method, obj); Py_DECREF(method); return result; } if (unlikely(!method)) goto bad; result = __Pyx_PyObject_CallNoArg(method); Py_DECREF(method); bad: return result; #endif } /* ValidateBasesTuple (used by PyType_Ready) */ #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { Py_ssize_t i, n; #if CYTHON_ASSUME_SAFE_SIZE n = PyTuple_GET_SIZE(bases); #else n = PyTuple_Size(bases); if (unlikely(n < 0)) return -1; #endif for (i = 1; i < n; i++) { PyTypeObject *b; #if CYTHON_AVOID_BORROWED_REFS PyObject *b0 = PySequence_GetItem(bases, i); if (!b0) return -1; #elif CYTHON_ASSUME_SAFE_MACROS PyObject *b0 = PyTuple_GET_ITEM(bases, i); #else PyObject *b0 = PyTuple_GetItem(bases, i); if (!b0) return -1; #endif b = (PyTypeObject*) b0; if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) { __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b); PyErr_Format(PyExc_TypeError, "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); __Pyx_DECREF_TypeName(b_name); #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(b0); #endif return -1; } if (dictoffset == 0) { Py_ssize_t b_dictoffset = 0; #if CYTHON_USE_TYPE_SLOTS b_dictoffset = b->tp_dictoffset; #else PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__"); if (!py_b_dictoffset) goto dictoffset_return; b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset); Py_DECREF(py_b_dictoffset); if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return; #endif if (b_dictoffset) { { __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b); PyErr_Format(PyExc_TypeError, "extension type '%.200s' has no __dict__ slot, " "but base type '" __Pyx_FMT_TYPENAME "' has: " "either add 'cdef dict __dict__' to the extension type " "or add '__slots__ = [...]' to the base type", type_name, b_name); __Pyx_DECREF_TypeName(b_name); } #if !CYTHON_USE_TYPE_SLOTS dictoffset_return: #endif #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(b0); #endif return -1; } } #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(b0); #endif } return 0; } #endif /* PyType_Ready */ CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) { while (t) { PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); if (bases) { return 1; } t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*); } return 0; } static int __Pyx_PyType_Ready(PyTypeObject *t) { #if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION) (void)__Pyx_PyObject_CallMethod0; #if CYTHON_USE_TYPE_SPECS (void)__Pyx_validate_bases_tuple; #endif return PyType_Ready(t); #else int r; if (!__Pyx_PyType_HasMultipleInheritance(t)) { return PyType_Ready(t); } PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) return -1; #if !defined(PYSTON_MAJOR_VERSION) { int gc_was_enabled; #if PY_VERSION_HEX >= 0x030A00b1 gc_was_enabled = PyGC_Disable(); (void)__Pyx_PyObject_CallMethod0; #else PyObject *ret, *py_status; PyObject *gc = NULL; #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\ !CYTHON_COMPILING_IN_GRAAL gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc); #endif if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc); if (unlikely(!gc)) return -1; py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled); if (unlikely(!py_status)) { Py_DECREF(gc); return -1; } gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); Py_DECREF(py_status); if (gc_was_enabled > 0) { ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable); if (unlikely(!ret)) { Py_DECREF(gc); return -1; } Py_DECREF(ret); } else if (unlikely(gc_was_enabled == -1)) { Py_DECREF(gc); return -1; } #endif t->tp_flags |= Py_TPFLAGS_HEAPTYPE; #if PY_VERSION_HEX >= 0x030A0000 t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; #endif #else (void)__Pyx_PyObject_CallMethod0; #endif r = PyType_Ready(t); #if !defined(PYSTON_MAJOR_VERSION) t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; #if PY_VERSION_HEX >= 0x030A00b1 if (gc_was_enabled) PyGC_Enable(); #else if (gc_was_enabled) { PyObject *tp, *v, *tb; PyErr_Fetch(&tp, &v, &tb); ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable); if (likely(ret || r == -1)) { Py_XDECREF(ret); PyErr_Restore(tp, v, tb); } else { Py_XDECREF(tp); Py_XDECREF(v); Py_XDECREF(tb); r = -1; } } Py_DECREF(gc); #endif } #endif return r; #endif } /* DelItemOnTypeDict (used by SetupReduce) */ static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k) { int result; PyObject *tp_dict; #if CYTHON_COMPILING_IN_LIMITED_API tp_dict = __Pyx_GetTypeDict(tp); if (unlikely(!tp_dict)) return -1; #else tp_dict = tp->tp_dict; #endif result = PyDict_DelItem(tp_dict, k); if (likely(!result)) PyType_Modified(tp); return result; } /* SetupReduce */ static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; PyObject *name_attr; name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_mstate_global->__pyx_n_u_name); if (likely(name_attr)) { ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); } else { ret = -1; } if (unlikely(ret < 0)) { PyErr_Clear(); ret = 0; } Py_XDECREF(name_attr); return ret; } static int __Pyx_setup_reduce(PyObject* type_obj) { int ret = 0; PyObject *object_reduce = NULL; PyObject *object_getstate = NULL; PyObject *object_reduce_ex = NULL; PyObject *reduce = NULL; PyObject *reduce_ex = NULL; PyObject *reduce_cython = NULL; PyObject *setstate = NULL; PyObject *setstate_cython = NULL; PyObject *getstate = NULL; #if CYTHON_USE_PYTYPE_LOOKUP getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_getstate); #else getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_getstate); if (!getstate && PyErr_Occurred()) { goto __PYX_BAD; } #endif if (getstate) { #if CYTHON_USE_PYTYPE_LOOKUP object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate); #else object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate); if (!object_getstate && PyErr_Occurred()) { goto __PYX_BAD; } #endif if (object_getstate != getstate) { goto __PYX_GOOD; } } #if CYTHON_USE_PYTYPE_LOOKUP object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; #else object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; #endif reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; if (reduce_ex == object_reduce_ex) { #if CYTHON_USE_PYTYPE_LOOKUP object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD; #else object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD; #endif reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce); if (unlikely(!reduce)) goto __PYX_BAD; if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_mstate_global->__pyx_n_u_reduce_cython)) { reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); if (likely(reduce_cython)) { ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; } else if (reduce == object_reduce || PyErr_Occurred()) { goto __PYX_BAD; } setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate); if (!setstate) PyErr_Clear(); if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_mstate_global->__pyx_n_u_setstate_cython)) { setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); if (likely(setstate_cython)) { ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; } else if (!setstate || PyErr_Occurred()) { goto __PYX_BAD; } } PyType_Modified((PyTypeObject*)type_obj); } } goto __PYX_GOOD; __PYX_BAD: if (!PyErr_Occurred()) { __Pyx_TypeName type_obj_name = __Pyx_PyType_GetFullyQualifiedName((PyTypeObject*)type_obj); PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); __Pyx_DECREF_TypeName(type_obj_name); } ret = -1; __PYX_GOOD: #if !CYTHON_USE_PYTYPE_LOOKUP Py_XDECREF(object_reduce); Py_XDECREF(object_reduce_ex); Py_XDECREF(object_getstate); Py_XDECREF(getstate); #endif Py_XDECREF(reduce); Py_XDECREF(reduce_ex); Py_XDECREF(reduce_cython); Py_XDECREF(setstate); Py_XDECREF(setstate_cython); return ret; } /* TypeImport */ #ifndef __PYX_HAVE_RT_ImportType_3_2_6 #define __PYX_HAVE_RT_ImportType_3_2_6 static PyTypeObject *__Pyx_ImportType_3_2_6(PyObject *module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_2_6 check_size) { PyObject *result = 0; Py_ssize_t basicsize; Py_ssize_t itemsize; #if defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) PyObject *py_basicsize; PyObject *py_itemsize; #endif result = PyObject_GetAttrString(module, class_name); if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%.200s.%.200s is not a type object", module_name, class_name); goto bad; } #if !( defined(Py_LIMITED_API) || (defined(CYTHON_COMPILING_IN_LIMITED_API) && CYTHON_COMPILING_IN_LIMITED_API) ) basicsize = ((PyTypeObject *)result)->tp_basicsize; itemsize = ((PyTypeObject *)result)->tp_itemsize; #else if (size == 0) { return (PyTypeObject *)result; } py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); if (!py_basicsize) goto bad; basicsize = PyLong_AsSsize_t(py_basicsize); Py_DECREF(py_basicsize); py_basicsize = 0; if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); if (!py_itemsize) goto bad; itemsize = PyLong_AsSsize_t(py_itemsize); Py_DECREF(py_itemsize); py_itemsize = 0; if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; #endif if (itemsize) { if (size % alignment) { alignment = size % alignment; } if (itemsize < (Py_ssize_t)alignment) itemsize = (Py_ssize_t)alignment; } if ((size_t)(basicsize + itemsize) < size) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", module_name, class_name, size, basicsize+itemsize); goto bad; } if (check_size == __Pyx_ImportType_CheckSize_Error_3_2_6 && ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd-%zd from PyObject", module_name, class_name, size, basicsize, basicsize+itemsize); goto bad; } else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_2_6 && (size_t)basicsize > size) { if (PyErr_WarnFormat(NULL, 0, "%.200s.%.200s size changed, may indicate binary incompatibility. " "Expected %zd from C header, got %zd from PyObject", module_name, class_name, size, basicsize) < 0) { goto bad; } } return (PyTypeObject *)result; bad: Py_XDECREF(result); return NULL; } #endif /* PxdImportShared (used by FunctionImport) */ #ifndef __PYX_HAVE_RT_ImportFromPxd_3_2_6 #define __PYX_HAVE_RT_ImportFromPxd_3_2_6 static int __Pyx_ImportFromPxd_3_2_6(PyObject *module, const char *name, void **p, const char *sig, const char *what) { PyObject *d = 0; PyObject *cobj = 0; d = PyObject_GetAttrString(module, "__pyx_capi__"); if (!d) goto bad; #if (defined(Py_LIMITED_API) && Py_LIMITED_API >= 0x030d0000) || (!defined(Py_LIMITED_API) && PY_VERSION_HEX >= 0x030d0000) PyDict_GetItemStringRef(d, name, &cobj); #else cobj = PyDict_GetItemString(d, name); Py_XINCREF(cobj); #endif if (!cobj) { PyErr_Format(PyExc_ImportError, "%.200s does not export expected C %.8s %.200s", PyModule_GetName(module), what, name); goto bad; } if (!PyCapsule_IsValid(cobj, sig)) { PyErr_Format(PyExc_TypeError, "C %.8s %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", what, PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj)); goto bad; } *p = PyCapsule_GetPointer(cobj, sig); if (!(*p)) goto bad; Py_DECREF(d); Py_DECREF(cobj); return 0; bad: Py_XDECREF(d); Py_XDECREF(cobj); return -1; } #endif /* FunctionImport */ #ifndef __PYX_HAVE_RT_ImportFunction_3_2_6 #define __PYX_HAVE_RT_ImportFunction_3_2_6 static int __Pyx_ImportFunction_3_2_6(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { union { void (*fp)(void); void *p; } tmp; int result = __Pyx_ImportFromPxd_3_2_6(module, funcname, &tmp.p, sig, "function"); if (result == 0) { *f = tmp.fp; } return result; } #endif /* HasAttr (used by ImportImpl) */ #if __PYX_LIMITED_VERSION_HEX < 0x030d0000 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { PyObject *r; if (unlikely(!PyUnicode_Check(n))) { PyErr_SetString(PyExc_TypeError, "hasattr(): attribute name must be string"); return -1; } r = __Pyx_PyObject_GetAttrStrNoError(o, n); if (!r) { return (unlikely(PyErr_Occurred())) ? -1 : 0; } else { Py_DECREF(r); return 1; } } #endif /* ImportImpl (used by Import) */ static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) { PyObject *imported_module = PyImport_GetModule(qualname); if (unlikely(!imported_module)) { *module = NULL; if (PyErr_Occurred()) { return -1; } return 0; } *module = imported_module; return 1; } static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) { PyObject *imported_module; PyObject *top_level_package_name; Py_ssize_t i; int status, module_found; Py_ssize_t dot_index; module_found = __Pyx__Import_GetModule(qualname, &imported_module); if (unlikely(!module_found || module_found == -1)) { *module = NULL; return module_found; } if (imported_names) { for (i = 0; i < len_imported_names; i++) { PyObject *imported_name = imported_names[i]; #if __PYX_LIMITED_VERSION_HEX < 0x030d0000 int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name); #else int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name); if (unlikely(has_imported_attribute == -1)) goto error; #endif if (!has_imported_attribute) { goto not_found; } } *module = imported_module; return 1; } dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1); if (dot_index == -1) { *module = imported_module; return 1; } if (unlikely(dot_index == -2)) goto error; top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index); if (unlikely(!top_level_package_name)) goto error; Py_DECREF(imported_module); status = __Pyx__Import_GetModule(top_level_package_name, module); Py_DECREF(top_level_package_name); return status; error: Py_DECREF(imported_module); *module = NULL; return -1; not_found: Py_DECREF(imported_module); *module = NULL; return 0; } static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) { PyObject *module = 0; PyObject *empty_dict = 0; PyObject *from_list = 0; int module_found; if (!qualname) { qualname = name; } module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module); if (likely(module_found == 1)) { return module; } else if (unlikely(module_found == -1)) { return NULL; } empty_dict = PyDict_New(); if (unlikely(!empty_dict)) goto bad; if (imported_names) { #if CYTHON_COMPILING_IN_CPYTHON from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names); if (unlikely(!from_list)) goto bad; #else from_list = PyList_New(len_imported_names); if (unlikely(!from_list)) goto bad; for (Py_ssize_t i=0; i__pyx_d, level); } /* ImportFrom */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { const char* module_name_str = 0; PyObject* module_name = 0; PyObject* module_dot = 0; PyObject* full_name = 0; PyErr_Clear(); module_name_str = PyModule_GetName(module); if (unlikely(!module_name_str)) { goto modbad; } module_name = PyUnicode_FromString(module_name_str); if (unlikely(!module_name)) { goto modbad; } module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u_); if (unlikely(!module_dot)) { goto modbad; } full_name = PyUnicode_Concat(module_dot, name); if (unlikely(!full_name)) { goto modbad; } #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) ||\ CYTHON_COMPILING_IN_GRAAL { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) goto modbad; value = PyObject_GetItem(modules, full_name); } #else value = PyImport_GetModule(full_name); #endif modbad: Py_XDECREF(full_name); Py_XDECREF(module_dot); Py_XDECREF(module_name); } if (unlikely(!value)) { PyErr_Format(PyExc_ImportError, "cannot import name %S", name); } return value; } /* dict_setdefault (used by FetchCommonType) */ static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) { PyObject* value; #if __PYX_LIMITED_VERSION_HEX >= 0x030F0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4) PyDict_SetDefaultRef(d, key, default_value, &value); #elif CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000 PyObject *args[] = {d, key, default_value}; value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); #elif CYTHON_COMPILING_IN_LIMITED_API value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL); #else value = PyDict_SetDefault(d, key, default_value); if (unlikely(!value)) return NULL; Py_INCREF(value); #endif return value; } /* AddModuleRef (used by FetchSharedCythonModule) */ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) { PyObject *module_dict = PyImport_GetModuleDict(); PyObject *m; if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) { return NULL; } if (m != NULL && PyModule_Check(m)) { return m; } Py_XDECREF(m); m = PyModule_NewObject(name); if (m == NULL) return NULL; if (PyDict_CheckExact(module_dict)) { PyObject *new_m; (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m); Py_DECREF(m); return new_m; } else { if (PyObject_SetItem(module_dict, name, m) != 0) { Py_DECREF(m); return NULL; } return m; } } static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { PyObject *py_name = PyUnicode_FromString(name); if (!py_name) return NULL; PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name); Py_DECREF(py_name); return module; } #elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) #else static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { PyObject *module = PyImport_AddModule(name); Py_XINCREF(module); return module; } #endif /* FetchSharedCythonModule (used by FetchCommonType) */ static PyObject *__Pyx_FetchSharedCythonABIModule(void) { return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME); } /* FetchCommonType (used by CommonTypesMetaclass) */ #if __PYX_LIMITED_VERSION_HEX < 0x030C0000 static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases); if (result && metaclass) { PyObject *old_tp = (PyObject*)Py_TYPE(result); Py_INCREF((PyObject*)metaclass); #if __PYX_LIMITED_VERSION_HEX >= 0x03090000 Py_SET_TYPE(result, metaclass); #else result->ob_type = metaclass; #endif Py_DECREF(old_tp); } return result; } #else #define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b) #endif static int __Pyx_VerifyCachedType(PyObject *cached_type, const char *name, Py_ssize_t expected_basicsize) { Py_ssize_t basicsize; if (!PyType_Check(cached_type)) { PyErr_Format(PyExc_TypeError, "Shared Cython type %.200s is not a type object", name); return -1; } if (expected_basicsize == 0) { return 0; // size is inherited, nothing useful to check } #if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_basicsize; py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); if (unlikely(!py_basicsize)) return -1; basicsize = PyLong_AsSsize_t(py_basicsize); Py_DECREF(py_basicsize); py_basicsize = NULL; if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1; #else basicsize = ((PyTypeObject*) cached_type)->tp_basicsize; #endif if (basicsize != expected_basicsize) { PyErr_Format(PyExc_TypeError, "Shared Cython type %.200s has the wrong size, try recompiling", name); return -1; } return 0; } static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name; int get_item_ref_result; const char* object_name = strrchr(spec->name, '.'); object_name = object_name ? object_name+1 : spec->name; py_object_name = PyUnicode_FromString(object_name); if (!py_object_name) return NULL; abi_module = __Pyx_FetchSharedCythonABIModule(); if (!abi_module) goto done; abi_module_dict = PyModule_GetDict(abi_module); if (!abi_module_dict) goto done; get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type); if (get_item_ref_result == 1) { if (__Pyx_VerifyCachedType( cached_type, object_name, spec->basicsize) < 0) { goto bad; } goto done; } else if (unlikely(get_item_ref_result == -1)) { goto bad; } cached_type = __Pyx_PyType_FromMetaclass( metaclass, CYTHON_USE_MODULE_STATE ? module : abi_module, spec, bases); if (unlikely(!cached_type)) goto bad; if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type); if (unlikely(new_cached_type != cached_type)) { if (unlikely(!new_cached_type)) goto bad; Py_DECREF(cached_type); cached_type = new_cached_type; if (__Pyx_VerifyCachedType( cached_type, object_name, spec->basicsize) < 0) { goto bad; } goto done; } else { Py_DECREF(new_cached_type); } done: Py_XDECREF(abi_module); Py_DECREF(py_object_name); assert(cached_type == NULL || PyType_Check(cached_type)); return (PyTypeObject *) cached_type; bad: Py_XDECREF(cached_type); cached_type = NULL; goto done; } /* CommonTypesMetaclass (used by CythonFunctionShared) */ static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) { return PyUnicode_FromString(__PYX_ABI_MODULE_NAME); } #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) { PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types"); return NULL; } static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) { PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable"); return -1; } #endif static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = { {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL}, {0, 0, 0, 0, 0} }; static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = { {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset}, #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call}, {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call}, {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr}, #endif {0, 0} }; static PyType_Spec __pyx_CommonTypesMetaclass_spec = { __PYX_TYPE_MODULE_PREFIX "_common_types_metatype", 0, 0, Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | Py_TPFLAGS_DEFAULT, __pyx_CommonTypesMetaclass_slots }; static int __pyx_CommonTypesMetaclass_init(PyObject *module) { __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); PyObject *bases = PyTuple_Pack(1, &PyType_Type); if (unlikely(!bases)) { return -1; } mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases); Py_DECREF(bases); if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) { return -1; } return 0; } /* CallTypeTraverse (used by CythonFunctionShared) */ #if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) #else static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) { #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000 if (__Pyx_get_runtime_version() < 0x03090000) return 0; #endif if (!always_call) { PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*); unsigned long flags = PyType_GetFlags(base); if (flags & Py_TPFLAGS_HEAPTYPE) { return 0; } } Py_VISIT((PyObject*)Py_TYPE(o)); return 0; } #endif /* PyMethodNew (used by CythonFunctionShared) */ #if CYTHON_COMPILING_IN_LIMITED_API static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { PyObject *result; CYTHON_UNUSED_VAR(typ); if (!self) return __Pyx_NewRef(func); #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 { PyObject *args[] = {func, self}; result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL); } #else result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL); #endif return result; } #else static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { CYTHON_UNUSED_VAR(typ); if (!self) return __Pyx_NewRef(func); return PyMethod_New(func, self); } #endif /* PyVectorcallFastCallDict (used by CythonFunctionShared) */ #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) { PyObject *res = NULL; PyObject *kwnames; PyObject **newargs; PyObject **kwvalues; Py_ssize_t i; #if CYTHON_AVOID_BORROWED_REFS PyObject *pos; #else Py_ssize_t pos; #endif size_t j; PyObject *key, *value; unsigned long keys_are_strings; #if !CYTHON_ASSUME_SAFE_SIZE Py_ssize_t nkw = PyDict_Size(kw); if (unlikely(nkw == -1)) return NULL; #else Py_ssize_t nkw = PyDict_GET_SIZE(kw); #endif newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); if (unlikely(newargs == NULL)) { PyErr_NoMemory(); return NULL; } for (j = 0; j < nargs; j++) newargs[j] = args[j]; kwnames = PyTuple_New(nkw); if (unlikely(kwnames == NULL)) { PyMem_Free(newargs); return NULL; } kwvalues = newargs + nargs; pos = 0; i = 0; keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) { keys_are_strings &= #if CYTHON_COMPILING_IN_LIMITED_API PyType_GetFlags(Py_TYPE(key)); #else Py_TYPE(key)->tp_flags; #endif #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup; #else PyTuple_SET_ITEM(kwnames, i, key); #endif kwvalues[i] = value; i++; } if (unlikely(!keys_are_strings)) { PyErr_SetString(PyExc_TypeError, "keywords must be strings"); goto cleanup; } res = vc(func, newargs, nargs, kwnames); cleanup: #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(pos); #endif Py_DECREF(kwnames); for (i = 0; i < nkw; i++) Py_DECREF(kwvalues[i]); PyMem_Free(newargs); return res; } static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) { Py_ssize_t kw_size = likely(kw == NULL) ? 0 : #if !CYTHON_ASSUME_SAFE_SIZE PyDict_Size(kw); #else PyDict_GET_SIZE(kw); #endif if (kw_size == 0) { return vc(func, args, nargs, NULL); } #if !CYTHON_ASSUME_SAFE_SIZE else if (unlikely(kw_size == -1)) { return NULL; } #endif return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); } #endif /* CythonFunctionShared (used by CythonFunction) */ #if CYTHON_COMPILING_IN_LIMITED_API static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) { if (__Pyx_CyFunction_Check(func)) { return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc; } else if (PyCFunction_Check(func)) { return PyCFunction_GetFunction(func) == (PyCFunction) cfunc; } return 0; } static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) { int result; PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func); if (unlikely(!newFunc)) { PyErr_Clear(); // It's only an optimization, so don't throw an error return 0; } result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc); Py_DECREF(newFunc); return result; } return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc); } #else static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { if (PyMethod_Check(func)) { func = PyMethod_GET_FUNCTION(func); } return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; } #endif static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API __Pyx_Py_XDECREF_SET( __Pyx_CyFunction_GetClassObj(f), ((classobj) ? __Pyx_NewRef(classobj) : NULL)); #else __Pyx_Py_XDECREF_SET( ((PyCMethodObject *) (f))->mm_class, (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); #endif } static PyObject * __Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op) { if (unlikely(op->func_doc == NULL)) { #if CYTHON_COMPILING_IN_LIMITED_API op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); if (unlikely(!op->func_doc)) return NULL; #else if (((PyCFunctionObject*)op)->m_ml->ml_doc) { op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); if (unlikely(op->func_doc == NULL)) return NULL; } else { Py_INCREF(Py_None); return Py_None; } #endif } Py_INCREF(op->func_doc); return op->func_doc; } static PyObject * __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) { PyObject *result; CYTHON_UNUSED_VAR(closure); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_doc_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) { CYTHON_UNUSED_VAR(context); if (value == NULL) { value = Py_None; } Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->func_doc, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op) { if (unlikely(op->func_name == NULL)) { #if CYTHON_COMPILING_IN_LIMITED_API op->func_name = PyObject_GetAttrString(op->func, "__name__"); #else op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #endif if (unlikely(op->func_name == NULL)) return NULL; } Py_INCREF(op->func_name); return op->func_name; } static PyObject * __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) { PyObject *result = NULL; CYTHON_UNUSED_VAR(context); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_name_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) { CYTHON_UNUSED_VAR(context); if (unlikely(value == NULL || !PyUnicode_Check(value))) { PyErr_SetString(PyExc_TypeError, "__name__ must be set to a string object"); return -1; } Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->func_name, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(context); PyObject *result; __Pyx_BEGIN_CRITICAL_SECTION(op); Py_INCREF(op->func_qualname); result = op->func_qualname; __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) { CYTHON_UNUSED_VAR(context); if (unlikely(value == NULL || !PyUnicode_Check(value))) { PyErr_SetString(PyExc_TypeError, "__qualname__ must be set to a string object"); return -1; } Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->func_qualname, value); __Pyx_END_CRITICAL_SECTION(); return 0; } #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 static PyObject * __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(context); if (unlikely(op->func_dict == NULL)) { op->func_dict = PyDict_New(); if (unlikely(op->func_dict == NULL)) return NULL; } Py_INCREF(op->func_dict); return op->func_dict; } #endif static PyObject * __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(context); Py_INCREF(op->func_globals); return op->func_globals; } static PyObject * __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(op); CYTHON_UNUSED_VAR(context); Py_INCREF(Py_None); return Py_None; } static PyObject * __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) { PyObject* result = (op->func_code) ? op->func_code : Py_None; CYTHON_UNUSED_VAR(context); Py_INCREF(result); return result; } static int __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { int result = 0; PyObject *res = op->defaults_getter((PyObject *) op); if (unlikely(!res)) return -1; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS op->defaults_tuple = PyTuple_GET_ITEM(res, 0); Py_INCREF(op->defaults_tuple); op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); Py_INCREF(op->defaults_kwdict); #else op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); if (unlikely(!op->defaults_tuple)) result = -1; else { op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); if (unlikely(!op->defaults_kwdict)) result = -1; } #endif Py_DECREF(res); return result; } static int __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { PyErr_SetString(PyExc_TypeError, "__defaults__ must be set to a tuple object"); return -1; } PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " "currently affect the values used in function calls", 1); Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) { PyObject* result = op->defaults_tuple; if (unlikely(!result)) { if (op->defaults_getter) { if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_tuple; } else { result = Py_None; } } Py_INCREF(result); return result; } static PyObject * __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result = NULL; CYTHON_UNUSED_VAR(context); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_defaults_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; } else if (unlikely(value != Py_None && !PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__kwdefaults__ must be set to a dict object"); return -1; } PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " "currently affect the values used in function calls", 1); Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) { PyObject* result = op->defaults_kwdict; if (unlikely(!result)) { if (op->defaults_getter) { if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_kwdict; } else { result = Py_None; } } Py_INCREF(result); return result; } static PyObject * __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result; CYTHON_UNUSED_VAR(context); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_kwdefaults_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); if (!value || value == Py_None) { value = NULL; } else if (unlikely(!PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__annotations__ must be set to a dict object"); return -1; } Py_XINCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->func_annotations, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) { PyObject* result = op->func_annotations; if (unlikely(!result)) { result = PyDict_New(); if (unlikely(!result)) return NULL; op->func_annotations = result; } Py_INCREF(result); return result; } static PyObject * __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { PyObject *result; CYTHON_UNUSED_VAR(context); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_annotations_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static PyObject *__Pyx_CyFunction_annotate_impl(PyObject *self, PyObject *args) { CYTHON_UNUSED_VAR(args); if (unlikely(!self)) { PyErr_SetString(PyExc_SystemError, "cython __annotate__ called without 'self' argument"); } Py_XINCREF(self); return self; } static PyMethodDef __Pyx_CyFunction_annotate_method = { "__annotate__", (PyCFunction)(void (*)(void))__Pyx_CyFunction_annotate_impl, METH_VARARGS, "Placeholder __annotate__ function to allow 'functools.wraps' to work " "on Cython functions." }; static PyObject * __Pyx_CyFunction_get_annotate(PyObject *op_in, void *context) { CYTHON_UNUSED_VAR(context); PyObject *annotations = __Pyx_CyFunction_get_annotations((__pyx_CyFunctionObject *) op_in, NULL); if (unlikely(!annotations)) return NULL; PyObject *method = PyCFunction_New( &__Pyx_CyFunction_annotate_method, annotations); Py_DECREF(annotations); return method; } static int __Pyx_CyFunction_set_annotate(PyObject *op_in, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); if (value == NULL) { PyErr_SetString(PyExc_TypeError, "__annotate__ cannot be deleted"); return -1; } if (value == Py_None) { return 0; } PyObject *annotations = PyObject_CallObject(value, NULL); if (!annotations) return -1; int result = __Pyx_CyFunction_set_annotations((__pyx_CyFunctionObject *) op_in, annotations, NULL); Py_DECREF(annotations); return result; } static PyObject * __Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) { int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; if (is_coroutine) { PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine; fromlist = PyList_New(1); if (unlikely(!fromlist)) return NULL; Py_INCREF(marker); #if CYTHON_ASSUME_SAFE_MACROS PyList_SET_ITEM(fromlist, 0, marker); #else if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { Py_DECREF(fromlist); return NULL; } #endif module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0); Py_DECREF(fromlist); if (unlikely(!module)) goto ignore; is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker); Py_DECREF(module); if (likely(is_coroutine_value)) { return is_coroutine_value; } ignore: PyErr_Clear(); } return __Pyx_PyBool_FromLong(is_coroutine); } static PyObject * __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { PyObject *result; CYTHON_UNUSED_VAR(context); if (op->func_is_coroutine) { return __Pyx_NewRef(op->func_is_coroutine); } result = __Pyx_CyFunction_get_is_coroutine_value(op); if (unlikely(!result)) return NULL; __Pyx_BEGIN_CRITICAL_SECTION(op); if (op->func_is_coroutine) { Py_DECREF(result); result = __Pyx_NewRef(op->func_is_coroutine); } else { op->func_is_coroutine = __Pyx_NewRef(result); } __Pyx_END_CRITICAL_SECTION(); return result; } static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) { #if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); if (!py_name) return; PyErr_Format(PyExc_TypeError, "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", py_name, message, size); Py_DECREF(py_name); #else const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; PyErr_Format(PyExc_TypeError, "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", name, message, size); #endif } static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) { #if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); if (!py_name) return; PyErr_Format(PyExc_TypeError, "%.200S() %s", py_name, message); Py_DECREF(py_name); #else const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; PyErr_Format(PyExc_TypeError, "%.200s() %s", name, message); #endif } #if CYTHON_COMPILING_IN_LIMITED_API static PyObject * __Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(context); return PyObject_GetAttrString(op->func, "__module__"); } static int __Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); return PyObject_SetAttrString(op->func, "__module__", value); } #endif static PyGetSetDef __pyx_CyFunction_getsets[] = { {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, #else {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, #endif {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, {"__annotate__", (getter)__Pyx_CyFunction_get_annotate, (setter)__Pyx_CyFunction_set_annotate, 0, 0}, {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, #if CYTHON_COMPILING_IN_LIMITED_API {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, #endif {0, 0, 0, 0, 0} }; static PyMemberDef __pyx_CyFunction_members[] = { #if !CYTHON_COMPILING_IN_LIMITED_API {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, #endif #if CYTHON_METH_FASTCALL #if CYTHON_COMPILING_IN_LIMITED_API {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, #else {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, #endif #if CYTHON_COMPILING_IN_LIMITED_API {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, #else {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, #endif #endif {0, 0, 0, 0, 0} }; static PyObject * __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) { PyObject *result = NULL; CYTHON_UNUSED_VAR(args); __Pyx_BEGIN_CRITICAL_SECTION(m); Py_INCREF(m->func_qualname); result = m->func_qualname; __Pyx_END_CRITICAL_SECTION(); return result; } static PyMethodDef __pyx_CyFunction_methods[] = { {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, {0, 0, 0, 0} }; #if CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) #else #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) #endif static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { #if !CYTHON_COMPILING_IN_LIMITED_API PyCFunctionObject *cf = (PyCFunctionObject*) op; #endif if (unlikely(op == NULL)) return NULL; #if CYTHON_COMPILING_IN_LIMITED_API op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); if (unlikely(!op->func)) return NULL; #endif op->flags = flags; __Pyx_CyFunction_weakreflist(op) = NULL; #if !CYTHON_COMPILING_IN_LIMITED_API cf->m_ml = ml; cf->m_self = (PyObject *) op; #endif Py_XINCREF(closure); op->func_closure = closure; #if !CYTHON_COMPILING_IN_LIMITED_API Py_XINCREF(module); cf->m_module = module; #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API op->func_dict = NULL; #endif op->func_name = NULL; Py_INCREF(qualname); op->func_qualname = qualname; op->func_doc = NULL; #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API op->func_classobj = NULL; #else ((PyCMethodObject*)op)->mm_class = NULL; #endif op->func_globals = globals; Py_INCREF(op->func_globals); Py_XINCREF(code); op->func_code = code; op->defaults = NULL; op->defaults_tuple = NULL; op->defaults_kwdict = NULL; op->defaults_getter = NULL; op->func_annotations = NULL; op->func_is_coroutine = NULL; #if CYTHON_METH_FASTCALL switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { case METH_NOARGS: __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; break; case METH_O: __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; break; case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; break; case METH_FASTCALL | METH_KEYWORDS: __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; break; case METH_VARARGS | METH_KEYWORDS: __Pyx_CyFunction_func_vectorcall(op) = NULL; break; default: PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); Py_DECREF(op); return NULL; } #endif return (PyObject *) op; } static int __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) { Py_CLEAR(m->func_closure); #if CYTHON_COMPILING_IN_LIMITED_API Py_CLEAR(m->func); #else Py_CLEAR(((PyCFunctionObject*)m)->m_module); #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API Py_CLEAR(m->func_dict); #elif PY_VERSION_HEX < 0x030d0000 _PyObject_ClearManagedDict((PyObject*)m); #else PyObject_ClearManagedDict((PyObject*)m); #endif Py_CLEAR(m->func_name); Py_CLEAR(m->func_qualname); Py_CLEAR(m->func_doc); Py_CLEAR(m->func_globals); Py_CLEAR(m->func_code); #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); #else { PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; ((PyCMethodObject *) (m))->mm_class = NULL; Py_XDECREF(cls); } #endif Py_CLEAR(m->defaults_tuple); Py_CLEAR(m->defaults_kwdict); Py_CLEAR(m->func_annotations); Py_CLEAR(m->func_is_coroutine); Py_CLEAR(m->defaults); return 0; } static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) { if (__Pyx_CyFunction_weakreflist(m) != NULL) PyObject_ClearWeakRefs((PyObject *) m); __Pyx_CyFunction_clear(m); __Pyx_PyHeapTypeObject_GC_Del(m); } static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) { PyObject_GC_UnTrack(m); __Pyx__CyFunction_dealloc(m); } static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) { { int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg); if (e) return e; } Py_VISIT(m->func_closure); #if CYTHON_COMPILING_IN_LIMITED_API Py_VISIT(m->func); #else Py_VISIT(((PyCFunctionObject*)m)->m_module); #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API Py_VISIT(m->func_dict); #else { int e = #if PY_VERSION_HEX < 0x030d0000 _PyObject_VisitManagedDict #else PyObject_VisitManagedDict #endif ((PyObject*)m, visit, arg); if (e != 0) return e; } #endif __Pyx_VISIT_CONST(m->func_name); __Pyx_VISIT_CONST(m->func_qualname); Py_VISIT(m->func_doc); Py_VISIT(m->func_globals); __Pyx_VISIT_CONST(m->func_code); Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); Py_VISIT(m->defaults_tuple); Py_VISIT(m->defaults_kwdict); Py_VISIT(m->func_annotations); Py_VISIT(m->func_is_coroutine); Py_VISIT(m->defaults); return 0; } static PyObject* __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) { PyObject *repr; __Pyx_BEGIN_CRITICAL_SECTION(op); repr = PyUnicode_FromFormat("", op->func_qualname, (void *)op); __Pyx_END_CRITICAL_SECTION(); return repr; } static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { #if CYTHON_COMPILING_IN_LIMITED_API PyObject *f = ((__pyx_CyFunctionObject*)func)->func; PyCFunction meth; int flags; meth = PyCFunction_GetFunction(f); if (unlikely(!meth)) return NULL; flags = PyCFunction_GetFlags(f); if (unlikely(flags < 0)) return NULL; #else PyCFunctionObject* f = (PyCFunctionObject*)func; PyCFunction meth = f->m_ml->ml_meth; int flags = f->m_ml->ml_flags; #endif Py_ssize_t size; switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { case METH_VARARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) return (*meth)(self, arg); break; case METH_VARARGS | METH_KEYWORDS: return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw); case METH_NOARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { #if CYTHON_ASSUME_SAFE_SIZE size = PyTuple_GET_SIZE(arg); #else size = PyTuple_Size(arg); if (unlikely(size < 0)) return NULL; #endif if (likely(size == 0)) return (*meth)(self, NULL); __Pyx_CyFunction_raise_argument_count_error( (__pyx_CyFunctionObject*)func, "takes no arguments", size); return NULL; } break; case METH_O: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { #if CYTHON_ASSUME_SAFE_SIZE size = PyTuple_GET_SIZE(arg); #else size = PyTuple_Size(arg); if (unlikely(size < 0)) return NULL; #endif if (likely(size == 1)) { PyObject *result, *arg0; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS arg0 = PyTuple_GET_ITEM(arg, 0); #else arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; #endif result = (*meth)(self, arg0); #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) Py_DECREF(arg0); #endif return result; } __Pyx_CyFunction_raise_argument_count_error( (__pyx_CyFunctionObject*)func, "takes exactly one argument", size); return NULL; } break; default: PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); return NULL; } __Pyx_CyFunction_raise_type_error( (__pyx_CyFunctionObject*)func, "takes no keyword arguments"); return NULL; } static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *self, *result; #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)func)->m_self; #endif result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); return result; } static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { PyObject *result; __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); if (vc) { #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); #else (void) &__Pyx_PyVectorcall_FastCallDict; return PyVectorcall_Call(func, args, kw); #endif } #endif if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { Py_ssize_t argc; PyObject *new_args; PyObject *self; #if CYTHON_ASSUME_SAFE_SIZE argc = PyTuple_GET_SIZE(args); #else argc = PyTuple_Size(args); if (unlikely(argc < 0)) return NULL; #endif new_args = PyTuple_GetSlice(args, 1, argc); if (unlikely(!new_args)) return NULL; self = PyTuple_GetItem(args, 0); if (unlikely(!self)) { Py_DECREF(new_args); PyErr_Format(PyExc_TypeError, "unbound method %.200S() needs an argument", cyfunc->func_qualname); return NULL; } result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); Py_DECREF(new_args); } else { result = __Pyx_CyFunction_Call(func, args, kw); } return result; } #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) { int ret = 0; if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { if (unlikely(nargs < 1)) { __Pyx_CyFunction_raise_type_error( cyfunc, "needs an argument"); return -1; } ret = 1; } if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) { __Pyx_CyFunction_raise_type_error( cyfunc, "takes no keyword arguments"); return -1; } return ret; } static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) { __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); PyObject *self; #if CYTHON_COMPILING_IN_LIMITED_API PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); if (unlikely(!meth)) return NULL; #else PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; #endif switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { case 1: self = args[0]; args += 1; nargs -= 1; break; case 0: #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)cyfunc)->m_self; #endif break; default: return NULL; } if (unlikely(nargs != 0)) { __Pyx_CyFunction_raise_argument_count_error( cyfunc, "takes no arguments", nargs); return NULL; } return meth(self, NULL); } static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) { __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); PyObject *self; #if CYTHON_COMPILING_IN_LIMITED_API PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); if (unlikely(!meth)) return NULL; #else PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; #endif switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { case 1: self = args[0]; args += 1; nargs -= 1; break; case 0: #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)cyfunc)->m_self; #endif break; default: return NULL; } if (unlikely(nargs != 1)) { __Pyx_CyFunction_raise_argument_count_error( cyfunc, "takes exactly one argument", nargs); return NULL; } return meth(self, args[0]); } static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) { __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); PyObject *self; #if CYTHON_COMPILING_IN_LIMITED_API PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); if (unlikely(!meth)) return NULL; #else PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; #endif switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { case 1: self = args[0]; args += 1; nargs -= 1; break; case 0: #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)cyfunc)->m_self; #endif break; default: return NULL; } return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames); } static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) { __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); PyObject *self; #if CYTHON_COMPILING_IN_LIMITED_API PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); if (unlikely(!meth)) return NULL; #else PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; #endif switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { case 1: self = args[0]; args += 1; nargs -= 1; break; case 0: #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)cyfunc)->m_self; #endif break; default: return NULL; } #if PY_VERSION_HEX < 0x030e00A6 size_t nargs_value = (size_t) nargs; #else Py_ssize_t nargs_value = nargs; #endif return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames); } #endif static PyType_Slot __pyx_CyFunctionType_slots[] = { {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, {Py_tp_methods, (void *)__pyx_CyFunction_methods}, {Py_tp_members, (void *)__pyx_CyFunction_members}, {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, {0, 0}, }; static PyType_Spec __pyx_CyFunctionType_spec = { __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", sizeof(__pyx_CyFunctionObject), 0, #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR Py_TPFLAGS_METHOD_DESCRIPTOR | #endif #if CYTHON_METH_FASTCALL #if defined(Py_TPFLAGS_HAVE_VECTORCALL) Py_TPFLAGS_HAVE_VECTORCALL | #elif defined(_Py_TPFLAGS_HAVE_VECTORCALL) _Py_TPFLAGS_HAVE_VECTORCALL | #endif #endif // CYTHON_METH_FASTCALL #if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API Py_TPFLAGS_MANAGED_DICT | #endif Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, __pyx_CyFunctionType_slots }; static int __pyx_CyFunction_init(PyObject *module) { __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec( mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL); if (unlikely(mstate->__pyx_CyFunctionType == NULL)) { return -1; } return 0; } static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type); if (unlikely(!m->defaults)) return NULL; return m->defaults; } static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults_tuple = tuple; Py_INCREF(tuple); } static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults_kwdict = dict; Py_INCREF(dict); } static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->func_annotations = dict; Py_INCREF(dict); } /* CythonFunction */ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { PyObject *op = __Pyx_CyFunction_Init( PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType), ml, flags, qualname, closure, module, globals, code ); if (likely(op)) { PyObject_GC_Track(op); } return op; } /* CLineInTraceback (used by AddTraceback) */ #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 #define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o)) #elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL); #else PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) { PyObject **dict_ptr = _PyObject_GetDictPtr(o); return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL; } #endif static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline = NULL; PyObject *ptype, *pvalue, *ptraceback; PyObject *cython_runtime_dict; CYTHON_MAYBE_UNUSED_VAR(tstate); if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) { return c_line; } __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime); if (likely(cython_runtime_dict)) { __PYX_PY_DICT_LOOKUP_IF_MODIFIED( use_cline, cython_runtime_dict, __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False)) } if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; } Py_XDECREF(use_cline); Py_XDECREF(cython_runtime_dict); __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); return c_line; } #endif /* CodeObjectCache (used by AddTraceback) */ 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 __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) { __Pyx_CachedCodeObjectType* code_object; int pos; if (unlikely(!code_line) || unlikely(!code_cache->entries)) { return NULL; } pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) { return NULL; } code_object = code_cache->entries[pos].code_object; Py_INCREF(code_object); return code_object; } static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS (void)__pyx__find_code_object; return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss. #else struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count); if (old_count < 0) { __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); return NULL; } #endif __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line); #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); #endif return result; #endif } static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = code_cache->entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { code_cache->entries = entries; code_cache->max_count = 64; 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(code_cache->entries, code_cache->count, code_line); if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) { __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_INCREF(code_object); Py_DECREF(tmp); return; } if (code_cache->count == code_cache->max_count) { int new_max = code_cache->max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } code_cache->entries = entries; code_cache->max_count = new_max; } for (i=code_cache->count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; code_cache->count++; Py_INCREF(code_object); } static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS (void)__pyx__insert_code_object; return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail. #else struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_nonatomic_int_type expected = 0; if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) { return; } #endif __pyx__insert_code_object(code_cache, code_line, code_object); #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN); #endif #endif } /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif #if CYTHON_COMPILING_IN_LIMITED_API static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, PyObject *firstlineno, PyObject *name) { PyObject *replace = NULL; if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; replace = PyObject_GetAttrString(code, "replace"); if (likely(replace)) { PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict); Py_DECREF(replace); return result; } PyErr_Clear(); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; PyObject *replace = NULL, *getframe = NULL, *frame = NULL; PyObject *exc_type, *exc_value, *exc_traceback; int success = 0; if (c_line) { c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); } PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); code_object = __pyx_find_code_object(c_line ? -c_line : py_line); if (!code_object) { code_object = Py_CompileString("_getframe()", filename, Py_eval_input); if (unlikely(!code_object)) goto bad; py_py_line = PyLong_FromLong(py_line); if (unlikely(!py_py_line)) goto bad; if (c_line) { py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); } else { py_funcname = PyUnicode_FromString(funcname); } if (unlikely(!py_funcname)) goto bad; dict = PyDict_New(); if (unlikely(!dict)) goto bad; { PyObject *old_code_object = code_object; code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); Py_DECREF(old_code_object); } if (unlikely(!code_object)) goto bad; __pyx_insert_code_object(c_line ? -c_line : py_line, code_object); } else { dict = PyDict_New(); } getframe = PySys_GetObject("_getframe"); if (unlikely(!getframe)) goto bad; if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; frame = PyEval_EvalCode(code_object, dict, dict); if (unlikely(!frame) || frame == Py_None) goto bad; success = 1; bad: PyErr_Restore(exc_type, exc_value, exc_traceback); Py_XDECREF(code_object); Py_XDECREF(py_py_line); Py_XDECREF(py_funcname); Py_XDECREF(dict); Py_XDECREF(replace); if (success) { PyTraceBack_Here( (struct _frame*)frame); } Py_XDECREF(frame); } #else static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = NULL; PyObject *py_funcname = NULL; if (c_line) { py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); if (!py_funcname) goto bad; funcname = PyUnicode_AsUTF8(py_funcname); if (!funcname) goto bad; } py_code = PyCode_NewEmpty(filename, funcname, py_line); Py_XDECREF(py_funcname); return py_code; bad: 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; PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject *ptype, *pvalue, *ptraceback; if (c_line) { c_line = __Pyx_CLineForTraceback(tstate, c_line); } py_code = __pyx_find_code_object(c_line ? -c_line : py_line); if (!py_code) { __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) { /* If the code object creation fails, then we should clear the fetched exception references and propagate the new exception */ Py_XDECREF(ptype); Py_XDECREF(pvalue); Py_XDECREF(ptraceback); goto bad; } __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } py_frame = PyFrame_New( tstate, /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ __pyx_mstate_global->__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); } #endif /* PyObjectVectorCallKwBuilder (used by CIntToPy) */ #if CYTHON_VECTORCALL static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { (void)__Pyx_PyObject_FastCallDict; Py_INCREF(key); if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; args[n] = value; return 0; } CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { (void)__Pyx_VectorcallBuilder_AddArgStr; if (unlikely(!PyUnicode_Check(key))) { PyErr_SetString(PyExc_TypeError, "keywords must be strings"); return -1; } return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n); } static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) { PyObject *pyKey = PyUnicode_FromString(key); if (!pyKey) return -1; return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n); } #else // CYTHON_VECTORCALL CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) { if (unlikely(!PyUnicode_Check(key))) { PyErr_SetString(PyExc_TypeError, "keywords must be strings"); return -1; } return PyDict_SetItem(builder, key, value); } #endif /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const int neg_one = (int) -1, const_zero = (int) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(int) < sizeof(long)) { return PyLong_FromLong((long) value); } else if (sizeof(int) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #if !CYTHON_COMPILING_IN_PYPY } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(int) <= sizeof(long)) { return PyLong_FromLong((long) value); } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); } } { unsigned char *bytes = (unsigned char *)&value; #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 if (is_unsigned) { return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); } else { return PyLong_FromNativeBytes(bytes, sizeof(value), -1); } #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 int one = 1; int little = (int)*(unsigned char *)&one; return _PyLong_FromByteArray(bytes, sizeof(int), little, !is_unsigned); #else int one = 1; int little = (int)*(unsigned char *)&one; PyObject *from_bytes, *result = NULL, *kwds = NULL; PyObject *py_bytes = NULL, *order_str = NULL; from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); if (!from_bytes) return NULL; py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); if (!py_bytes) goto limited_bad; order_str = PyUnicode_FromString(little ? "little" : "big"); if (!order_str) goto limited_bad; { PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; if (!is_unsigned) { kwds = __Pyx_MakeVectorcallBuilderKwds(1); if (!kwds) goto limited_bad; if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; } result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); } limited_bad: Py_XDECREF(kwds); Py_XDECREF(order_str); Py_XDECREF(py_bytes); Py_XDECREF(from_bytes); return result; #endif } } /* FormatTypeName */ #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp) { PyObject *module = NULL, *name = NULL, *result = NULL; #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, __pyx_mstate_global->__pyx_n_u_qualname); #else name = PyType_GetQualName(tp); #endif if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad; module = __Pyx_PyObject_GetAttrStr((PyObject *)tp, __pyx_mstate_global->__pyx_n_u_module); if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad; if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) { result = name; name = NULL; goto done; } result = PyUnicode_FromFormat("%U.%U", module, name); if (unlikely(result == NULL)) goto bad; done: Py_XDECREF(name); Py_XDECREF(module); return result; bad: PyErr_Clear(); if (name) { result = name; name = NULL; } else { result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__2); } goto done; } #endif /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const long neg_one = (long) -1, const_zero = (long) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(long) < sizeof(long)) { return PyLong_FromLong((long) value); } else if (sizeof(long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #if !CYTHON_COMPILING_IN_PYPY } 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 PyLong_FromLong((long) value); } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); } } { unsigned char *bytes = (unsigned char *)&value; #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 if (is_unsigned) { return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); } else { return PyLong_FromNativeBytes(bytes, sizeof(value), -1); } #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 int one = 1; int little = (int)*(unsigned char *)&one; return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); #else int one = 1; int little = (int)*(unsigned char *)&one; PyObject *from_bytes, *result = NULL, *kwds = NULL; PyObject *py_bytes = NULL, *order_str = NULL; from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); if (!from_bytes) return NULL; py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); if (!py_bytes) goto limited_bad; order_str = PyUnicode_FromString(little ? "little" : "big"); if (!order_str) goto limited_bad; { PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; if (!is_unsigned) { kwds = __Pyx_MakeVectorcallBuilderKwds(1); if (!kwds) goto limited_bad; if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; } result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); } limited_bad: Py_XDECREF(kwds); Py_XDECREF(order_str); Py_XDECREF(py_bytes); Py_XDECREF(from_bytes); return result; #endif } } /* CIntFromPyVerify (used by CIntFromPy) */ #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_PyLong_As_long(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const long neg_one = (long) -1, const_zero = (long) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (unlikely(!PyLong_Check(x))) { long val; PyObject *tmp = __Pyx_PyNumber_Long(x); if (!tmp) return (long) -1; val = __Pyx_PyLong_As_long(tmp); Py_DECREF(tmp); return val; } if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS if (unlikely(__Pyx_PyLong_IsNeg(x))) { goto raise_neg_overflow; } else if (__Pyx_PyLong_IsCompact(x)) { __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_DigitCount(x)) { 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 && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (long) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if ((sizeof(long) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_USE_PYLONG_INTERNALS if (__Pyx_PyLong_IsCompact(x)) { __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_SignedDigitCount(x)) { case -2: if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 2: if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -3: if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 3: if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -4: if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 4: if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; } } #endif if ((sizeof(long) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { long val; int ret = -1; #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API Py_ssize_t bytes_copied = PyLong_AsNativeBytes( x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); if (unlikely(bytes_copied == -1)) { } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { goto raise_overflow; } else { ret = 0; } #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; ret = _PyLong_AsByteArray((PyLongObject *)x, bytes, sizeof(val), is_little, !is_unsigned); #else PyObject *v; PyObject *stepval = NULL, *mask = NULL, *shift = NULL; int bits, remaining_bits, is_negative = 0; int chunk_size = (sizeof(long) < 8) ? 30 : 62; if (likely(PyLong_CheckExact(x))) { v = __Pyx_NewRef(x); } else { v = PyNumber_Long(x); if (unlikely(!v)) return (long) -1; assert(PyLong_CheckExact(v)); } { int result = PyObject_RichCompareBool(v, Py_False, Py_LT); if (unlikely(result < 0)) { Py_DECREF(v); return (long) -1; } is_negative = result == 1; } if (is_unsigned && unlikely(is_negative)) { Py_DECREF(v); goto raise_neg_overflow; } else if (is_negative) { stepval = PyNumber_Invert(v); Py_DECREF(v); if (unlikely(!stepval)) return (long) -1; } else { stepval = v; } v = NULL; val = (long) 0; mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { PyObject *tmp, *digit; long idigit; digit = PyNumber_And(stepval, mask); if (unlikely(!digit)) goto done; idigit = PyLong_AsLong(digit); Py_DECREF(digit); if (unlikely(idigit < 0)) goto done; val |= ((long) idigit) << bits; tmp = PyNumber_Rshift(stepval, shift); if (unlikely(!tmp)) goto done; Py_DECREF(stepval); stepval = tmp; } Py_DECREF(shift); shift = NULL; Py_DECREF(mask); mask = NULL; { long idigit = PyLong_AsLong(stepval); if (unlikely(idigit < 0)) goto done; remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); if (unlikely(idigit >= (1L << remaining_bits))) goto raise_overflow; val |= ((long) idigit) << bits; } if (!is_unsigned) { if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) goto raise_overflow; if (is_negative) val = ~val; } ret = 0; done: Py_XDECREF(shift); Py_XDECREF(mask); Py_XDECREF(stepval); #endif if (unlikely(ret)) return (long) -1; 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_PyLong_As_int(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const int neg_one = (int) -1, const_zero = (int) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (unlikely(!PyLong_Check(x))) { int val; PyObject *tmp = __Pyx_PyNumber_Long(x); if (!tmp) return (int) -1; val = __Pyx_PyLong_As_int(tmp); Py_DECREF(tmp); return val; } if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS if (unlikely(__Pyx_PyLong_IsNeg(x))) { goto raise_neg_overflow; } else if (__Pyx_PyLong_IsCompact(x)) { __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_DigitCount(x)) { 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 && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (int) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if ((sizeof(int) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_USE_PYLONG_INTERNALS if (__Pyx_PyLong_IsCompact(x)) { __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_SignedDigitCount(x)) { case -2: if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 2: if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -3: if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 3: if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -4: if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 4: if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; } } #endif if ((sizeof(int) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { int val; int ret = -1; #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API Py_ssize_t bytes_copied = PyLong_AsNativeBytes( x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); if (unlikely(bytes_copied == -1)) { } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { goto raise_overflow; } else { ret = 0; } #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; ret = _PyLong_AsByteArray((PyLongObject *)x, bytes, sizeof(val), is_little, !is_unsigned); #else PyObject *v; PyObject *stepval = NULL, *mask = NULL, *shift = NULL; int bits, remaining_bits, is_negative = 0; int chunk_size = (sizeof(long) < 8) ? 30 : 62; if (likely(PyLong_CheckExact(x))) { v = __Pyx_NewRef(x); } else { v = PyNumber_Long(x); if (unlikely(!v)) return (int) -1; assert(PyLong_CheckExact(v)); } { int result = PyObject_RichCompareBool(v, Py_False, Py_LT); if (unlikely(result < 0)) { Py_DECREF(v); return (int) -1; } is_negative = result == 1; } if (is_unsigned && unlikely(is_negative)) { Py_DECREF(v); goto raise_neg_overflow; } else if (is_negative) { stepval = PyNumber_Invert(v); Py_DECREF(v); if (unlikely(!stepval)) return (int) -1; } else { stepval = v; } v = NULL; val = (int) 0; mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { PyObject *tmp, *digit; long idigit; digit = PyNumber_And(stepval, mask); if (unlikely(!digit)) goto done; idigit = PyLong_AsLong(digit); Py_DECREF(digit); if (unlikely(idigit < 0)) goto done; val |= ((int) idigit) << bits; tmp = PyNumber_Rshift(stepval, shift); if (unlikely(!tmp)) goto done; Py_DECREF(stepval); stepval = tmp; } Py_DECREF(shift); shift = NULL; Py_DECREF(mask); mask = NULL; { long idigit = PyLong_AsLong(stepval); if (unlikely(idigit < 0)) goto done; remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); if (unlikely(idigit >= (1L << remaining_bits))) goto raise_overflow; val |= ((int) idigit) << bits; } if (!is_unsigned) { if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) goto raise_overflow; if (is_negative) val = ~val; } ret = 0; done: Py_XDECREF(shift); Py_XDECREF(mask); Py_XDECREF(stepval); #endif if (unlikely(ret)) return (int) -1; 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; } /* FastTypeChecks */ #if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); if (a == b) return 1; } return b == &PyBaseObject_Type; } static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { PyObject *mro; if (a == b) return 1; mro = a->tp_mro; if (likely(mro)) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(mro); for (i = 0; i < n; i++) { if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) return 1; } return 0; } return __Pyx_InBases(a, b); } static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { PyObject *mro; if (cls == a || cls == b) return 1; mro = cls->tp_mro; if (likely(mro)) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(mro); for (i = 0; i < n; i++) { PyObject *base = PyTuple_GET_ITEM(mro, i); if (base == (PyObject *)a || base == (PyObject *)b) return 1; } return 0; } return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); } static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { if (exc_type1) { return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); } else { return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); } } static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { Py_ssize_t i, n; assert(PyExceptionClass_Check(exc_type)); n = PyTuple_GET_SIZE(tuple); for (i=0; i>= 8; ++i; } __Pyx_cached_runtime_version = version; } } #endif static unsigned long __Pyx_get_runtime_version(void) { #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 return Py_Version & ~0xFFUL; #else return __Pyx_cached_runtime_version; #endif } /* CheckBinaryVersion */ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) { const unsigned long MAJOR_MINOR = 0xFFFF0000UL; if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR)) return 0; if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR))) return 1; { char message[200]; PyOS_snprintf(message, sizeof(message), "compile time Python version %d.%d " "of module '%.100s' " "%s " "runtime version %d.%d", (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF), __Pyx_MODULE_NAME, (allow_newer) ? "was newer than" : "does not match", (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF) ); return PyErr_WarnEx(NULL, message, 1); } } /* NewCodeObj */ #if CYTHON_COMPILING_IN_LIMITED_API static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { PyObject *exception_table = NULL; PyObject *types_module=NULL, *code_type=NULL, *result=NULL; #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 PyObject *version_info; PyObject *py_minor_version = NULL; #endif long minor_version = 0; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 minor_version = 11; #else if (!(version_info = PySys_GetObject("version_info"))) goto end; if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; minor_version = PyLong_AsLong(py_minor_version); Py_DECREF(py_minor_version); if (minor_version == -1 && PyErr_Occurred()) goto end; #endif if (!(types_module = PyImport_ImportModule("types"))) goto end; if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; if (minor_version <= 7) { (void)p; result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code, c, n, v, fn, name, fline, lnos, fv, cell); } else if (minor_version <= 10) { result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code, c, n, v, fn, name, fline, lnos, fv, cell); } else { if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code, c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); } end: Py_XDECREF(code_type); Py_XDECREF(exception_table); Py_XDECREF(types_module); if (type) { PyErr_Restore(type, value, traceback); } return result; } #elif PY_VERSION_HEX >= 0x030B0000 static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { PyCodeObject *result; result = #if PY_VERSION_HEX >= 0x030C0000 PyUnstable_Code_NewWithPosOnlyArgs #else PyCode_NewWithPosOnlyArgs #endif (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1 if (likely(result)) result->_co_firsttraceable = 0; #endif return result; } #elif !CYTHON_COMPILING_IN_PYPY #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif static PyObject* __Pyx_PyCode_New( const __Pyx_PyCode_New_function_description descr, PyObject * const *varnames, PyObject *filename, PyObject *funcname, PyObject *line_table, PyObject *tuple_dedup_map ) { PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL; Py_ssize_t var_count = (Py_ssize_t) descr.nlocals; PyObject *varnames_tuple = PyTuple_New(var_count); if (unlikely(!varnames_tuple)) return NULL; for (Py_ssize_t i=0; i < var_count; i++) { Py_INCREF(varnames[i]); if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done; } #if CYTHON_COMPILING_IN_LIMITED_API varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple); if (!varnames_tuple_dedup) { if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done; varnames_tuple_dedup = varnames_tuple; } #else varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple); if (unlikely(!varnames_tuple_dedup)) goto done; #endif #if CYTHON_AVOID_BORROWED_REFS Py_INCREF(varnames_tuple_dedup); #endif if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) { Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(line_table_length == -1)) goto done; #endif Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL; code_bytes = PyBytes_FromStringAndSize(NULL, code_len); if (unlikely(!code_bytes)) goto done; char* c_code_bytes = PyBytes_AsString(code_bytes); if (unlikely(!c_code_bytes)) goto done; memset(c_code_bytes, 0, (size_t) code_len); } code_obj = (PyObject*) __Pyx__PyCode_New( (int) descr.argcount, (int) descr.num_posonly_args, (int) descr.num_kwonly_args, (int) descr.nlocals, 0, (int) descr.flags, code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes, __pyx_mstate_global->__pyx_empty_tuple, __pyx_mstate_global->__pyx_empty_tuple, varnames_tuple_dedup, __pyx_mstate_global->__pyx_empty_tuple, __pyx_mstate_global->__pyx_empty_tuple, filename, funcname, (int) descr.first_line, (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes ); done: Py_XDECREF(code_bytes); #if CYTHON_AVOID_BORROWED_REFS Py_XDECREF(varnames_tuple_dedup); #endif Py_DECREF(varnames_tuple); return code_obj; } /* DecompressString */ static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) { PyObject *module = NULL, *decompress, *compressed_bytes, *decompressed; const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib"; PyObject *methodname = PyUnicode_FromString("decompress"); if (unlikely(!methodname)) return NULL; #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000 if (algo == 3) { PyObject *fromlist = Py_BuildValue("[O]", methodname); if (unlikely(!fromlist)) goto bad; module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0); Py_DECREF(fromlist); } else #endif module = PyImport_ImportModule(module_name); if (unlikely(!module)) goto import_failed; decompress = PyObject_GetAttr(module, methodname); if (unlikely(!decompress)) goto import_failed; { #ifdef __cplusplus char *memview_bytes = const_cast(s); #else #if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wcast-qual" #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-qual" #endif char *memview_bytes = (char*) s; #if defined(__clang__) #pragma clang diagnostic pop #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) #pragma GCC diagnostic pop #endif #endif #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ) int memview_flags = 0x100; #else int memview_flags = PyBUF_READ; #endif compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags); } if (unlikely(!compressed_bytes)) { Py_DECREF(decompress); goto bad; } decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL); Py_DECREF(compressed_bytes); Py_DECREF(decompress); Py_DECREF(module); Py_DECREF(methodname); return decompressed; import_failed: PyErr_Format(PyExc_ImportError, "Failed to import '%.20s.decompress' - cannot initialise module strings. " "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.", module_name, algo); bad: Py_XDECREF(module); Py_DECREF(methodname); return NULL; } #include static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { size_t len = strlen(s); if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) { PyErr_SetString(PyExc_OverflowError, "byte string is too long"); return -1; } return (Py_ssize_t) len; } static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { Py_ssize_t len = __Pyx_ssize_strlen(c_str); if (unlikely(len < 0)) return NULL; return __Pyx_PyUnicode_FromStringAndSize(c_str, len); } static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) { Py_ssize_t len = __Pyx_ssize_strlen(c_str); if (unlikely(len < 0)) return NULL; return PyByteArray_FromStringAndSize(c_str, len); } static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; #if CYTHON_COMPILING_IN_LIMITED_API { const char* result; Py_ssize_t unicode_length; CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL; #else result = PyUnicode_AsUTF8AndSize(o, length); #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII unicode_length = PyUnicode_GetLength(o); if (unlikely(unicode_length < 0)) return NULL; if (unlikely(unicode_length != *length)) { PyUnicode_AsASCIIString(o); return NULL; } #endif return result; } #else #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (likely(PyUnicode_IS_ASCII(o))) { *length = PyUnicode_GET_LENGTH(o); return PyUnicode_AsUTF8(o); } else { PyUnicode_AsASCIIString(o); return NULL; } #else return PyUnicode_AsUTF8AndSize(o, length); #endif #endif } #endif static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 if (PyUnicode_Check(o)) { return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif if (PyByteArray_Check(o)) { #if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))) *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); #else *length = PyByteArray_Size(o); if (*length == -1) return NULL; return PyByteArray_AsString(o); #endif } else { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); if (unlikely(r < 0)) { return NULL; } else { return result; } } } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { int retval; if (unlikely(!x)) return -1; retval = __Pyx_PyObject_IsTrue(x); Py_DECREF(x); return retval; } static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) { __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result)); if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " "The ability to return an instance of a strict subclass of int is deprecated, " "and may be removed in a future version of Python.", result_type_name)) { __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } __Pyx_DECREF_TypeName(result_type_name); return result; } PyErr_Format(PyExc_TypeError, "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")", result_type_name); __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) { #if CYTHON_USE_TYPE_SLOTS PyNumberMethods *m; #endif PyObject *res = NULL; if (likely(PyLong_Check(x))) return __Pyx_NewRef(x); #if CYTHON_USE_TYPE_SLOTS m = Py_TYPE(x)->tp_as_number; if (likely(m && m->nb_int)) { res = m->nb_int(x); } #else if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { res = PyNumber_Long(x); } #endif if (likely(res)) { if (unlikely(!PyLong_CheckExact(res))) { return __Pyx_PyNumber_LongWrongResultType(res); } } 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 (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS if (likely(__Pyx_PyLong_IsCompact(b))) { return __Pyx_PyLong_CompactValue(b); } else { const digit* digits = __Pyx_PyLong_Digits(b); const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); 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 = PyLong_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); } else { Py_ssize_t ival; PyObject *x; x = PyNumber_Index(o); if (!x) return -1; ival = PyLong_AsLong(x); Py_DECREF(x); return ival; } } static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) { CYTHON_UNUSED_VAR(b); return __Pyx_NewRef(Py_None); } static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return __Pyx_NewRef(b ? Py_True: Py_False); } static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) { return PyLong_FromSize_t(ival); } /* MultiPhaseInitModuleState */ #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE #ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE #if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000) #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1 #else #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0 #endif #endif #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS #error "Module state with PEP489 requires atomics. Currently that's one of\ C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics" #endif #if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE #define __Pyx_ModuleStateLookup_Lock() #define __Pyx_ModuleStateLookup_Unlock() #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 static PyMutex __Pyx_ModuleStateLookup_mutex = {0}; #define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex) #define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex) #elif defined(__cplusplus) && __cplusplus >= 201103L #include static std::mutex __Pyx_ModuleStateLookup_mutex; #define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock() #define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock() #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__) #include static mtx_t __Pyx_ModuleStateLookup_mutex; static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT; static void __Pyx_ModuleStateLookup_initialize_mutex(void) { mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain); } #define __Pyx_ModuleStateLookup_Lock()\ call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\ mtx_lock(&__Pyx_ModuleStateLookup_mutex) #define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex) #elif defined(HAVE_PTHREAD_H) #include static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER; #define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex) #define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex) #elif defined(_WIN32) #include // synchapi.h on its own doesn't work static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT; #define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) #define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) #else #error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\ Requires C standard >= C11, or C++ standard >= C++11,\ or pthreads, or the Windows 32 API, or Python >= 3.13." #endif typedef struct { int64_t id; PyObject *module; } __Pyx_InterpreterIdAndModule; typedef struct { char interpreter_id_as_index; Py_ssize_t count; Py_ssize_t allocated; __Pyx_InterpreterIdAndModule table[1]; } __Pyx_ModuleStateLookupData; #define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32 #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0; #endif #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0; #else static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL; #endif static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound( __Pyx_InterpreterIdAndModule* table, Py_ssize_t count, int64_t interpreterId) { __Pyx_InterpreterIdAndModule* begin = table; __Pyx_InterpreterIdAndModule* end = begin + count; if (begin->id == interpreterId) { return begin; } while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2; if (halfway->id == interpreterId) { return halfway; } if (halfway->id < interpreterId) { begin = halfway; } else { end = halfway; } } for (; begin < end; ++begin) { if (begin->id >= interpreterId) return begin; } return begin; } static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) { int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); if (interpreter_id == -1) return NULL; #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); { __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); if (likely(data)) { __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data); if (likely(data == new_data)) { goto read_finished; } } __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); __Pyx_ModuleStateLookup_Lock(); __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter); data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); __Pyx_ModuleStateLookup_Unlock(); } read_finished:; #else __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data; #endif __Pyx_InterpreterIdAndModule* found = NULL; if (unlikely(!data)) goto end; if (data->interpreter_id_as_index) { if (interpreter_id < data->count) { found = data->table+interpreter_id; } } else { found = __Pyx_State_FindModuleStateLookupTableLowerBound( data->table, data->count, interpreter_id); } end: { PyObject *result=NULL; if (found && found->id == interpreter_id) { result = found->module; } #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); #endif return result; } } #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) { while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0); } #else #define __Pyx_ModuleStateLookup_wait_until_no_readers() #endif static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) { Py_ssize_t to_allocate = (*old_data)->allocated; while (to_allocate <= interpreter_id) { if (to_allocate == 0) to_allocate = 1; else to_allocate *= 2; } __Pyx_ModuleStateLookupData *new_data = *old_data; if (to_allocate != (*old_data)->allocated) { new_data = (__Pyx_ModuleStateLookupData *)realloc( *old_data, sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); if (!new_data) { PyErr_NoMemory(); return -1; } for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) { new_data->table[i].id = i; new_data->table[i].module = NULL; } new_data->allocated = to_allocate; } new_data->table[interpreter_id].module = module; if (new_data->count < interpreter_id+1) { new_data->count = interpreter_id+1; } *old_data = new_data; return 0; } static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) { __Pyx_InterpreterIdAndModule *read = data->table; __Pyx_InterpreterIdAndModule *write = data->table; __Pyx_InterpreterIdAndModule *end = read + data->count; for (; readmodule) { write->id = read->id; write->module = read->module; ++write; } } data->count = write - data->table; for (; writeid = 0; write->module = NULL; } data->interpreter_id_as_index = 0; } static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) { int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); if (interpreter_id == -1) return -1; int result = 0; __Pyx_ModuleStateLookup_Lock(); #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *) __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); #else __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data; #endif __Pyx_ModuleStateLookupData *new_data = old_data; if (!new_data) { new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData)); if (!new_data) { result = -1; PyErr_NoMemory(); goto end; } new_data->allocated = 1; new_data->interpreter_id_as_index = 1; } __Pyx_ModuleStateLookup_wait_until_no_readers(); if (new_data->interpreter_id_as_index) { if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id); goto end; } __Pyx_State_ConvertFromInterpIdAsIndex(new_data); } { Py_ssize_t insert_at = 0; { __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( new_data->table, new_data->count, interpreter_id); assert(lower_bound); insert_at = lower_bound - new_data->table; if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) { lower_bound->module = module; goto end; // already in table, nothing more to do } } if (new_data->count+1 >= new_data->allocated) { Py_ssize_t to_allocate = (new_data->count+1)*2; new_data = (__Pyx_ModuleStateLookupData*)realloc( new_data, sizeof(__Pyx_ModuleStateLookupData) + (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); if (!new_data) { result = -1; new_data = old_data; PyErr_NoMemory(); goto end; } new_data->allocated = to_allocate; } ++new_data->count; int64_t last_id = interpreter_id; PyObject *last_module = module; for (Py_ssize_t i=insert_at; icount; ++i) { int64_t current_id = new_data->table[i].id; new_data->table[i].id = last_id; last_id = current_id; PyObject *current_module = new_data->table[i].module; new_data->table[i].module = last_module; last_module = current_module; } } end: #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data); #else __Pyx_ModuleStateLookup_data = new_data; #endif __Pyx_ModuleStateLookup_Unlock(); return result; } static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) { int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); if (interpreter_id == -1) return -1; __Pyx_ModuleStateLookup_Lock(); #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *) __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); #else __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data; #endif if (data->interpreter_id_as_index) { if (interpreter_id < data->count) { data->table[interpreter_id].module = NULL; } goto done; } { __Pyx_ModuleStateLookup_wait_until_no_readers(); __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( data->table, data->count, interpreter_id); if (!lower_bound) goto done; if (lower_bound->id != interpreter_id) goto done; __Pyx_InterpreterIdAndModule *end = data->table+data->count; for (;lower_boundid = (lower_bound+1)->id; lower_bound->module = (lower_bound+1)->module; } } --data->count; if (data->count == 0) { free(data); data = NULL; } done: #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data); #else __Pyx_ModuleStateLookup_data = data; #endif __Pyx_ModuleStateLookup_Unlock(); return 0; } #endif /* #### Code section: utility_code_pragmas_end ### */ #ifdef _MSC_VER #pragma warning( pop ) #endif /* #### Code section: end ### */ #endif /* Py_PYTHON_H */ graph-algorithms-planarity-08d7b51/planarity/full/g6IterationUtils.pyx000066400000000000000000000260431522057144000262470ustar00rootroot00000000000000#!/usr/bin/env python # cython: embedsignature=True """ Cython wrapper for the Edge Addition Planarity Suite Graph Library Wraps structs pertaining to G6 file iteration using a Cython class and wraps pertinent functions and macros. """ from libc.stdlib cimport free from planarity.full cimport graphLib from planarity.full cimport graph from planarity.full import graphLib cdef class G6ReadIterator: cdef graphLib.G6ReadIteratorP _g6ReadIterator def __cinit__(self, curr_graph: graph.Graph): """Allocates the underlying G6 read iterator with g6_NewReader(). Args: curr_graph: An allocated graph data structure that will be iteratively populated with graphs from an input source. Raises: MemoryError if C graphlib version of gp_NewReader() failed. ValueError if curr_graph does not contain an allocated graph. """ try: curr_graph.gp_GetN() except RuntimeError as invalid_graph_error: raise ValueError( "Graph to populate is not allocated." ) from invalid_graph_error self._g6ReadIterator = NULL if graphLib.g6_NewReader(&self._g6ReadIterator, curr_graph._theGraph) != graphLib.OK: raise MemoryError( "Unable to initialize G6ReadIterator, as call to " "g6_NewReader() in EAPS graphLib failed." ) def __dealloc__(self): """Frees the underlying G6 read iterator with g6_FreeReader().""" if self._g6ReadIterator != NULL: # NOTE: g6_FreeReader() NULLs out the pointer to currGraph on # the C layer, so that Python will be free to clean up the # curr_graph once all references to it have been released # by the calling code. At that point, the graphP will also be # cleaned up with gp_Free(). graphLib.g6_FreeReader(&self._g6ReadIterator) def g6_InitReaderWithString(self, str inputString) -> None: """Initializes the G6 read iterator with a string to use as the input sourceof G6-encoded graphs. Args: inputString: the string to use as the input source Raises: RuntimeError if C graphlib version of this function failed. """ cdef bytes encoded = inputString.encode('utf-8') cdef const char *encodedInputString = encoded result = graphLib.g6_InitReaderWithString(self._g6ReadIterator, encodedInputString) if result != graphLib.OK: raise RuntimeError( "Unable to initialize reader with inputString, as " "g6_InitReaderWithString() in EAPS graphLib failed." ) def g6_InitReaderWithFileName(self, str infileName) -> None: """Initializes the G6 read iterator with the name of a file to use as the input source of G6-encoded graphs. Args: infileName: a string containing the name of the file to use as the input source Raises: RuntimeError if C graphlib version of this function failed. """ cdef bytes encoded = infileName.encode('utf-8') cdef const char *encodedInfileName = encoded result = graphLib.g6_InitReaderWithFileName(self._g6ReadIterator, encodedInfileName) if result != graphLib.OK: raise RuntimeError( "Unable to initialize reader with infileName, as " "g6_InitReaderWithFileName() in EAPS graphLib failed." ) def g6_ReadGraph(self) -> None: """Reads a G6-encoded graph from the input source. Raises: RuntimeError if C graphlib version of this function failed. """ result = graphLib.g6_ReadGraph(self._g6ReadIterator) if result != graphLib.OK: raise RuntimeError( f"Unable to read graph, as g6_ReadGraph() in EAPS graphLib failed." ) def g6_EndReached(self) -> int: """Indicates whether or not the end of the input source has been reached. Returns: TRUE if there are no more graphs to read, FALSE otherwise """ return graphLib.g6_EndReached(self._g6ReadIterator) def g6_FreeReader(self) -> None: """Frees the underlying G6 read iterator. Although the __dealloc__() will do so if the API user does not, it is cleanest to directly call this method for consistency with how the write iterator must be used. The __dealloc__() avoids double freeing the iterator. Raises: RuntimeError if C graphlib version of this function failed. """ if self._g6ReadIterator == NULL: raise RuntimeError( "G6ReadIterator's underlying g6ReadIterator has already been freed." ) graphLib.g6_FreeReader(&self._g6ReadIterator) cdef class G6WriteIterator: cdef graphLib.G6WriteIteratorP _g6WriteIterator cdef char *_outputString def __cinit__(self, graph.Graph graph_to_write): """Allocates the underlying G6 write iterator with gp_NewWriter(). Args: graph_to_write: An allocated graph data structure that can be iteratively populated with graphs to write to an output source. Raises: MemoryError if C graphlib version of gp_NewWriter() failed. ValueError if graph_to_write does not contain an allocated graph having a greater-than-zero number of vertices allocated (see gp_EnsureVertexCapacity()). """ try: if graph_to_write.gp_GetN() == 0: raise ValueError( "Graph to write is not initialized." ) except RuntimeError as invalid_graph_error: raise ValueError( "Graph to write is not allocated." ) from invalid_graph_error self._g6WriteIterator = NULL if graphLib.g6_NewWriter(&self._g6WriteIterator, graph_to_write._theGraph) != graphLib.OK: raise MemoryError( "Unable to initialize G6WriteIterator, as g6_NewWriter() in " "EAPS graphLib failed." ) self._outputString = NULL def __dealloc__(self): """Frees the underlying G6 write iterator with g6_FreeWriter(), if necessary. However, if the output source is a string and if the API user did not directly call g6_FreeWriter(), then they did not receive the output string, so the output string is freed and a RuntimeError is raised. If the output source is a file, then it is not an error but good practice to call g6_FreeWriter() before the write iterator goes out of scope. Raises: RuntimeError if the output source is a string and the API user has not previously called g6_FreeWriter(). """ if self._g6WriteIterator != NULL: graphLib.g6_FreeWriter(&self._g6WriteIterator) if self._outputString != NULL: free(self._outputString) self._outputString = NULL raise RuntimeError( "G6WriteIterator was initialized with string, but you did not " "call g6_FreeWriter(), so you have not received the string " "to which the .g6 graphs were written." ) def g6_InitWriterWithString(self) -> None: """Initializes the G6 write iterator with an internal string to use as the output source that will receive G6-encoded graphs. Raises: RuntimeError if C graphlib version of this function failed. """ result = graphLib.g6_InitWriterWithString(self._g6WriteIterator, &(self._outputString)) if result != graphLib.OK: raise RuntimeError( "Unable to initialize writer with string, as " "g6_InitWriterWithString() in EAPS graphLib failed." ) def g6_InitWriterWithFileName(self, str outfileName) -> None: """Initializes the G6 write iterator with the name of a file to use as the output source that will receive G6-encoded graphs. Args: outfileName: a string containing the name of the file to use as the output source Raises: RuntimeError if C graphlib version of this function failed. """ cdef bytes encoded = outfileName.encode('utf-8') cdef const char *encodedOutputFileName = encoded result = graphLib.g6_InitWriterWithFileName(self._g6WriteIterator, encodedOutputFileName) if result != graphLib.OK: raise RuntimeError( "Unable to initialize writer with filename, as " "g6_InitWriterWithFileName() in EAPS graphLib failed." ) def g6_WriteGraph(self) -> None: """Writes a G6-encoded graph to the output source. Raises: RuntimeError if C graphlib version of this function failed. """ result = graphLib.g6_WriteGraph(self._g6WriteIterator) if result != graphLib.OK: raise RuntimeError( "Unable to write graph, as g6_WriteGraph() in EAPS graphLib failed." ) def g6_FreeWriter(self) -> str | None: """Frees the underlying G6 write iterator. This method must be called if the G6 write iterator was initialized to output to a string, so that the API user can receive the string output. Otherwise, it is still best to directly call this method even if the G6 write iterator was initialized to output to a file. The __dealloc__() does also call this method if it has not already been called. Returns: A Python string containing the G6-encoded output if the G6 write iterator was initialized to write to a string, or nothing if the G6 write iterator was initialized to write to a file. Raises: RuntimeError if the G6 write iterator was initialized to output to a string and the string cannot be decoded to a Python string. """ if self._g6WriteIterator == NULL: raise RuntimeError( "G6WriteIterator's underlying g6WriteIterator has already been freed." ) # NOTE: if initialized with string, this should mean that the underlying # C code to g6_FreeWriter() will call sf_Free() on the outputContainer # associated with the writer, which will sb_TakeTheString() from the # container's theStrBuf and assign the string to the address pointed to # by pOutputStr (i.e. the G6WriteIterator's self._outputString) graphLib.g6_FreeWriter(&self._g6WriteIterator) if self._outputString != NULL: output_bytes = self._outputString[:] free(self._outputString) self._outputString = NULL try: return output_bytes.decode('UTF-8') except Exception as string_conversion_error: raise RuntimeError( "Failed to convert C string to Python string." ) from string_conversion_error graph-algorithms-planarity-08d7b51/planarity/full/graph.c000066400000000000000000100071661522057144000235440ustar00rootroot00000000000000/* Generated by Cython 3.2.6 */ /* BEGIN: Cython Metadata { "distutils": { "depends": [], "name": "planarity.full.graph", "sources": [ "planarity/full/graph.pyx" ] }, "module_name": "planarity.full.graph" } END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ /* InitLimitedAPI */ #if defined(Py_LIMITED_API) #if !defined(CYTHON_LIMITED_API) #define CYTHON_LIMITED_API 1 #endif #elif defined(CYTHON_LIMITED_API) #ifdef _MSC_VER #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.") #else #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead. #endif #endif #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 < 0x03080000 #error Cython requires Python 3.8+. #else #define __PYX_ABI_VERSION "3_2_6" #define CYTHON_HEX_VERSION 0x030206F0 #define CYTHON_FUTURE_DIVISION 1 /* CModulePreamble */ #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #define __PYX_COMMA , #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX #if defined(GRAALVM_PYTHON) /* For very preliminary testing purposes. Most variables are set the same as PyPy. The existence of this section does not imply that anything works or is even tested */ #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 #define CYTHON_COMPILING_IN_LIMITED_API 0 #define CYTHON_COMPILING_IN_GRAAL 1 #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 #undef CYTHON_USE_TYPE_SPECS #define CYTHON_USE_TYPE_SPECS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 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_AVOID_THREAD_UNSAFE_BORROWED_REFS #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 #undef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 0 #undef CYTHON_ASSUME_SAFE_SIZE #define CYTHON_ASSUME_SAFE_SIZE 0 #undef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_GIL #define CYTHON_FAST_GIL 0 #undef CYTHON_METH_FASTCALL #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #ifndef CYTHON_PEP487_INIT_SUBCLASS #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #undef CYTHON_USE_MODULE_STATE #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_SYS_MONITORING #define CYTHON_USE_SYS_MONITORING 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_AM_SEND #define CYTHON_USE_AM_SEND 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 1 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif #undef CYTHON_USE_FREELISTS #define CYTHON_USE_FREELISTS 0 #undef CYTHON_IMMORTAL_CONSTANTS #define CYTHON_IMMORTAL_CONSTANTS 0 #elif defined(PYPY_VERSION) #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #define CYTHON_COMPILING_IN_LIMITED_API 0 #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #ifndef CYTHON_USE_TYPE_SPECS #define CYTHON_USE_TYPE_SPECS 0 #endif #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 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_AVOID_THREAD_UNSAFE_BORROWED_REFS #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 #undef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 0 #ifndef CYTHON_ASSUME_SAFE_SIZE #define CYTHON_ASSUME_SAFE_SIZE 1 #endif #undef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_GIL #define CYTHON_FAST_GIL 0 #undef CYTHON_METH_FASTCALL #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #ifndef CYTHON_PEP487_INIT_SUBCLASS #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif #if PY_VERSION_HEX < 0x03090000 #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 0 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif #undef CYTHON_USE_MODULE_STATE #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_SYS_MONITORING #define CYTHON_USE_SYS_MONITORING 0 #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00) #endif #undef CYTHON_USE_AM_SEND #define CYTHON_USE_AM_SEND 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100) #endif #undef CYTHON_USE_FREELISTS #define CYTHON_USE_FREELISTS 0 #undef CYTHON_IMMORTAL_CONSTANTS #define CYTHON_IMMORTAL_CONSTANTS 0 #elif defined(CYTHON_LIMITED_API) #ifdef Py_LIMITED_API #undef __PYX_LIMITED_VERSION_HEX #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API #endif #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 #define CYTHON_COMPILING_IN_LIMITED_API 1 #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 #undef CYTHON_USE_TYPE_SPECS #define CYTHON_USE_TYPE_SPECS 1 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #undef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 0 #ifndef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #endif #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_AVOID_THREAD_UNSAFE_BORROWED_REFS #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 #endif #undef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 0 #undef CYTHON_ASSUME_SAFE_SIZE #define CYTHON_ASSUME_SAFE_SIZE 0 #undef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_GIL #define CYTHON_FAST_GIL 0 #undef CYTHON_METH_FASTCALL #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #ifndef CYTHON_PEP487_INIT_SUBCLASS #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif #ifndef CYTHON_USE_MODULE_STATE #define CYTHON_USE_MODULE_STATE 0 #endif #undef CYTHON_USE_SYS_MONITORING #define CYTHON_USE_SYS_MONITORING 0 #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #endif #ifndef CYTHON_USE_AM_SEND #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000) #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif #ifndef CYTHON_USE_FREELISTS #define CYTHON_USE_FREELISTS 1 #endif #undef CYTHON_IMMORTAL_CONSTANTS #define CYTHON_IMMORTAL_CONSTANTS 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #define CYTHON_COMPILING_IN_LIMITED_API 0 #define CYTHON_COMPILING_IN_GRAAL 0 #ifdef Py_GIL_DISABLED #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1 #else #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 #endif #if PY_VERSION_HEX < 0x030A0000 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #elif !defined(CYTHON_USE_TYPE_SLOTS) #define CYTHON_USE_TYPE_SLOTS 1 #endif #ifndef CYTHON_USE_TYPE_SPECS #define CYTHON_USE_TYPE_SPECS 0 #endif #ifndef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #ifndef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #elif !defined(CYTHON_USE_PYLIST_INTERNALS) #define CYTHON_USE_PYLIST_INTERNALS 1 #endif #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) #define CYTHON_USE_UNICODE_WRITER 1 #endif #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS) #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 #endif #ifndef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 1 #endif #ifndef CYTHON_ASSUME_SAFE_SIZE #define CYTHON_ASSUME_SAFE_SIZE 1 #endif #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #undef CYTHON_FAST_GIL #define CYTHON_FAST_GIL 0 #elif !defined(CYTHON_FAST_GIL) #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6) #endif #ifndef CYTHON_METH_FASTCALL #define CYTHON_METH_FASTCALL 1 #endif #ifndef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 1 #endif #ifndef CYTHON_PEP487_INIT_SUBCLASS #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif #ifndef CYTHON_USE_MODULE_STATE #define CYTHON_USE_MODULE_STATE 0 #endif #ifndef CYTHON_USE_SYS_MONITORING #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1) #endif #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 1 #endif #ifndef CYTHON_USE_AM_SEND #define CYTHON_USE_AM_SEND 1 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #elif !defined(CYTHON_USE_DICT_VERSIONS) #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE) #endif #ifndef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 1 #endif #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 #endif #ifndef CYTHON_USE_FREELISTS #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) #endif #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000 #undef CYTHON_IMMORTAL_CONSTANTS #define CYTHON_IMMORTAL_CONSTANTS 0 // definitely won't work #elif !defined(CYTHON_IMMORTAL_CONSTANTS) #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) #endif #endif #ifndef CYTHON_COMPRESS_STRINGS #define CYTHON_COMPRESS_STRINGS 1 #endif #ifndef CYTHON_FAST_PYCCALL #define CYTHON_FAST_PYCCALL CYTHON_FAST_PYCALL #endif #ifndef CYTHON_VECTORCALL #if CYTHON_COMPILING_IN_LIMITED_API #define CYTHON_VECTORCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) #else #define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL) #endif #endif #if CYTHON_USE_PYLONG_INTERNALS #undef SHIFT #undef BASE #undef MASK #ifdef SIZEOF_VOID_P enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; #endif #endif #ifndef __has_attribute #define __has_attribute(x) 0 #endif #ifndef __has_cpp_attribute #define __has_cpp_attribute(x) 0 #endif #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict #else #define CYTHON_RESTRICT #endif #endif #ifndef CYTHON_UNUSED #if defined(__cplusplus) /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 * but leads to warnings with -pedantic, since it is a C++17 feature */ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) #if __has_cpp_attribute(maybe_unused) #define CYTHON_UNUSED [[maybe_unused]] #endif #endif #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_UNUSED_VAR # if defined(__cplusplus) template void CYTHON_UNUSED_VAR( const T& ) { } # else # define CYTHON_UNUSED_VAR(x) (void)(x) # endif #endif #ifndef CYTHON_MAYBE_UNUSED_VAR #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) #endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING # define CYTHON_NCP_UNUSED # else # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif #ifndef CYTHON_USE_CPP_STD_MOVE #if defined(__cplusplus) && (\ __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) #define CYTHON_USE_CPP_STD_MOVE 1 #else #define CYTHON_USE_CPP_STD_MOVE 0 #endif #endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #include typedef uintptr_t __pyx_uintptr_t; #ifndef CYTHON_FALLTHROUGH #if defined(__cplusplus) /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 * but leads to warnings with -pedantic, since it is a C++17 feature */ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) #if __has_cpp_attribute(fallthrough) #define CYTHON_FALLTHROUGH [[fallthrough]] #endif #endif #ifndef CYTHON_FALLTHROUGH #if __has_cpp_attribute(clang::fallthrough) #define CYTHON_FALLTHROUGH [[clang::fallthrough]] #elif __has_cpp_attribute(gnu::fallthrough) #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] #endif #endif #endif #ifndef CYTHON_FALLTHROUGH #if __has_attribute(fallthrough) #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) #else #define CYTHON_FALLTHROUGH #endif #endif #if defined(__clang__) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif #ifndef Py_UNREACHABLE #define Py_UNREACHABLE() assert(0); abort() #endif #ifdef __cplusplus template struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) #else #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) #endif #if CYTHON_COMPILING_IN_PYPY == 1 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x030A0000) #else #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x03090000) #endif #define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) /* CInitCode */ #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 /* PythonCompatibility */ #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_DefaultClassType PyType_Type #if CYTHON_COMPILING_IN_LIMITED_API #ifndef CO_OPTIMIZED static int CO_OPTIMIZED; #endif #ifndef CO_NEWLOCALS static int CO_NEWLOCALS; #endif #ifndef CO_VARARGS static int CO_VARARGS; #endif #ifndef CO_VARKEYWORDS static int CO_VARKEYWORDS; #endif #ifndef CO_ASYNC_GENERATOR static int CO_ASYNC_GENERATOR; #endif #ifndef CO_GENERATOR static int CO_GENERATOR; #endif #ifndef CO_COROUTINE static int CO_COROUTINE; #endif #else #ifndef CO_COROUTINE #define CO_COROUTINE 0x80 #endif #ifndef CO_ASYNC_GENERATOR #define CO_ASYNC_GENERATOR 0x200 #endif #endif static int __Pyx_init_co_variables(void); #if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) #else #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) #endif #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) #define __Pyx_Py_Is(x, y) Py_Is(x, y) #else #define __Pyx_Py_Is(x, y) ((x) == (y)) #endif #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) #else #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) #endif #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) #else #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) #endif #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) #else #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) #endif #define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) #else #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) #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 Py_TPFLAGS_SEQUENCE #define Py_TPFLAGS_SEQUENCE 0 #endif #ifndef Py_TPFLAGS_MAPPING #define Py_TPFLAGS_MAPPING 0 #endif #ifndef Py_TPFLAGS_IMMUTABLETYPE #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8) #endif #ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7) #endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif #ifndef METH_FASTCALL #ifndef METH_FASTCALL #define METH_FASTCALL 0x80 #endif typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames); #else #if PY_VERSION_HEX >= 0x030d00A4 # define __Pyx_PyCFunctionFast PyCFunctionFast # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords #else # define __Pyx_PyCFunctionFast _PyCFunctionFast # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif #endif #if CYTHON_METH_FASTCALL #define __Pyx_METH_FASTCALL METH_FASTCALL #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords #else #define __Pyx_METH_FASTCALL METH_VARARGS #define __Pyx_PyCFunction_FastCall PyCFunction #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords #endif #if CYTHON_VECTORCALL #define __pyx_vectorcallfunc vectorcallfunc #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) #else #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) #endif #if PY_VERSION_HEX >= 0x030900B1 #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func) #else #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func) #endif #define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func) #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth) #elif !CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func) #endif #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags) static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) { return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self; } #endif static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) { #if CYTHON_COMPILING_IN_LIMITED_API return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc; #else return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; #endif } #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc) #if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000) #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); #else #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) #define __Pyx_PyCMethod PyCMethod #endif #ifndef METH_METHOD #define METH_METHOD 0x200 #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_LIMITED_API #define __Pyx_PyFrame_SetLineNumber(frame, lineno) #elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno)) #elif CYTHON_COMPILING_IN_GRAAL #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno)) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif #if CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_PyThreadState_Current PyThreadState_Get() #elif !CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x030d00A1 #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked() #else #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() #endif #if CYTHON_USE_MODULE_STATE static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op) { void *result; result = PyModule_GetState(op); if (!result) Py_FatalError("Couldn't find the module state"); return result; } #define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o) #else #define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global) #endif #define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype) #define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype) #define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype) #define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype) #if CYTHON_USE_TYPE_SLOTS #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype) #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL) #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) #else #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\ ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\ (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\ __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL) #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype) #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype) #endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else #define __Pyx_PyDict_NewPresized(n) PyDict_New() #endif #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS #define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); if (res == NULL) PyErr_Clear(); return res; } #elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000 #define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError #define __Pyx_PyDict_GetItemStr PyDict_GetItem #else static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { #if CYTHON_COMPILING_IN_PYPY return PyDict_GetItem(dict, name); #else PyDictEntry *ep; PyDictObject *mp = (PyDictObject*) dict; long hash = ((PyStringObject *) name)->ob_shash; assert(hash != -1); ep = (mp->ma_lookup)(mp, name, hash); if (ep == NULL) { return NULL; } return ep->me_value; #endif } #define __Pyx_PyDict_GetItemStr PyDict_GetItem #endif #if CYTHON_USE_TYPE_SLOTS #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) #else #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) #endif #define __Pyx_PyObject_GetIterNextFunc(iterator) __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc) #if CYTHON_USE_TYPE_SPECS #define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ PyTypeObject *type = Py_TYPE((PyObject*)obj);\ assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ PyObject_GC_Del(obj);\ Py_DECREF(type);\ } #else #define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) #endif #if CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) #define __Pyx_PyUnicode_DATA(u) ((void*)u) #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) #else #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_READY(op) (0) #else #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) #endif #define __Pyx_PyUnicode_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) ((int)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, (Py_UCS4) ch) #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) #else #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) #endif #endif #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 #if !defined(PyUnicode_DecodeUnicodeEscape) #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) #endif #if !defined(PyUnicode_Contains) #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) #endif #if !defined(PyByteArray_Check) #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) #endif #if !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif #endif #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 #define __Pyx_PySequence_ListKeepNew(obj)\ (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj)) #elif CYTHON_COMPILING_IN_CPYTHON #define __Pyx_PySequence_ListKeepNew(obj)\ (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) #else #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) #endif #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) #else #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) #endif enum __Pyx_ReferenceSharing { __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check __Pyx_ReferenceSharing_OwnStrongReference, __Pyx_ReferenceSharing_FunctionArgument, __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar }; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000 #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\ (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\ (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\ (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0))) #elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1) #else #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0) #endif #if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) #else #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i) #endif #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) #else #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i)) #endif #else #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i)) #endif #if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\ __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i)) #else #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i) #endif #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result) #elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { *result = PyObject_GetItem(dict, key); if (*result == NULL) { if (PyErr_ExceptionMatches(PyExc_KeyError)) { PyErr_Clear(); return 0; } return -1; } return 1; } #else static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { *result = PyDict_GetItemWithError(dict, key); if (*result == NULL) { return PyErr_Occurred() ? -1 : 0; } Py_INCREF(*result); return 1; } #endif #if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST #define __Pyx_VISIT_CONST(obj) Py_VISIT(obj) #else #define __Pyx_VISIT_CONST(obj) #endif #if CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i) #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i) #else #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i) #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i) #endif #if CYTHON_ASSUME_SAFE_SIZE #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o) #else #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString) #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) #endif #define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t #define __Pyx_PyLong_AsHash_t __Pyx_PyIndex_AsSsize_t #if __PYX_LIMITED_VERSION_HEX >= 0x030A0000 #define __Pyx_PySendResult PySendResult #else typedef enum { PYGEN_RETURN = 0, PYGEN_ERROR = -1, PYGEN_NEXT = 1, } __Pyx_PySendResult; #endif #if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3 typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result); #else #define __Pyx_pyiter_sendfunc sendfunc #endif #if !CYTHON_USE_AM_SEND #define __PYX_HAS_PY_AM_SEND 0 #elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000 #define __PYX_HAS_PY_AM_SEND 1 #else #define __PYX_HAS_PY_AM_SEND 2 // our own backported implementation #endif #if __PYX_HAS_PY_AM_SEND < 2 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods #else typedef struct { unaryfunc am_await; unaryfunc am_aiter; unaryfunc am_anext; __Pyx_pyiter_sendfunc am_send; } __Pyx_PyAsyncMethodsStruct; #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s)) #endif #if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0 #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21) #else #define __Pyx_TPFLAGS_HAVE_AM_SEND (0) #endif #if PY_VERSION_HEX >= 0x03090000 #define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get() #else #define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp #endif #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000 #ifdef __cplusplus extern "C" #endif PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); #endif #if CYTHON_COMPILING_IN_LIMITED_API static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) { int value; PyObject *py_value = PyObject_GetAttrString(inspect, name); if (!py_value) return 0; value = (int) PyLong_AsLong(py_value); Py_DECREF(py_value); *write_to = value; return value != -1 || !PyErr_Occurred(); } static int __Pyx_init_co_variables(void) { PyObject *inspect; int result; inspect = PyImport_ImportModule("inspect"); result = #if !defined(CO_OPTIMIZED) __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) && #endif #if !defined(CO_NEWLOCALS) __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) && #endif #if !defined(CO_VARARGS) __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) && #endif #if !defined(CO_VARKEYWORDS) __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) && #endif #if !defined(CO_ASYNC_GENERATOR) __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) && #endif #if !defined(CO_GENERATOR) __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) && #endif #if !defined(CO_COROUTINE) __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) && #endif 1; Py_DECREF(inspect); return result ? 0 : -1; } #else static int __Pyx_init_co_variables(void) { return 0; // It's a limited API-only feature } #endif /* MathInitCode */ #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) #ifndef _USE_MATH_DEFINES #define _USE_MATH_DEFINES #endif #endif #include #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) #define __Pyx_truncl trunc #else #define __Pyx_truncl truncl #endif #ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME #define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0 #endif #ifndef CYTHON_CLINE_IN_TRACEBACK #define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME #endif #if CYTHON_CLINE_IN_TRACEBACK #define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; } #else #define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; } #endif #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } #ifdef CYTHON_EXTERN_C #undef __PYX_EXTERN_C #define __PYX_EXTERN_C CYTHON_EXTERN_C #elif defined(__PYX_EXTERN_C) #ifdef _MSC_VER #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") #else #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. #endif #else #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #define __PYX_HAVE__planarity__full__graph #define __PYX_HAVE_API__planarity__full__graph /* Early includes */ #include "../c/graphLib/lowLevelUtils/apiutils.h" #include "../c/graphLib/graphLib.h" #include "../c/graphLib/lowLevelUtils/appconst.h" #include "../c/graphLib/graph.h" #include "../c/graphLib/io/graphIO.h" #include "../c/graphLib/io/g6-read-iterator.h" #include "../c/graphLib/io/g6-write-iterator.h" #include "../c/graphLib/graphDFSUtils.h" #include "../c/graphLib/planarityRelated/graphPlanarity.h" #include "../c/graphLib/planarityRelated/graphOuterplanarity.h" #include "../c/graphLib/planarityRelated/graphDrawPlanar.h" #include "../c/graphLib/homeomorphSearch/graphK23Search.h" #include "../c/graphLib/homeomorphSearch/graphK33Search.h" #include "../c/graphLib/homeomorphSearch/graphK4Search.h" #include #include #ifdef _OPENMP #include #endif /* _OPENMP */ #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) #define CYTHON_WITHOUT_ASSERTIONS #endif #ifdef CYTHON_FREETHREADING_COMPATIBLE #if CYTHON_FREETHREADING_COMPATIBLE #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_NOT_USED #else #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED #endif #else #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED #endif #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 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))) ) static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { return (size_t) i < (size_t) limit; } #if defined (__cplusplus) && __cplusplus >= 201103L #include #define __Pyx_sst_abs(value) std::abs(value) #elif SIZEOF_INT >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) abs(value) #elif SIZEOF_LONG >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) labs(value) #elif defined (_MSC_VER) #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define __Pyx_sst_abs(value) llabs(value) #elif defined (__GNUC__) #define __Pyx_sst_abs(value) __builtin_llabs(value) #else #define __Pyx_sst_abs(value) ((value<0) ? -value : value) #endif static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*); #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 CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s) #else #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AsString(s)) #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s) #endif #define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) #define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) { #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef) return Py_NewRef(obj); #else Py_INCREF(obj); return obj; #endif } static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) { #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef) return Py_XNewRef(obj); #else Py_XINCREF(obj); return obj; #endif } static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b); static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x); #define __Pyx_PySequence_Tuple(obj)\ (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t); static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x) #else #define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x) #endif #define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x)) #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) #if CYTHON_USE_PYLONG_INTERNALS #if PY_VERSION_HEX >= 0x030C00A7 #ifndef _PyLong_SIGN_MASK #define _PyLong_SIGN_MASK 3 #endif #ifndef _PyLong_NON_SIZE_BITS #define _PyLong_NON_SIZE_BITS 3 #endif #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) #define __Pyx_PyLong_SignedDigitCount(x)\ ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) #else #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) #endif typedef Py_ssize_t __Pyx_compact_pylong; typedef size_t __Pyx_compact_upylong; #else #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) #define __Pyx_PyLong_CompactValue(x)\ ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) typedef sdigit __Pyx_compact_pylong; typedef digit __Pyx_compact_upylong; #endif #if PY_VERSION_HEX >= 0x030C00A5 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) #else #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) #endif #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) #elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL) #else #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #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__ */ /* PretendToInitialize */ #ifdef __cplusplus #if __cplusplus > 201103L #include #endif template static void __Pyx_pretend_to_initialize(T* ptr) { #if __cplusplus > 201103L if ((std::is_trivially_default_constructible::value)) #endif *ptr = T(); (void)ptr; } #else static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } #endif #if !CYTHON_USE_MODULE_STATE static PyObject *__pyx_m = NULL; #endif static int __pyx_lineno; static int __pyx_clineno = 0; static const char * const __pyx_cfilenm = __FILE__; static const char *__pyx_filename; /* #### Code section: filename_table ### */ static const char* const __pyx_f[] = { "planarity/full/graph.pyx", "", }; /* #### Code section: utility_code_proto_before_types ### */ /* Atomics.proto (used by UnpackUnboundCMethod) */ #include #ifndef CYTHON_ATOMICS #define CYTHON_ATOMICS 1 #endif #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS #define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #define __pyx_atomic_int_type int #define __pyx_nonatomic_int_type int #if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ (__STDC_VERSION__ >= 201112L) &&\ !defined(__STDC_NO_ATOMICS__)) #include #elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ (__cplusplus >= 201103L) ||\ (defined(_MSC_VER) && _MSC_VER >= 1700))) #include #endif #if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ (__STDC_VERSION__ >= 201112L) &&\ !defined(__STDC_NO_ATOMICS__) &&\ ATOMIC_INT_LOCK_FREE == 2) #undef __pyx_atomic_int_type #define __pyx_atomic_int_type atomic_int #define __pyx_atomic_ptr_type atomic_uintptr_t #define __pyx_nonatomic_ptr_type uintptr_t #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel) #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg) #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) #define __pyx_atomic_load(value) atomic_load(value) #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value) #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed) #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire) #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) #pragma message ("Using standard C atomics") #elif defined(__PYX_DEBUG_ATOMICS) #warning "Using standard C atomics" #endif #elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ (__cplusplus >= 201103L) ||\ \ (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ ATOMIC_INT_LOCK_FREE == 2) #undef __pyx_atomic_int_type #define __pyx_atomic_int_type std::atomic_int #define __pyx_atomic_ptr_type std::atomic_uintptr_t #define __pyx_nonatomic_ptr_type uintptr_t #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel) #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg) #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) #define __pyx_atomic_load(value) std::atomic_load(value) #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value) #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed) #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire) #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) #pragma message ("Using standard C++ atomics") #elif defined(__PYX_DEBUG_ATOMICS) #warning "Using standard C++ atomics" #endif #elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ (__GNUC_MINOR__ > 1 ||\ (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) #define __pyx_atomic_ptr_type void* #define __pyx_nonatomic_ptr_type void* #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1) #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1) #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1) #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg) static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired); int result = old == *expected; *expected = old; return result; } #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0) #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value) #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0) #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0) #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value) static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired); int result = old == *expected; *expected = old; return result; } #ifdef __PYX_DEBUG_ATOMICS #warning "Using GNU atomics" #endif #elif CYTHON_ATOMICS && defined(_MSC_VER) #include #undef __pyx_atomic_int_type #define __pyx_atomic_int_type long #define __pyx_atomic_ptr_type void* #undef __pyx_nonatomic_int_type #define __pyx_nonatomic_int_type long #define __pyx_nonatomic_ptr_type void* #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer) #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1) #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1) #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1) #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg) static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected); int result = old == *expected; *expected = old; return result; } #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0) #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value) #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0) #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value) static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected); int result = old == *expected; *expected = old; return result; } #ifdef __PYX_DEBUG_ATOMICS #pragma message ("Using MSVC atomics") #endif #else #undef CYTHON_ATOMICS #define CYTHON_ATOMICS 0 #ifdef __PYX_DEBUG_ATOMICS #warning "Not using atomics" #endif #endif /* CriticalSectionsDefinition.proto (used by CriticalSections) */ #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #define __Pyx_PyCriticalSection void* #define __Pyx_PyCriticalSection2 void* #define __Pyx_PyCriticalSection_End(cs) #define __Pyx_PyCriticalSection2_End(cs) #else #define __Pyx_PyCriticalSection PyCriticalSection #define __Pyx_PyCriticalSection2 PyCriticalSection2 #define __Pyx_PyCriticalSection_End PyCriticalSection_End #define __Pyx_PyCriticalSection2_End PyCriticalSection2_End #endif /* CriticalSections.proto (used by ParseKeywordsImpl) */ #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs) #define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs) #else #define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin #define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin #endif #if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_BEGIN_CRITICAL_SECTION(o) { #define __Pyx_END_CRITICAL_SECTION() } #else #define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION #define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION #endif /* IncludeStructmemberH.proto (used by FixUpExtensionType) */ #include /* #### Code section: numeric_typedefs ### */ /* #### Code section: complex_type_declarations ### */ /* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ struct __pyx_obj_9planarity_4full_5graph_Graph; /* "planarity/full/graph.pxd":12 * from planarity.full cimport graphLib * * cdef class Graph: # <<<<<<<<<<<<<< * cdef graphLib.graphP _theGraph */ struct __pyx_obj_9planarity_4full_5graph_Graph { PyObject_HEAD graphP _theGraph; }; /* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, Py_ssize_t); void (*DECREF)(void*, PyObject*, Py_ssize_t); void (*GOTREF)(void*, PyObject*, Py_ssize_t); void (*GIVEREF)(void*, PyObject*, Py_ssize_t); void* (*SetupContext)(const char*, Py_ssize_t, 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; #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__));\ } #define __Pyx_RefNannyFinishContextNogil() {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ __Pyx_RefNannyFinishContext();\ PyGILState_Release(__pyx_gilstate_save);\ } #define __Pyx_RefNannyFinishContextNogil() {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ __Pyx_RefNannyFinishContext();\ PyGILState_Release(__pyx_gilstate_save);\ } #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); else {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContextNogil() #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_Py_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; Py_XDECREF(tmp);\ } while (0) #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) /* TupleAndListFromArray.proto (used by fastcall) */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); #endif #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); #endif /* IncludeStringH.proto (used by BytesEquals) */ #include /* BytesEquals.proto (used by UnicodeEquals) */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /* UnicodeEquals.proto (used by fastcall) */ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /* fastcall.proto */ #if CYTHON_AVOID_BORROWED_REFS #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i) #elif CYTHON_ASSUME_SAFE_MACROS #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i)) #else #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i)) #endif #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) #define __Pyx_KwValues_VARARGS(args, nargs) NULL #define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) #define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) #if CYTHON_METH_FASTCALL #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i]) #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds) #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues); #else #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) #endif #else #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS #endif #define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) #if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start) #else #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) #endif /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /* py_dict_items.proto (used by OwnedDictNext) */ static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); /* CallCFunction.proto (used by CallUnboundCMethod0) */ #define __Pyx_CallCFunction(cfunc, self, args)\ ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args) #define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\ ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs) #define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\ ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs) #define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\ ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames) /* PyObjectCall.proto (used by PyObjectFastCall) */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); #else #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif /* PyObjectCallMethO.proto (used by PyObjectFastCall) */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif /* PyObjectFastCall.proto (used by PyObjectCallOneArg) */ #define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs); /* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); /* PyObjectGetAttrStr.proto (used by UnpackUnboundCMethod) */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif /* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */ typedef struct { PyObject *type; PyObject **method_name; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS __pyx_atomic_int_type initialized; #endif PyCFunction func; PyObject *method; int flag; } __Pyx_CachedCFunction; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) { #if !CYTHON_ATOMICS return 1; #else __pyx_nonatomic_int_type expected = 0; if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) { return 0; } return expected; #endif } static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) { #if CYTHON_ATOMICS __pyx_atomic_store(&cfunc->initialized, 2); #endif } #else #define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2 #define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc) #endif /* CallUnboundCMethod0.proto */ CYTHON_UNUSED static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); #else #define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self) #endif /* py_dict_values.proto (used by OwnedDictNext) */ static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); /* OwnedDictNext.proto (used by RejectKeywords) */ #if CYTHON_AVOID_BORROWED_REFS static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue); #else CYTHON_INLINE static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue); #endif /* RejectKeywords.export */ static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds); /* PyMemoryError_Check.proto */ #define __Pyx_PyExc_MemoryError_Check(obj) __Pyx_TypeCheck(obj, PyExc_MemoryError) /* PyThreadStateGet.proto (used by PyErrFetchRestore) */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; #if PY_VERSION_HEX >= 0x030C00A6 #define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) #else #define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) #endif #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign #define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) #define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() #endif /* PyErrFetchRestore.proto (used by RaiseException) */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) #else #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) #endif #else #define __Pyx_PyErr_Clear() PyErr_Clear() #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif /* RaiseException.export */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /* WriteUnraisableException.proto */ static void __Pyx_WriteUnraisable(const char *name, int clineno, int lineno, const char *filename, int full_traceback, int nogil); /* RaiseDoubleKeywords.proto (used by ParseKeywordsImpl) */ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /* ParseKeywordsImpl.export */ static int __Pyx_ParseKeywordsTuple( PyObject *kwds, PyObject * const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs ); static int __Pyx_ParseKeywordDictToDict( PyObject *kwds, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name ); static int __Pyx_ParseKeywordDict( PyObject *kwds, PyObject ** const argnames[], PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs ); /* CallUnboundCMethod2.proto */ CYTHON_UNUSED static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2); #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2); #else #define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) #endif /* ParseKeywords.proto */ static CYTHON_INLINE int __Pyx_ParseKeywords( PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs ); /* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); #else #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) #endif /* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); /* GetBuiltinName.proto (used by GetModuleGlobalName) */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); /* PyDictVersioning.proto (used by GetModuleGlobalName) */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ (version_var) = __PYX_GET_DICT_VERSION(dict);\ (cache_var) = (value); #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\ } else {\ (VAR) = __pyx_dict_cached_value = (LOOKUP);\ __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ }\ } static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); #else #define __PYX_GET_DICT_VERSION(dict) (0) #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); #endif /* GetModuleGlobalName.proto */ #if CYTHON_USE_DICT_VERSIONS #define __Pyx_GetModuleGlobalName(var, name) do {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\ (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ } while(0) #define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ PY_UINT64_T __pyx_dict_version;\ PyObject *__pyx_dict_cached_value;\ (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ } while(0) static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); #else #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif /* PyRuntimeError_Check.proto */ #define __Pyx_PyExc_RuntimeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_RuntimeError) /* BuildPyUnicode.proto (used by COrdinalToPyUnicode) */ static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength, int prepend_sign, char padding_char); /* COrdinalToPyUnicode.proto (used by CIntToPyUnicode) */ static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value); static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t width, char padding_char); /* GCCDiagnostics.proto (used by CIntToPyUnicode) */ #if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) #define __Pyx_HAS_GCC_DIAGNOSTIC #endif /* IncludeStdlibH.proto (used by CIntToPyUnicode) */ #include /* CIntToPyUnicode.proto */ #define __Pyx_PyUnicode_From_int(value, width, padding_char, format_char) (\ ((format_char) == ('c')) ?\ __Pyx_uchar___Pyx_PyUnicode_From_int(value, width, padding_char) :\ __Pyx____Pyx_PyUnicode_From_int(value, width, padding_char, format_char)\ ) static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char); static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char); /* JoinPyUnicode.export */ static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength, Py_UCS4 max_char); /* pyint_simplify.proto */ static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none); /* ArgTypeTestFunc.export */ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); /* ArgTypeTest.proto */ #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\ __Pyx__ArgTypeTest(obj, type, name, exact)) /* PyValueError_Check.proto */ #define __Pyx_PyExc_ValueError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ValueError) /* PyObjectFastCallMethod.proto */ #if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000 #define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL) #else static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf); #endif /* PyUnicode_Unicode.proto */ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj); /* decode_c_string_utf16.proto (used by decode_c_bytes) */ static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { int byteorder = 0; return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); } static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { int byteorder = -1; return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); } static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { int byteorder = 1; return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); } /* decode_c_bytes.proto (used by decode_bytes) */ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); /* decode_bytes.proto */ static CYTHON_INLINE PyObject* __Pyx_decode_bytes( PyObject* string, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { char* as_c_string; Py_ssize_t size; #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE as_c_string = PyBytes_AS_STRING(string); size = PyBytes_GET_SIZE(string); #else if (PyBytes_AsStringAndSize(string, &as_c_string, &size) < 0) { return NULL; } #endif return __Pyx_decode_c_bytes( as_c_string, size, start, stop, encoding, errors, decode_func); } /* GetTopmostException.proto (used by SaveResetException) */ #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); #endif /* SaveResetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); #else #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) #endif /* GetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); #endif /* SwapException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); #endif /* PyObjectFormatSimple.proto */ #if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyObject_FormatSimple(s, f) (\ likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ PyObject_Format(s, f)) #elif CYTHON_USE_TYPE_SLOTS #define __Pyx_PyObject_FormatSimple(s, f) (\ likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\ likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\ PyObject_Format(s, f)) #else #define __Pyx_PyObject_FormatSimple(s, f) (\ likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\ PyObject_Format(s, f)) #endif /* PyTypeError_Check.proto */ #define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError) /* AllocateExtensionType.proto */ static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final); /* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */ #if CYTHON_COMPILING_IN_LIMITED_API static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp); #endif /* SetItemOnTypeDict.proto (used by FixUpExtensionType) */ static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v); #define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v) /* FixUpExtensionType.proto */ static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); /* PyObjectCallNoArg.proto (used by PyObjectCallMethod0) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); /* PyObjectGetMethod.proto (used by PyObjectCallMethod0) */ #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); #endif /* PyObjectCallMethod0.proto (used by PyType_Ready) */ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); /* ValidateBasesTuple.proto (used by PyType_Ready) */ #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); #endif /* PyType_Ready.proto */ CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); /* DelItemOnTypeDict.proto (used by SetupReduce) */ static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k); #define __Pyx_DelItemOnTypeDict(tp, k) __Pyx__DelItemOnTypeDict((PyTypeObject*)tp, k) /* SetupReduce.proto */ static int __Pyx_setup_reduce(PyObject* type_obj); /* FunctionImport.proto */ static int __Pyx_ImportFunction_3_2_6(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /* HasAttr.proto (used by ImportImpl) */ #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n) #else static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); #endif /* ImportImpl.export */ static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level); /* Import.proto */ static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level); /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /* dict_setdefault.proto (used by FetchCommonType) */ static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value); /* AddModuleRef.proto (used by FetchSharedCythonModule) */ #if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\ __PYX_LIMITED_VERSION_HEX < 0x030d0000) static PyObject *__Pyx_PyImport_AddModuleRef(const char *name); #else #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) #endif /* FetchSharedCythonModule.proto (used by FetchCommonType) */ static PyObject *__Pyx_FetchSharedCythonABIModule(void); /* FetchCommonType.proto (used by CommonTypesMetaclass) */ static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases); /* CommonTypesMetaclass.proto (used by CythonFunctionShared) */ static int __pyx_CommonTypesMetaclass_init(PyObject *module); #define __Pyx_CommonTypesMetaclass_USED /* CallTypeTraverse.proto (used by CythonFunctionShared) */ #if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) #define __Pyx_call_type_traverse(o, always_call, visit, arg) 0 #else static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg); #endif /* PyMethodNew.proto (used by CythonFunctionShared) */ static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ); /* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */ #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); #endif /* CythonFunctionShared.proto (used by CythonFunction) */ #define __Pyx_CyFunction_USED #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 #define __Pyx_CYFUNCTION_CCLASS 0x04 #define __Pyx_CYFUNCTION_COROUTINE 0x08 #define __Pyx_CyFunction_GetClosure(f)\ (((__pyx_CyFunctionObject *) (f))->func_closure) #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_CyFunction_GetClassObj(f)\ (((__pyx_CyFunctionObject *) (f))->func_classobj) #else #define __Pyx_CyFunction_GetClassObj(f)\ ((PyObject*) ((PyCMethodObject *) (f))->mm_class) #endif #define __Pyx_CyFunction_SetClassObj(f, classobj)\ __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) #define __Pyx_CyFunction_Defaults(type, f)\ ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) typedef struct { #if CYTHON_COMPILING_IN_LIMITED_API PyObject_HEAD PyObject *func; #elif PY_VERSION_HEX < 0x030900B1 PyCFunctionObject func; #else PyCMethodObject func; #endif #if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL __pyx_vectorcallfunc func_vectorcall; #endif #if CYTHON_COMPILING_IN_LIMITED_API PyObject *func_weakreflist; #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API PyObject *func_dict; #endif PyObject *func_name; PyObject *func_qualname; PyObject *func_doc; PyObject *func_globals; PyObject *func_code; PyObject *func_closure; #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API PyObject *func_classobj; #endif PyObject *defaults; int flags; PyObject *defaults_tuple; PyObject *defaults_kwdict; PyObject *(*defaults_getter)(PyObject *); PyObject *func_annotations; PyObject *func_is_coroutine; } __pyx_CyFunctionObject; #undef __Pyx_CyOrPyCFunction_Check #define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType) #define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type) #define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType) static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)); #undef __Pyx_IsSameCFunction #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc) static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject *globals, PyObject* code); static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type); static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, PyObject *tuple); static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, PyObject *dict); static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, PyObject *dict); static int __pyx_CyFunction_init(PyObject *module); #if CYTHON_METH_FASTCALL static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); #if CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) #else #define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) #endif #endif /* CythonFunction.proto */ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject *globals, PyObject* code); /* CLineInTraceback.proto (used by AddTraceback) */ #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #else #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) #endif /* CodeObjectCache.proto (used by AddTraceback) */ #if CYTHON_COMPILING_IN_LIMITED_API typedef PyObject __Pyx_CachedCodeObjectType; #else typedef PyCodeObject __Pyx_CachedCodeObjectType; #endif typedef struct { __Pyx_CachedCodeObjectType* code_object; int code_line; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_atomic_int_type accessor_count; #endif }; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object); /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE unsigned int __Pyx_PyLong_As_unsigned_int(PyObject *); /* PyObjectVectorCallKwBuilder.proto (used by CIntToPy) */ CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); #if CYTHON_VECTORCALL #if PY_VERSION_HEX >= 0x03090000 #define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall #else #define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall #endif #define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n) static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n); #else #define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict #define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n) #define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value) #define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value) #endif /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value); /* FormatTypeName.proto */ #if CYTHON_COMPILING_IN_LIMITED_API typedef PyObject *__Pyx_TypeName; #define __Pyx_FMT_TYPENAME "%U" #define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName #else static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp); #endif #else // !LIMITED_API typedef const char *__Pyx_TypeName; #define __Pyx_FMT_TYPENAME "%.200s" #define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name) #define __Pyx_DECREF_TypeName(obj) #endif /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); /* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) { return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2); } #endif #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) #ifdef PyExceptionInstance_Check #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj) #else #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException) #endif /* GetRuntimeVersion.proto */ #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 static unsigned long __Pyx_cached_runtime_version = 0; static void __Pyx_init_runtime_version(void); #else #define __Pyx_init_runtime_version() #endif static unsigned long __Pyx_get_runtime_version(void); /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); /* DecompressString.proto */ static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo); /* MultiPhaseInitModuleState.proto */ #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE static PyObject *__Pyx_State_FindModule(void*); static int __Pyx_State_AddModule(PyObject* module, void*); static int __Pyx_State_RemoveModule(void*); #elif CYTHON_USE_MODULE_STATE #define __Pyx_State_FindModule PyState_FindModule #define __Pyx_State_AddModule PyState_AddModule #define __Pyx_State_RemoveModule PyState_RemoveModule #endif /* #### Code section: module_declarations ### */ /* CythonABIVersion.proto */ #if CYTHON_COMPILING_IN_LIMITED_API #if CYTHON_METH_FASTCALL #define __PYX_FASTCALL_ABI_SUFFIX "_fastcall" #else #define __PYX_FASTCALL_ABI_SUFFIX #endif #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX #else #define __PYX_LIMITED_ABI_SUFFIX #endif #if __PYX_HAS_PY_AM_SEND == 1 #define __PYX_AM_SEND_ABI_SUFFIX #elif __PYX_HAS_PY_AM_SEND == 2 #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport" #else #define __PYX_AM_SEND_ABI_SUFFIX "noamsend" #endif #ifndef __PYX_MONITORING_ABI_SUFFIX #define __PYX_MONITORING_ABI_SUFFIX #endif #if CYTHON_USE_TP_FINALIZE #define __PYX_TP_FINALIZE_ABI_SUFFIX #else #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize" #endif #if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED) #define __PYX_FREELISTS_ABI_SUFFIX #else #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists" #endif #define CYTHON_ABI __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." /* Module declarations from "planarity.full" */ /* Module declarations from "planarity.full.cgraphLib" */ /* Module declarations from "planarity.full.graphLib" */ static graphP (*__pyx_f_9planarity_4full_8graphLib_gp_New)(void); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_EnsureVertexCapacity)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_EnsureEdgeCapacity)(graphP, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_ResetGraphStorage)(graphP); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_Free)(graphP *); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetN)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetNV)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetM)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetEdgeCapacity)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_CopyGraph)(graphP, graphP); /*proto*/ static graphP (*__pyx_f_9planarity_4full_8graphLib_gp_DupGraph)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_CopyAdjacencyLists)(graphP, graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_CreateRandomGraph)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_CreateRandomGraphEx)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_IsNeighbor)(graphP, int, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_FindEdge)(graphP, int, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetVertexDegree)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_IsNeighborDirected)(graphP, int, int, unsigned int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_FindDirectedEdge)(graphP, int, int, unsigned int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetVertexInDegree)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetVertexOutDegree)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_AddEdge)(graphP, int, int, int, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_DynamicAddEdge)(graphP, int, int, int, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_InsertEdge)(graphP, int, int, int, int, int, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_DeleteEdge)(graphP, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_HideEdge)(graphP, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_RestoreEdge)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_HideVertex)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_RestoreVertex)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_ContractEdge)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_IdentifyVertices)(graphP, int, int, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_RestoreVertices)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetGraphFlags)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetFirstEdge)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetLastEdge)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetEdgeByLink)(graphP, int, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_SetFirstEdge)(graphP, int, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_SetLastEdge)(graphP, int, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_SetEdgeByLink)(graphP, int, int, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_LowerBoundVertices)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_UpperBoundVertices)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_LowerBoundVirtualVertices)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_UpperBoundVirtualVertices)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_LowerBoundVertexStorage)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_UpperBoundVertexStorage)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_IsVertex)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_IsVirtualVertex)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_IsNotVertex)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_IsNotVirtualVertex)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_VirtualVertexInUse)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_VirtualVertexNotInUse)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetIndex)(graphP, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_SetIndex)(graphP, int, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_InitFlags)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetVisited)(graphP, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_ClearVisited)(graphP, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_SetVisited)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetMarked)(graphP, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_ClearMarked)(graphP, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_SetMarked)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetTwin)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetNextEdge)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetPrevEdge)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetAdjacentEdge)(graphP, int, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_SetNextEdge)(graphP, int, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_SetPrevEdge)(graphP, int, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_SetAdjacentEdge)(graphP, int, int, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_IsEdge)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_IsNotEdge)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetNeighbor)(graphP, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_SetNeighbor)(graphP, int, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_InitEdgeFlags)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetEdgeVisited)(graphP, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeVisited)(graphP, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_SetEdgeVisited)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetEdgeMarked)(graphP, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeMarked)(graphP, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_SetEdgeMarked)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetEdgeType)(graphP, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeType)(graphP, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_SetEdgeType)(graphP, int, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_ResetEdgeType)(graphP, int, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetEdgeFlagInverted)(graphP, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_SetEdgeFlagInverted)(graphP, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeFlagInverted)(graphP, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_XorEdgeFlagInverted)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetDirection)(graphP, int); /*proto*/ static void (*__pyx_f_9planarity_4full_8graphLib_gp_SetDirection)(graphP, int, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_LowerBoundEdges)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_UpperBoundEdges)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_EdgeInUse)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_LowerBoundEdgeStorage)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_UpperBoundEdgeStorage)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_Read)(graphP, char *); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_ReadFromString)(graphP, char *); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_Write)(graphP, char *, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_WriteToString)(graphP, char **, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_DFSUtils)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_DepthFirstSearch)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_SortVertices)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_ComputeLowpoints)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_ComputeLeastAncestors)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetParent)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetLeastAncestor)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetLowpoint)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetBicompRootFromDFSChild)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_GetDFSChildFromBicompRoot)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_IsBicompRoot)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_IsSeparatedDFSChild)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_IsNotSeparatedDFSChild)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_Planarity)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_Embed)(graphP, unsigned int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_TestEmbedResultIntegrity)(graphP, graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_Outerplanarity)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_DrawPlanar)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_RenderToFile)(graphP, char *); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_RenderToString)(graphP, char **); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetVertexPosition)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetVertexStart)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetVertexEnd)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetEdgePosition)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetEdgeStart)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetEdgeEnd)(graphP, int); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_K23Search)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_K33Search)(graphP); /*proto*/ static int (*__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_K4Search)(graphP); /*proto*/ /* Module declarations from "libc.string" */ /* Module declarations from "libc.stdlib" */ /* Module declarations from "planarity.full.graph" */ /* #### Code section: typeinfo ### */ /* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "planarity.full.graph" extern int __pyx_module_is_main_planarity__full__graph; int __pyx_module_is_main_planarity__full__graph = 0; /* Implementation of "planarity.full.graph" */ /* #### Code section: global_var ### */ /* #### Code section: string_decls ### */ static const char __pyx_k_Cython_wrapper_for_the_Edge_Add[] = "\nCython wrapper for the Edge Addition Planarity Suite Graph Library\n\nWraps a graphP struct using a Cython class and wraps functions and macros that\noperate over graphP structs.\n"; /* #### Code section: decls ### */ static int __pyx_pf_9planarity_4full_5graph_5Graph___cinit__(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static void __pyx_pf_9planarity_4full_5graph_5Graph_2__dealloc__(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_4gp_EnsureVertexCapacity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_N); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_6gp_EnsureEdgeCapacity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_requiredEdgeCapacity); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_8gp_ResetGraphStorage(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_10gp_GetN(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_12gp_GetNV(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_14gp_GetM(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_16gp_GetEdgeCapacity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_18gp_CopyGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_srcGraph); /* proto */ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full_5graph_5Graph_20gp_DupGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_22gp_CopyAdjacencyLists(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_srcGraph); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_24gp_CreateRandomGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_26gp_CreateRandomGraphEx(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_numEdges); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_28gp_IsNeighbor(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_30gp_FindEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_32gp_GetVertexDegree(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_34gp_IsNeighborDirected(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_v, unsigned int __pyx_v_direction); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_36gp_FindDirectedEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_v, unsigned int __pyx_v_direction); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_GetVertexInDegree(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_40gp_GetVertexOutDegree(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_42gp_AddEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_ulink, int __pyx_v_v, int __pyx_v_vlink); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_44gp_DynamicAddEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_ulink, int __pyx_v_v, int __pyx_v_vlink); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_InsertEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_e_u, int __pyx_v_e_ulink, int __pyx_v_v, int __pyx_v_e_v, int __pyx_v_e_vlink); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_48gp_DeleteEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_50gp_HideEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_52gp_RestoreEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_HideVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_vertex); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_56gp_RestoreVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_58gp_ContractEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_60gp_IdentifyVertices(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_v, int __pyx_v_eBefore); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_62gp_RestoreVertices(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_64gp_GetGraphFlags(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_66gp_GetFirstEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_68gp_GetLastEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_70gp_GetEdgeByLink(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v, int __pyx_v_theLink); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_72gp_SetFirstEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v, int __pyx_v_newFirstEdge); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_74gp_SetLastEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v, int __pyx_v_newLastEdge); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_76gp_SetEdgeByLink(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v, int __pyx_v_theLink, int __pyx_v_newEdge); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_78gp_LowerBoundVertices(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_80gp_UpperBoundVertices(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_82gp_LowerBoundVirtualVertices(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_84gp_UpperBoundVirtualVertices(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_86gp_LowerBoundVertexStorage(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_88gp_UpperBoundVertexStorage(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_90gp_IsVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_92gp_IsVirtualVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_94gp_IsNotVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_96gp_IsNotVirtualVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_98gp_VirtualVertexInUse(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_virtualVertex); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_100gp_VirtualVertexNotInUse(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_virtualVertex); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_102gp_GetIndex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_104gp_SetIndex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v, int __pyx_v_theIndex); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_106gp_InitFlags(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_108gp_GetVisited(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_110gp_ClearVisited(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_112gp_SetVisited(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_114gp_GetMarked(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_116gp_ClearMarked(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_118gp_SetMarked(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_120gp_GetTwin(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_122gp_GetNextEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_124gp_GetPrevEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_126gp_GetAdjacentEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e, int __pyx_v_theLink); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_128gp_SetNextEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e, int __pyx_v_newNextEdge); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_130gp_SetPrevEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e, int __pyx_v_newPrevEdge); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_132gp_SetAdjacentEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e, int __pyx_v_theLink, int __pyx_v_newEdge); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_134gp_IsEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_136gp_IsNotEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_138gp_GetNeighbor(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_140gp_SetNeighbor(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_142gp_InitEdgeFlags(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_144gp_GetEdgeVisited(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_146gp_ClearEdgeVisited(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_148gp_SetEdgeVisited(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_150gp_GetEdgeMarked(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_152gp_ClearEdgeMarked(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_154gp_SetEdgeMarked(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_156gp_GetEdgeType(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_158gp_ClearEdgeType(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_160gp_SetEdgeType(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e, int __pyx_v_type); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_162gp_ResetEdgeType(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e, int __pyx_v_type); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_164gp_GetEdgeFlagInverted(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_166gp_SetEdgeFlagInverted(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_168gp_ClearEdgeFlagInverted(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_170gp_XorEdgeFlagInverted(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_172gp_GetDirection(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_174gp_SetDirection(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e, int __pyx_v_direction); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_176gp_LowerBoundEdges(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_178gp_UpperBoundEdges(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_180gp_EdgeInUse(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_182gp_EdgeNotInUse(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_184gp_LowerBoundEdgeStorage(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_186gp_UpperBoundEdgeStorage(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_188gp_Read(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, PyObject *__pyx_v_fileName); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_190gp_ReadFromString(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, PyObject *__pyx_v_inputStr); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_192gp_Write(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, PyObject *__pyx_v_fileName, int __pyx_v_writeMode); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_194gp_WriteToString(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_writeMode); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_196gp_ExtendWith_DFSUtils(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_198gp_DepthFirstSearch(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_200gp_SortVertices(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_202gp_ComputeLowpoints(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_204gp_ComputeLeastAncestors(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_206gp_GetParent(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_208gp_GetLeastAncestor(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_210gp_GetLowpoint(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_212gp_IsDFSTreeRoot(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_214gp_IsNotDFSTreeRoot(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_216gp_GetBicompRootFromDFSChild(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_c); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_218gp_GetDFSChildFromBicompRoot(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_R); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_220gp_GetVertexFromBicompRoot(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_R); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_222gp_IsBicompRoot(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_224gp_IsSeparatedDFSChild(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_theChild); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_226gp_IsNotSeparatedDFSChild(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_theChild); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_228gp_ExtendWith_Planarity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_230gp_Embed(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_embedFlags); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_232gp_TestEmbedResultIntegrity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_origGraph, int __pyx_v_embedResult); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_234gp_ExtendWith_Outerplanarity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_236gp_ExtendWith_DrawPlanar(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_238gp_DrawPlanar_RenderToFile(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, PyObject *__pyx_v_theFileName); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_240gp_DrawPlanar_RenderToString(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_242gp_DrawPlanar_GetVertexPosition(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_244gp_DrawPlanar_GetVertexStart(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_246gp_DrawPlanar_GetVertexEnd(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_248gp_DrawPlanar_GetEdgePosition(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_250gp_DrawPlanar_GetEdgeStart(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_252gp_DrawPlanar_GetEdgeEnd(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_254gp_ExtendWith_K23Search(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_256gp_ExtendWith_K33Search(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_258gp_ExtendWith_K4Search(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_260__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_262__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_tp_new_9planarity_4full_5graph_Graph(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ /* #### Code section: late_includes ### */ /* #### Code section: module_state ### */ /* SmallCodeConfig */ #ifndef CYTHON_SMALL_CODE #if defined(__clang__) #define CYTHON_SMALL_CODE #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) #define CYTHON_SMALL_CODE __attribute__((cold)) #else #define CYTHON_SMALL_CODE #endif #endif typedef struct { PyObject *__pyx_d; PyObject *__pyx_b; PyObject *__pyx_cython_runtime; PyObject *__pyx_empty_tuple; PyObject *__pyx_empty_bytes; PyObject *__pyx_empty_unicode; PyObject *__pyx_type_9planarity_4full_5graph_Graph; PyTypeObject *__pyx_ptype_9planarity_4full_5graph_Graph; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; PyObject *__pyx_codeobj_tab[130]; PyObject *__pyx_string_tab[626]; /* #### Code section: module_state_contents ### */ /* CommonTypesMetaclass.module_state_decls */ PyTypeObject *__pyx_CommonTypesMetaclassType; /* CachedMethodType.module_state_decls */ #if CYTHON_COMPILING_IN_LIMITED_API PyObject *__Pyx_CachedMethodType; #endif /* CythonFunctionShared.module_state_decls */ PyTypeObject *__pyx_CyFunctionType; /* CodeObjectCache.module_state_decls */ struct __Pyx_CodeObjectCache __pyx_code_cache; /* #### Code section: module_state_end ### */ } __pyx_mstatetype; #if CYTHON_USE_MODULE_STATE #ifdef __cplusplus namespace { extern struct PyModuleDef __pyx_moduledef; } /* anonymous namespace */ #else static struct PyModuleDef __pyx_moduledef; #endif #define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef))) #define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef)) #else static __pyx_mstatetype __pyx_mstate_global_static = #ifdef __cplusplus {}; #else {0}; #endif static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static; #endif /* #### Code section: constant_name_defines ### */ #define __pyx_kp_u_ __pyx_string_tab[0] #define __pyx_kp_u_Failed_embed_result_integrity_ch __pyx_string_tab[1] #define __pyx_kp_u_Failed_to_convert_C_string_to_Py __pyx_string_tab[2] #define __pyx_kp_u_Failed_to_extend_graph_with_Draw __pyx_string_tab[3] #define __pyx_kp_u_Failed_to_extend_graph_with_K23S __pyx_string_tab[4] #define __pyx_kp_u_Failed_to_extend_graph_with_K33S __pyx_string_tab[5] #define __pyx_kp_u_Failed_to_extend_graph_with_K4Se __pyx_string_tab[6] #define __pyx_kp_u_Failed_to_extend_graph_with_Oute __pyx_string_tab[7] #define __pyx_kp_u_Failed_to_extend_graph_with_Plan __pyx_string_tab[8] #define __pyx_kp_u_Failed_to_perform_embed_operatio __pyx_string_tab[9] #define __pyx_kp_u_Failed_to_render_embedding_to_C __pyx_string_tab[10] #define __pyx_kp_u_Failed_to_render_embedding_to_fi __pyx_string_tab[11] #define __pyx_kp_u_Invalid_link_index_for_ulink __pyx_string_tab[12] #define __pyx_kp_u_Invalid_link_index_for_vlink __pyx_string_tab[13] #define __pyx_kp_u_None __pyx_string_tab[14] #define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[15] #define __pyx_kp_u_Unable_to_copy_adjacency_lists_f __pyx_string_tab[16] #define __pyx_kp_u_Unable_to_create_random_graph __pyx_string_tab[17] #define __pyx_kp_u_Unable_to_create_random_graph_wi __pyx_string_tab[18] #define __pyx_kp_u_Underlying_gp_DrawPlanar_GetEdge __pyx_string_tab[19] #define __pyx_kp_u_Underlying_gp_DrawPlanar_GetEdge_2 __pyx_string_tab[20] #define __pyx_kp_u_Underlying_gp_DrawPlanar_GetEdge_3 __pyx_string_tab[21] #define __pyx_kp_u_Underlying_gp_DrawPlanar_GetVert __pyx_string_tab[22] #define __pyx_kp_u_Underlying_gp_DrawPlanar_GetVert_2 __pyx_string_tab[23] #define __pyx_kp_u_Underlying_gp_DrawPlanar_GetVert_3 __pyx_string_tab[24] #define __pyx_kp_u__2 __pyx_string_tab[25] #define __pyx_kp_u__3 __pyx_string_tab[26] #define __pyx_kp_u__4 __pyx_string_tab[27] #define __pyx_kp_u_add_note __pyx_string_tab[28] #define __pyx_kp_u_adjacent_to_e_u __pyx_string_tab[29] #define __pyx_kp_u_and_vlink __pyx_string_tab[30] #define __pyx_kp_u_by_e_ulink __pyx_string_tab[31] #define __pyx_kp_u_by_e_vlink __pyx_string_tab[32] #define __pyx_kp_u_disable __pyx_string_tab[33] #define __pyx_kp_u_enable __pyx_string_tab[34] #define __pyx_kp_u_failed __pyx_string_tab[35] #define __pyx_kp_u_for_bicomp_root __pyx_string_tab[36] #define __pyx_kp_u_for_bicomp_root_R __pyx_string_tab[37] #define __pyx_kp_u_gc __pyx_string_tab[38] #define __pyx_kp_u_gp_AddEdge_failed_unable_to_add __pyx_string_tab[39] #define __pyx_kp_u_gp_ClearEdgeFlagInverted_failed __pyx_string_tab[40] #define __pyx_kp_u_gp_ClearEdgeMarked_failed_invali __pyx_string_tab[41] #define __pyx_kp_u_gp_ClearEdgeType_failed_invalid __pyx_string_tab[42] #define __pyx_kp_u_gp_ClearEdgeVisited_failed_inval __pyx_string_tab[43] #define __pyx_kp_u_gp_ClearMarked_failed_invalid_ve __pyx_string_tab[44] #define __pyx_kp_u_gp_ClearVisited_failed_invalid_v __pyx_string_tab[45] #define __pyx_kp_u_gp_ComputeLeastAncestors_failed __pyx_string_tab[46] #define __pyx_kp_u_gp_ComputeLowpoints_failed __pyx_string_tab[47] #define __pyx_kp_u_gp_ContractEdge_failed_unable_to __pyx_string_tab[48] #define __pyx_kp_u_gp_CopyGraph_failed __pyx_string_tab[49] #define __pyx_kp_u_gp_DeleteEdge_failed_unable_to_d __pyx_string_tab[50] #define __pyx_kp_u_gp_DepthFirstSearch_failed_unabl __pyx_string_tab[51] #define __pyx_kp_u_gp_DupGraph_failed __pyx_string_tab[52] #define __pyx_kp_u_gp_DynamicAddEdge_failed_unable __pyx_string_tab[53] #define __pyx_kp_u_gp_EnsureEdgeCapacity_failed_to __pyx_string_tab[54] #define __pyx_kp_u_gp_EnsureVertexCapacity_failed_f __pyx_string_tab[55] #define __pyx_kp_u_gp_ExtendWith_DFSUtils_failed_un __pyx_string_tab[56] #define __pyx_kp_u_gp_GetAdjacentEdge_failed_invali __pyx_string_tab[57] #define __pyx_kp_u_gp_GetAdjacentEdge_failed_invali_2 __pyx_string_tab[58] #define __pyx_kp_u_gp_GetBicompRootFromDFSChild_fai __pyx_string_tab[59] #define __pyx_kp_u_gp_GetDFSChildFromBicompRoot_fai __pyx_string_tab[60] #define __pyx_kp_u_gp_GetDirection_failed_invalid_e __pyx_string_tab[61] #define __pyx_kp_u_gp_GetEdgeByLink_failed_invalid __pyx_string_tab[62] #define __pyx_kp_u_gp_GetEdgeByLink_failed_invalid_2 __pyx_string_tab[63] #define __pyx_kp_u_gp_GetEdgeFlagInverted_failed_in __pyx_string_tab[64] #define __pyx_kp_u_gp_GetEdgeMarked_failed_invalid __pyx_string_tab[65] #define __pyx_kp_u_gp_GetEdgeType_failed_invalid_ed __pyx_string_tab[66] #define __pyx_kp_u_gp_GetEdgeVisited_failed_invalid __pyx_string_tab[67] #define __pyx_kp_u_gp_GetFirstEdge_failed_invalid_v __pyx_string_tab[68] #define __pyx_kp_u_gp_GetIndex_failed_invalid_verte __pyx_string_tab[69] #define __pyx_kp_u_gp_GetLastEdge_failed_invalid_ve __pyx_string_tab[70] #define __pyx_kp_u_gp_GetLeastAncestor_failed_inval __pyx_string_tab[71] #define __pyx_kp_u_gp_GetLowpoint_failed_invalid_ve __pyx_string_tab[72] #define __pyx_kp_u_gp_GetMarked_failed_invalid_vert __pyx_string_tab[73] #define __pyx_kp_u_gp_GetNeighbor_failed_invalid_ed __pyx_string_tab[74] #define __pyx_kp_u_gp_GetNextEdge_failed_invalid_ed __pyx_string_tab[75] #define __pyx_kp_u_gp_GetParent_failed_invalid_vert __pyx_string_tab[76] #define __pyx_kp_u_gp_GetPrevEdge_failed_invalid_ed __pyx_string_tab[77] #define __pyx_kp_u_gp_GetTwin_failed_invalid_edge_e __pyx_string_tab[78] #define __pyx_kp_u_gp_GetVertexFromBicompRoot_faile __pyx_string_tab[79] #define __pyx_kp_u_gp_GetVertexFromBicompRoot_faile_2 __pyx_string_tab[80] #define __pyx_kp_u_gp_GetVertexFromBicompRoot_faile_3 __pyx_string_tab[81] #define __pyx_kp_u_gp_GetVisited_failed_invalid_ver __pyx_string_tab[82] #define __pyx_kp_u_gp_HideVertex_failed_unable_to_h __pyx_string_tab[83] #define __pyx_kp_u_gp_IdentifyVertices_failed_unabl __pyx_string_tab[84] #define __pyx_kp_u_gp_InitEdgeFlags_failed_invalid __pyx_string_tab[85] #define __pyx_kp_u_gp_InitFlags_failed_invalid_vert __pyx_string_tab[86] #define __pyx_kp_u_gp_InsertEdge_failed_unable_to_i __pyx_string_tab[87] #define __pyx_kp_u_gp_IsBicompRoot_failed_invalid_c __pyx_string_tab[88] #define __pyx_kp_u_gp_IsDFSTreeRoot_failed_invalid __pyx_string_tab[89] #define __pyx_kp_u_gp_IsNotDFSTreeRoot_failed_inval __pyx_string_tab[90] #define __pyx_kp_u_gp_IsNotSeparatedDFSChild_failed __pyx_string_tab[91] #define __pyx_kp_u_gp_IsSeparatedDFSChild_failed_in __pyx_string_tab[92] #define __pyx_kp_u_gp_New_failed __pyx_string_tab[93] #define __pyx_kp_u_gp_ReadFromString_failed_unable __pyx_string_tab[94] #define __pyx_kp_u_gp_Read_failed_for_infile __pyx_string_tab[95] #define __pyx_kp_u_gp_ResetEdgeType_failed_invalid __pyx_string_tab[96] #define __pyx_kp_u_gp_ResetEdgeType_failed_invalid_2 __pyx_string_tab[97] #define __pyx_kp_u_gp_RestoreVertex_failed_unable_t __pyx_string_tab[98] #define __pyx_kp_u_gp_RestoreVertices_failed_unable __pyx_string_tab[99] #define __pyx_kp_u_gp_SetAdjacentEdge_failed_invali __pyx_string_tab[100] #define __pyx_kp_u_gp_SetAdjacentEdge_failed_invali_2 __pyx_string_tab[101] #define __pyx_kp_u_gp_SetAdjacentEdge_failed_invali_3 __pyx_string_tab[102] #define __pyx_kp_u_gp_SetDirection_failed_invalid_d __pyx_string_tab[103] #define __pyx_kp_u_gp_SetDirection_failed_invalid_e __pyx_string_tab[104] #define __pyx_kp_u_gp_SetEdgeByLink_failed_invalid __pyx_string_tab[105] #define __pyx_kp_u_gp_SetEdgeByLink_failed_invalid_2 __pyx_string_tab[106] #define __pyx_kp_u_gp_SetEdgeByLink_failed_newEdge __pyx_string_tab[107] #define __pyx_kp_u_gp_SetEdgeFlagInverted_failed_in __pyx_string_tab[108] #define __pyx_kp_u_gp_SetEdgeMarked_failed_invalid __pyx_string_tab[109] #define __pyx_kp_u_gp_SetEdgeType_failed_invalid_ed __pyx_string_tab[110] #define __pyx_kp_u_gp_SetEdgeType_failed_invalid_ed_2 __pyx_string_tab[111] #define __pyx_kp_u_gp_SetEdgeVisited_failed_invalid __pyx_string_tab[112] #define __pyx_kp_u_gp_SetFirstEdge_failed_invalid_v __pyx_string_tab[113] #define __pyx_kp_u_gp_SetFirstEdge_failed_newFirstE __pyx_string_tab[114] #define __pyx_kp_u_gp_SetIndex_failed_invalid_value __pyx_string_tab[115] #define __pyx_kp_u_gp_SetIndex_failed_invalid_verte __pyx_string_tab[116] #define __pyx_kp_u_gp_SetLastEdge_failed_invalid_ve __pyx_string_tab[117] #define __pyx_kp_u_gp_SetLastEdge_failed_newLastEdg __pyx_string_tab[118] #define __pyx_kp_u_gp_SetMarked_failed_invalid_vert __pyx_string_tab[119] #define __pyx_kp_u_gp_SetNeighbor_failed_invalid_ed __pyx_string_tab[120] #define __pyx_kp_u_gp_SetNeighbor_failed_invalid_ve __pyx_string_tab[121] #define __pyx_kp_u_gp_SetNextEdge_failed_invalid_ed __pyx_string_tab[122] #define __pyx_kp_u_gp_SetNextEdge_failed_invalid_ed_2 __pyx_string_tab[123] #define __pyx_kp_u_gp_SetPrevEdge_failed_invalid_ed __pyx_string_tab[124] #define __pyx_kp_u_gp_SetPrevEdge_failed_invalid_ed_2 __pyx_string_tab[125] #define __pyx_kp_u_gp_SetVisited_failed_invalid_ver __pyx_string_tab[126] #define __pyx_kp_u_gp_SortVertices_failed __pyx_string_tab[127] #define __pyx_kp_u_gp_WriteToString_failed_failed_t __pyx_string_tab[128] #define __pyx_kp_u_gp_WriteToString_failed_invalid __pyx_string_tab[129] #define __pyx_kp_u_gp_WriteToString_failed_outputSt __pyx_string_tab[130] #define __pyx_kp_u_gp_WriteToString_failed_unable_t __pyx_string_tab[131] #define __pyx_kp_u_gp_Write_failed_invalid_writeMod __pyx_string_tab[132] #define __pyx_kp_u_gp_Write_of_graph_to __pyx_string_tab[133] #define __pyx_kp_u_gp_XorEdgeFlagInverted_failed_in __pyx_string_tab[134] #define __pyx_kp_u_in_u_s_adjacency_list_and_adjac __pyx_string_tab[135] #define __pyx_kp_u_in_v_s_adjacency_list __pyx_string_tab[136] #define __pyx_kp_u_is_not_a_valid_edge __pyx_string_tab[137] #define __pyx_kp_u_is_not_a_valid_edge_index __pyx_string_tab[138] #define __pyx_kp_u_isenabled __pyx_string_tab[139] #define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[140] #define __pyx_kp_u_planarity_full_graph_pyx __pyx_string_tab[141] #define __pyx_kp_u_should_not_be_the_root_of_the_D __pyx_string_tab[142] #define __pyx_kp_u_stringsource __pyx_string_tab[143] #define __pyx_kp_u_to_which_you_wish_to_set_the_in __pyx_string_tab[144] #define __pyx_kp_u_with_u __pyx_string_tab[145] #define __pyx_kp_u_with_ulink __pyx_string_tab[146] #define __pyx_n_u_AT_EDGE_CAPACITY_LIMIT __pyx_string_tab[147] #define __pyx_n_u_EDGEFLAG_DIRECTION_INONLY __pyx_string_tab[148] #define __pyx_n_u_EDGEFLAG_DIRECTION_OUTONLY __pyx_string_tab[149] #define __pyx_n_u_EDGE_TYPE_BACK __pyx_string_tab[150] #define __pyx_n_u_EDGE_TYPE_CHILD __pyx_string_tab[151] #define __pyx_n_u_EDGE_TYPE_FORWARD __pyx_string_tab[152] #define __pyx_n_u_EDGE_TYPE_NOTDEFINED __pyx_string_tab[153] #define __pyx_n_u_EDGE_TYPE_PARENT __pyx_string_tab[154] #define __pyx_n_u_EDGE_TYPE_TREE __pyx_string_tab[155] #define __pyx_n_u_EMBEDFLAGS_DRAWPLANAR __pyx_string_tab[156] #define __pyx_n_u_EMBEDFLAGS_OUTERPLANAR __pyx_string_tab[157] #define __pyx_n_u_EMBEDFLAGS_PLANAR __pyx_string_tab[158] #define __pyx_n_u_EMBEDFLAGS_SEARCHFORK23 __pyx_string_tab[159] #define __pyx_n_u_EMBEDFLAGS_SEARCHFORK33 __pyx_string_tab[160] #define __pyx_n_u_EMBEDFLAGS_SEARCHFORK4 __pyx_string_tab[161] #define __pyx_n_u_FALSE __pyx_string_tab[162] #define __pyx_n_u_Graph __pyx_string_tab[163] #define __pyx_n_u_Graph___reduce_cython __pyx_string_tab[164] #define __pyx_n_u_Graph___setstate_cython __pyx_string_tab[165] #define __pyx_n_u_Graph_gp_AddEdge __pyx_string_tab[166] #define __pyx_n_u_Graph_gp_ClearEdgeFlagInverted __pyx_string_tab[167] #define __pyx_n_u_Graph_gp_ClearEdgeMarked __pyx_string_tab[168] #define __pyx_n_u_Graph_gp_ClearEdgeType __pyx_string_tab[169] #define __pyx_n_u_Graph_gp_ClearEdgeVisited __pyx_string_tab[170] #define __pyx_n_u_Graph_gp_ClearMarked __pyx_string_tab[171] #define __pyx_n_u_Graph_gp_ClearVisited __pyx_string_tab[172] #define __pyx_n_u_Graph_gp_ComputeLeastAncestors __pyx_string_tab[173] #define __pyx_n_u_Graph_gp_ComputeLowpoints __pyx_string_tab[174] #define __pyx_n_u_Graph_gp_ContractEdge __pyx_string_tab[175] #define __pyx_n_u_Graph_gp_CopyAdjacencyLists __pyx_string_tab[176] #define __pyx_n_u_Graph_gp_CopyGraph __pyx_string_tab[177] #define __pyx_n_u_Graph_gp_CreateRandomGraph __pyx_string_tab[178] #define __pyx_n_u_Graph_gp_CreateRandomGraphEx __pyx_string_tab[179] #define __pyx_n_u_Graph_gp_DeleteEdge __pyx_string_tab[180] #define __pyx_n_u_Graph_gp_DepthFirstSearch __pyx_string_tab[181] #define __pyx_n_u_Graph_gp_DrawPlanar_GetEdgeEnd __pyx_string_tab[182] #define __pyx_n_u_Graph_gp_DrawPlanar_GetEdgePosit __pyx_string_tab[183] #define __pyx_n_u_Graph_gp_DrawPlanar_GetEdgeStart __pyx_string_tab[184] #define __pyx_n_u_Graph_gp_DrawPlanar_GetVertexEnd __pyx_string_tab[185] #define __pyx_n_u_Graph_gp_DrawPlanar_GetVertexPos __pyx_string_tab[186] #define __pyx_n_u_Graph_gp_DrawPlanar_GetVertexSta __pyx_string_tab[187] #define __pyx_n_u_Graph_gp_DrawPlanar_RenderToFile __pyx_string_tab[188] #define __pyx_n_u_Graph_gp_DrawPlanar_RenderToStri __pyx_string_tab[189] #define __pyx_n_u_Graph_gp_DupGraph __pyx_string_tab[190] #define __pyx_n_u_Graph_gp_DynamicAddEdge __pyx_string_tab[191] #define __pyx_n_u_Graph_gp_EdgeInUse __pyx_string_tab[192] #define __pyx_n_u_Graph_gp_EdgeNotInUse __pyx_string_tab[193] #define __pyx_n_u_Graph_gp_Embed __pyx_string_tab[194] #define __pyx_n_u_Graph_gp_EnsureEdgeCapacity __pyx_string_tab[195] #define __pyx_n_u_Graph_gp_EnsureVertexCapacity __pyx_string_tab[196] #define __pyx_n_u_Graph_gp_ExtendWith_DFSUtils __pyx_string_tab[197] #define __pyx_n_u_Graph_gp_ExtendWith_DrawPlanar __pyx_string_tab[198] #define __pyx_n_u_Graph_gp_ExtendWith_K23Search __pyx_string_tab[199] #define __pyx_n_u_Graph_gp_ExtendWith_K33Search __pyx_string_tab[200] #define __pyx_n_u_Graph_gp_ExtendWith_K4Search __pyx_string_tab[201] #define __pyx_n_u_Graph_gp_ExtendWith_Outerplanari __pyx_string_tab[202] #define __pyx_n_u_Graph_gp_ExtendWith_Planarity __pyx_string_tab[203] #define __pyx_n_u_Graph_gp_FindDirectedEdge __pyx_string_tab[204] #define __pyx_n_u_Graph_gp_FindEdge __pyx_string_tab[205] #define __pyx_n_u_Graph_gp_GetAdjacentEdge __pyx_string_tab[206] #define __pyx_n_u_Graph_gp_GetBicompRootFromDFSChi __pyx_string_tab[207] #define __pyx_n_u_Graph_gp_GetDFSChildFromBicompRo __pyx_string_tab[208] #define __pyx_n_u_Graph_gp_GetDirection __pyx_string_tab[209] #define __pyx_n_u_Graph_gp_GetEdgeByLink __pyx_string_tab[210] #define __pyx_n_u_Graph_gp_GetEdgeCapacity __pyx_string_tab[211] #define __pyx_n_u_Graph_gp_GetEdgeFlagInverted __pyx_string_tab[212] #define __pyx_n_u_Graph_gp_GetEdgeMarked __pyx_string_tab[213] #define __pyx_n_u_Graph_gp_GetEdgeType __pyx_string_tab[214] #define __pyx_n_u_Graph_gp_GetEdgeVisited __pyx_string_tab[215] #define __pyx_n_u_Graph_gp_GetFirstEdge __pyx_string_tab[216] #define __pyx_n_u_Graph_gp_GetGraphFlags __pyx_string_tab[217] #define __pyx_n_u_Graph_gp_GetIndex __pyx_string_tab[218] #define __pyx_n_u_Graph_gp_GetLastEdge __pyx_string_tab[219] #define __pyx_n_u_Graph_gp_GetLeastAncestor __pyx_string_tab[220] #define __pyx_n_u_Graph_gp_GetLowpoint __pyx_string_tab[221] #define __pyx_n_u_Graph_gp_GetM __pyx_string_tab[222] #define __pyx_n_u_Graph_gp_GetMarked __pyx_string_tab[223] #define __pyx_n_u_Graph_gp_GetN __pyx_string_tab[224] #define __pyx_n_u_Graph_gp_GetNV __pyx_string_tab[225] #define __pyx_n_u_Graph_gp_GetNeighbor __pyx_string_tab[226] #define __pyx_n_u_Graph_gp_GetNextEdge __pyx_string_tab[227] #define __pyx_n_u_Graph_gp_GetParent __pyx_string_tab[228] #define __pyx_n_u_Graph_gp_GetPrevEdge __pyx_string_tab[229] #define __pyx_n_u_Graph_gp_GetTwin __pyx_string_tab[230] #define __pyx_n_u_Graph_gp_GetVertexDegree __pyx_string_tab[231] #define __pyx_n_u_Graph_gp_GetVertexFromBicompRoot __pyx_string_tab[232] #define __pyx_n_u_Graph_gp_GetVertexInDegree __pyx_string_tab[233] #define __pyx_n_u_Graph_gp_GetVertexOutDegree __pyx_string_tab[234] #define __pyx_n_u_Graph_gp_GetVisited __pyx_string_tab[235] #define __pyx_n_u_Graph_gp_HideEdge __pyx_string_tab[236] #define __pyx_n_u_Graph_gp_HideVertex __pyx_string_tab[237] #define __pyx_n_u_Graph_gp_IdentifyVertices __pyx_string_tab[238] #define __pyx_n_u_Graph_gp_InitEdgeFlags __pyx_string_tab[239] #define __pyx_n_u_Graph_gp_InitFlags __pyx_string_tab[240] #define __pyx_n_u_Graph_gp_InsertEdge __pyx_string_tab[241] #define __pyx_n_u_Graph_gp_IsBicompRoot __pyx_string_tab[242] #define __pyx_n_u_Graph_gp_IsDFSTreeRoot __pyx_string_tab[243] #define __pyx_n_u_Graph_gp_IsEdge __pyx_string_tab[244] #define __pyx_n_u_Graph_gp_IsNeighbor __pyx_string_tab[245] #define __pyx_n_u_Graph_gp_IsNeighborDirected __pyx_string_tab[246] #define __pyx_n_u_Graph_gp_IsNotDFSTreeRoot __pyx_string_tab[247] #define __pyx_n_u_Graph_gp_IsNotEdge __pyx_string_tab[248] #define __pyx_n_u_Graph_gp_IsNotSeparatedDFSChild __pyx_string_tab[249] #define __pyx_n_u_Graph_gp_IsNotVertex __pyx_string_tab[250] #define __pyx_n_u_Graph_gp_IsNotVirtualVertex __pyx_string_tab[251] #define __pyx_n_u_Graph_gp_IsSeparatedDFSChild __pyx_string_tab[252] #define __pyx_n_u_Graph_gp_IsVertex __pyx_string_tab[253] #define __pyx_n_u_Graph_gp_IsVirtualVertex __pyx_string_tab[254] #define __pyx_n_u_Graph_gp_LowerBoundEdgeStorage __pyx_string_tab[255] #define __pyx_n_u_Graph_gp_LowerBoundEdges __pyx_string_tab[256] #define __pyx_n_u_Graph_gp_LowerBoundVertexStorage __pyx_string_tab[257] #define __pyx_n_u_Graph_gp_LowerBoundVertices __pyx_string_tab[258] #define __pyx_n_u_Graph_gp_LowerBoundVirtualVertic __pyx_string_tab[259] #define __pyx_n_u_Graph_gp_Read __pyx_string_tab[260] #define __pyx_n_u_Graph_gp_ReadFromString __pyx_string_tab[261] #define __pyx_n_u_Graph_gp_ResetEdgeType __pyx_string_tab[262] #define __pyx_n_u_Graph_gp_ResetGraphStorage __pyx_string_tab[263] #define __pyx_n_u_Graph_gp_RestoreEdge __pyx_string_tab[264] #define __pyx_n_u_Graph_gp_RestoreVertex __pyx_string_tab[265] #define __pyx_n_u_Graph_gp_RestoreVertices __pyx_string_tab[266] #define __pyx_n_u_Graph_gp_SetAdjacentEdge __pyx_string_tab[267] #define __pyx_n_u_Graph_gp_SetDirection __pyx_string_tab[268] #define __pyx_n_u_Graph_gp_SetEdgeByLink __pyx_string_tab[269] #define __pyx_n_u_Graph_gp_SetEdgeFlagInverted __pyx_string_tab[270] #define __pyx_n_u_Graph_gp_SetEdgeMarked __pyx_string_tab[271] #define __pyx_n_u_Graph_gp_SetEdgeType __pyx_string_tab[272] #define __pyx_n_u_Graph_gp_SetEdgeVisited __pyx_string_tab[273] #define __pyx_n_u_Graph_gp_SetFirstEdge __pyx_string_tab[274] #define __pyx_n_u_Graph_gp_SetIndex __pyx_string_tab[275] #define __pyx_n_u_Graph_gp_SetLastEdge __pyx_string_tab[276] #define __pyx_n_u_Graph_gp_SetMarked __pyx_string_tab[277] #define __pyx_n_u_Graph_gp_SetNeighbor __pyx_string_tab[278] #define __pyx_n_u_Graph_gp_SetNextEdge __pyx_string_tab[279] #define __pyx_n_u_Graph_gp_SetPrevEdge __pyx_string_tab[280] #define __pyx_n_u_Graph_gp_SetVisited __pyx_string_tab[281] #define __pyx_n_u_Graph_gp_SortVertices __pyx_string_tab[282] #define __pyx_n_u_Graph_gp_TestEmbedResultIntegrit __pyx_string_tab[283] #define __pyx_n_u_Graph_gp_UpperBoundEdgeStorage __pyx_string_tab[284] #define __pyx_n_u_Graph_gp_UpperBoundEdges __pyx_string_tab[285] #define __pyx_n_u_Graph_gp_UpperBoundVertexStorage __pyx_string_tab[286] #define __pyx_n_u_Graph_gp_UpperBoundVertices __pyx_string_tab[287] #define __pyx_n_u_Graph_gp_UpperBoundVirtualVertic __pyx_string_tab[288] #define __pyx_n_u_Graph_gp_VirtualVertexInUse __pyx_string_tab[289] #define __pyx_n_u_Graph_gp_VirtualVertexNotInUse __pyx_string_tab[290] #define __pyx_n_u_Graph_gp_Write __pyx_string_tab[291] #define __pyx_n_u_Graph_gp_WriteToString __pyx_string_tab[292] #define __pyx_n_u_Graph_gp_XorEdgeFlagInverted __pyx_string_tab[293] #define __pyx_n_u_N __pyx_string_tab[294] #define __pyx_n_u_NIL __pyx_string_tab[295] #define __pyx_n_u_NONEMBEDDABLE __pyx_string_tab[296] #define __pyx_n_u_NOTOK __pyx_string_tab[297] #define __pyx_n_u_None __pyx_string_tab[298] #define __pyx_n_u_OK __pyx_string_tab[299] #define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[300] #define __pyx_n_u_R __pyx_string_tab[301] #define __pyx_n_u_TRUE __pyx_string_tab[302] #define __pyx_n_u_WRITE_ADJLIST __pyx_string_tab[303] #define __pyx_n_u_WRITE_ADJMATRIX __pyx_string_tab[304] #define __pyx_n_u_WRITE_G6 __pyx_string_tab[305] #define __pyx_n_u_asyncio_coroutines __pyx_string_tab[306] #define __pyx_n_u_bicomp_root __pyx_string_tab[307] #define __pyx_n_u_c __pyx_string_tab[308] #define __pyx_n_u_check_result __pyx_string_tab[309] #define __pyx_n_u_cline_in_traceback __pyx_string_tab[310] #define __pyx_n_u_direction __pyx_string_tab[311] #define __pyx_n_u_e __pyx_string_tab[312] #define __pyx_n_u_eBefore __pyx_string_tab[313] #define __pyx_n_u_e_u __pyx_string_tab[314] #define __pyx_n_u_e_ulink __pyx_string_tab[315] #define __pyx_n_u_e_v __pyx_string_tab[316] #define __pyx_n_u_e_vlink __pyx_string_tab[317] #define __pyx_n_u_embedFlags __pyx_string_tab[318] #define __pyx_n_u_embedResult __pyx_string_tab[319] #define __pyx_n_u_embed_result __pyx_string_tab[320] #define __pyx_n_u_encoded __pyx_string_tab[321] #define __pyx_n_u_encodedFileName __pyx_string_tab[322] #define __pyx_n_u_encodedInputString __pyx_string_tab[323] #define __pyx_n_u_fileName __pyx_string_tab[324] #define __pyx_n_u_func __pyx_string_tab[325] #define __pyx_n_u_getstate __pyx_string_tab[326] #define __pyx_n_u_gp_AddEdge __pyx_string_tab[327] #define __pyx_n_u_gp_ClearEdgeFlagInverted __pyx_string_tab[328] #define __pyx_n_u_gp_ClearEdgeMarked __pyx_string_tab[329] #define __pyx_n_u_gp_ClearEdgeType __pyx_string_tab[330] #define __pyx_n_u_gp_ClearEdgeVisited __pyx_string_tab[331] #define __pyx_n_u_gp_ClearMarked __pyx_string_tab[332] #define __pyx_n_u_gp_ClearVisited __pyx_string_tab[333] #define __pyx_n_u_gp_ComputeLeastAncestors __pyx_string_tab[334] #define __pyx_n_u_gp_ComputeLowpoints __pyx_string_tab[335] #define __pyx_n_u_gp_ContractEdge __pyx_string_tab[336] #define __pyx_n_u_gp_CopyAdjacencyLists __pyx_string_tab[337] #define __pyx_n_u_gp_CopyGraph __pyx_string_tab[338] #define __pyx_n_u_gp_CreateRandomGraph __pyx_string_tab[339] #define __pyx_n_u_gp_CreateRandomGraphEx __pyx_string_tab[340] #define __pyx_n_u_gp_DeleteEdge __pyx_string_tab[341] #define __pyx_n_u_gp_DepthFirstSearch __pyx_string_tab[342] #define __pyx_n_u_gp_DrawPlanar_GetEdgeEnd __pyx_string_tab[343] #define __pyx_n_u_gp_DrawPlanar_GetEdgePosition __pyx_string_tab[344] #define __pyx_n_u_gp_DrawPlanar_GetEdgeStart __pyx_string_tab[345] #define __pyx_n_u_gp_DrawPlanar_GetVertexEnd __pyx_string_tab[346] #define __pyx_n_u_gp_DrawPlanar_GetVertexPosition __pyx_string_tab[347] #define __pyx_n_u_gp_DrawPlanar_GetVertexStart __pyx_string_tab[348] #define __pyx_n_u_gp_DrawPlanar_RenderToFile __pyx_string_tab[349] #define __pyx_n_u_gp_DrawPlanar_RenderToString __pyx_string_tab[350] #define __pyx_n_u_gp_DupGraph __pyx_string_tab[351] #define __pyx_n_u_gp_DynamicAddEdge __pyx_string_tab[352] #define __pyx_n_u_gp_EdgeInUse __pyx_string_tab[353] #define __pyx_n_u_gp_EdgeNotInUse __pyx_string_tab[354] #define __pyx_n_u_gp_Embed __pyx_string_tab[355] #define __pyx_n_u_gp_EnsureEdgeCapacity __pyx_string_tab[356] #define __pyx_n_u_gp_EnsureVertexCapacity __pyx_string_tab[357] #define __pyx_n_u_gp_ExtendWith_DFSUtils __pyx_string_tab[358] #define __pyx_n_u_gp_ExtendWith_DrawPlanar __pyx_string_tab[359] #define __pyx_n_u_gp_ExtendWith_K23Search __pyx_string_tab[360] #define __pyx_n_u_gp_ExtendWith_K33Search __pyx_string_tab[361] #define __pyx_n_u_gp_ExtendWith_K4Search __pyx_string_tab[362] #define __pyx_n_u_gp_ExtendWith_Outerplanarity __pyx_string_tab[363] #define __pyx_n_u_gp_ExtendWith_Planarity __pyx_string_tab[364] #define __pyx_n_u_gp_FindDirectedEdge __pyx_string_tab[365] #define __pyx_n_u_gp_FindEdge __pyx_string_tab[366] #define __pyx_n_u_gp_GetAdjacentEdge __pyx_string_tab[367] #define __pyx_n_u_gp_GetBicompRootFromDFSChild __pyx_string_tab[368] #define __pyx_n_u_gp_GetDFSChildFromBicompRoot __pyx_string_tab[369] #define __pyx_n_u_gp_GetDirection __pyx_string_tab[370] #define __pyx_n_u_gp_GetEdgeByLink __pyx_string_tab[371] #define __pyx_n_u_gp_GetEdgeCapacity __pyx_string_tab[372] #define __pyx_n_u_gp_GetEdgeFlagInverted __pyx_string_tab[373] #define __pyx_n_u_gp_GetEdgeMarked __pyx_string_tab[374] #define __pyx_n_u_gp_GetEdgeType __pyx_string_tab[375] #define __pyx_n_u_gp_GetEdgeVisited __pyx_string_tab[376] #define __pyx_n_u_gp_GetFirstEdge __pyx_string_tab[377] #define __pyx_n_u_gp_GetGraphFlags __pyx_string_tab[378] #define __pyx_n_u_gp_GetIndex __pyx_string_tab[379] #define __pyx_n_u_gp_GetLastEdge __pyx_string_tab[380] #define __pyx_n_u_gp_GetLeastAncestor __pyx_string_tab[381] #define __pyx_n_u_gp_GetLowpoint __pyx_string_tab[382] #define __pyx_n_u_gp_GetM __pyx_string_tab[383] #define __pyx_n_u_gp_GetMarked __pyx_string_tab[384] #define __pyx_n_u_gp_GetN __pyx_string_tab[385] #define __pyx_n_u_gp_GetNV __pyx_string_tab[386] #define __pyx_n_u_gp_GetNeighbor __pyx_string_tab[387] #define __pyx_n_u_gp_GetNextEdge __pyx_string_tab[388] #define __pyx_n_u_gp_GetParent __pyx_string_tab[389] #define __pyx_n_u_gp_GetPrevEdge __pyx_string_tab[390] #define __pyx_n_u_gp_GetTwin __pyx_string_tab[391] #define __pyx_n_u_gp_GetVertexDegree __pyx_string_tab[392] #define __pyx_n_u_gp_GetVertexFromBicompRoot __pyx_string_tab[393] #define __pyx_n_u_gp_GetVertexInDegree __pyx_string_tab[394] #define __pyx_n_u_gp_GetVertexOutDegree __pyx_string_tab[395] #define __pyx_n_u_gp_GetVisited __pyx_string_tab[396] #define __pyx_n_u_gp_HideEdge __pyx_string_tab[397] #define __pyx_n_u_gp_HideVertex __pyx_string_tab[398] #define __pyx_n_u_gp_IdentifyVertices __pyx_string_tab[399] #define __pyx_n_u_gp_InitEdgeFlags __pyx_string_tab[400] #define __pyx_n_u_gp_InitFlags __pyx_string_tab[401] #define __pyx_n_u_gp_InsertEdge __pyx_string_tab[402] #define __pyx_n_u_gp_IsBicompRoot __pyx_string_tab[403] #define __pyx_n_u_gp_IsDFSTreeRoot __pyx_string_tab[404] #define __pyx_n_u_gp_IsEdge __pyx_string_tab[405] #define __pyx_n_u_gp_IsNeighbor __pyx_string_tab[406] #define __pyx_n_u_gp_IsNeighborDirected __pyx_string_tab[407] #define __pyx_n_u_gp_IsNotDFSTreeRoot __pyx_string_tab[408] #define __pyx_n_u_gp_IsNotEdge __pyx_string_tab[409] #define __pyx_n_u_gp_IsNotSeparatedDFSChild __pyx_string_tab[410] #define __pyx_n_u_gp_IsNotVertex __pyx_string_tab[411] #define __pyx_n_u_gp_IsNotVirtualVertex __pyx_string_tab[412] #define __pyx_n_u_gp_IsSeparatedDFSChild __pyx_string_tab[413] #define __pyx_n_u_gp_IsVertex __pyx_string_tab[414] #define __pyx_n_u_gp_IsVirtualVertex __pyx_string_tab[415] #define __pyx_n_u_gp_LowerBoundEdgeStorage __pyx_string_tab[416] #define __pyx_n_u_gp_LowerBoundEdges __pyx_string_tab[417] #define __pyx_n_u_gp_LowerBoundVertexStorage __pyx_string_tab[418] #define __pyx_n_u_gp_LowerBoundVertices __pyx_string_tab[419] #define __pyx_n_u_gp_LowerBoundVirtualVertices __pyx_string_tab[420] #define __pyx_n_u_gp_Read __pyx_string_tab[421] #define __pyx_n_u_gp_ReadFromString __pyx_string_tab[422] #define __pyx_n_u_gp_ResetEdgeType __pyx_string_tab[423] #define __pyx_n_u_gp_ResetGraphStorage __pyx_string_tab[424] #define __pyx_n_u_gp_RestoreEdge __pyx_string_tab[425] #define __pyx_n_u_gp_RestoreVertex __pyx_string_tab[426] #define __pyx_n_u_gp_RestoreVertices __pyx_string_tab[427] #define __pyx_n_u_gp_SetAdjacentEdge __pyx_string_tab[428] #define __pyx_n_u_gp_SetDirection __pyx_string_tab[429] #define __pyx_n_u_gp_SetEdgeByLink __pyx_string_tab[430] #define __pyx_n_u_gp_SetEdgeFlagInverted __pyx_string_tab[431] #define __pyx_n_u_gp_SetEdgeMarked __pyx_string_tab[432] #define __pyx_n_u_gp_SetEdgeType __pyx_string_tab[433] #define __pyx_n_u_gp_SetEdgeVisited __pyx_string_tab[434] #define __pyx_n_u_gp_SetFirstEdge __pyx_string_tab[435] #define __pyx_n_u_gp_SetIndex __pyx_string_tab[436] #define __pyx_n_u_gp_SetLastEdge __pyx_string_tab[437] #define __pyx_n_u_gp_SetMarked __pyx_string_tab[438] #define __pyx_n_u_gp_SetNeighbor __pyx_string_tab[439] #define __pyx_n_u_gp_SetNextEdge __pyx_string_tab[440] #define __pyx_n_u_gp_SetPrevEdge __pyx_string_tab[441] #define __pyx_n_u_gp_SetVisited __pyx_string_tab[442] #define __pyx_n_u_gp_SortVertices __pyx_string_tab[443] #define __pyx_n_u_gp_TestEmbedResultIntegrity __pyx_string_tab[444] #define __pyx_n_u_gp_UpperBoundEdgeStorage __pyx_string_tab[445] #define __pyx_n_u_gp_UpperBoundEdges __pyx_string_tab[446] #define __pyx_n_u_gp_UpperBoundVertexStorage __pyx_string_tab[447] #define __pyx_n_u_gp_UpperBoundVertices __pyx_string_tab[448] #define __pyx_n_u_gp_UpperBoundVirtualVertices __pyx_string_tab[449] #define __pyx_n_u_gp_UpperBoundlVertices __pyx_string_tab[450] #define __pyx_n_u_gp_VirtualVertexInUse __pyx_string_tab[451] #define __pyx_n_u_gp_VirtualVertexNotInUse __pyx_string_tab[452] #define __pyx_n_u_gp_Write __pyx_string_tab[453] #define __pyx_n_u_gp_WriteToString __pyx_string_tab[454] #define __pyx_n_u_gp_XorEdgeFlagInverted __pyx_string_tab[455] #define __pyx_n_u_graphLib __pyx_string_tab[456] #define __pyx_n_u_inputStr __pyx_string_tab[457] #define __pyx_n_u_int __pyx_string_tab[458] #define __pyx_n_u_is_coroutine __pyx_string_tab[459] #define __pyx_n_u_items __pyx_string_tab[460] #define __pyx_n_u_main __pyx_string_tab[461] #define __pyx_n_u_module __pyx_string_tab[462] #define __pyx_n_u_name __pyx_string_tab[463] #define __pyx_n_u_newEdge __pyx_string_tab[464] #define __pyx_n_u_newFirstEdge __pyx_string_tab[465] #define __pyx_n_u_newLastEdge __pyx_string_tab[466] #define __pyx_n_u_newNextEdge __pyx_string_tab[467] #define __pyx_n_u_newPrevEdge __pyx_string_tab[468] #define __pyx_n_u_new_graph __pyx_string_tab[469] #define __pyx_n_u_numEdges __pyx_string_tab[470] #define __pyx_n_u_origGraph __pyx_string_tab[471] #define __pyx_n_u_outputString __pyx_string_tab[472] #define __pyx_n_u_output_bytes __pyx_string_tab[473] #define __pyx_n_u_planarity_full __pyx_string_tab[474] #define __pyx_n_u_planarity_full_graph __pyx_string_tab[475] #define __pyx_n_u_pop __pyx_string_tab[476] #define __pyx_n_u_pyx_state __pyx_string_tab[477] #define __pyx_n_u_qualname __pyx_string_tab[478] #define __pyx_n_u_reduce __pyx_string_tab[479] #define __pyx_n_u_reduce_cython __pyx_string_tab[480] #define __pyx_n_u_reduce_ex __pyx_string_tab[481] #define __pyx_n_u_renditionString __pyx_string_tab[482] #define __pyx_n_u_rendition_bytes __pyx_string_tab[483] #define __pyx_n_u_requiredEdgeCapacity __pyx_string_tab[484] #define __pyx_n_u_result __pyx_string_tab[485] #define __pyx_n_u_return __pyx_string_tab[486] #define __pyx_n_u_self __pyx_string_tab[487] #define __pyx_n_u_set_name __pyx_string_tab[488] #define __pyx_n_u_setdefault __pyx_string_tab[489] #define __pyx_n_u_setstate __pyx_string_tab[490] #define __pyx_n_u_setstate_cython __pyx_string_tab[491] #define __pyx_n_u_srcGraph __pyx_string_tab[492] #define __pyx_n_u_str __pyx_string_tab[493] #define __pyx_n_u_string_conversion_error __pyx_string_tab[494] #define __pyx_n_u_test __pyx_string_tab[495] #define __pyx_n_u_theChild __pyx_string_tab[496] #define __pyx_n_u_theFileName __pyx_string_tab[497] #define __pyx_n_u_theGraph_dup __pyx_string_tab[498] #define __pyx_n_u_theIndex __pyx_string_tab[499] #define __pyx_n_u_theLink __pyx_string_tab[500] #define __pyx_n_u_type __pyx_string_tab[501] #define __pyx_n_u_u __pyx_string_tab[502] #define __pyx_n_u_ulink __pyx_string_tab[503] #define __pyx_n_u_v __pyx_string_tab[504] #define __pyx_n_u_values __pyx_string_tab[505] #define __pyx_n_u_vertex __pyx_string_tab[506] #define __pyx_n_u_virtualVertex __pyx_string_tab[507] #define __pyx_n_u_vlink __pyx_string_tab[508] #define __pyx_n_u_writeMode __pyx_string_tab[509] #define __pyx_kp_b_graphP_graphP_graphP_void_int_gr __pyx_string_tab[510] #define __pyx_kp_b_iso88591_0_1_l_7_Q_a_C1A __pyx_string_tab[511] #define __pyx_kp_b_iso88591_0_Q __pyx_string_tab[512] #define __pyx_kp_b_iso88591_0_Q_2 __pyx_string_tab[513] #define __pyx_kp_b_iso88591_0_Q_7_Q_a __pyx_string_tab[514] #define __pyx_kp_b_iso88591_1D_Cq_a __pyx_string_tab[515] #define __pyx_kp_b_iso88591_1O1_4_1_1_q __pyx_string_tab[516] #define __pyx_kp_b_iso88591_1_1D_Cq __pyx_string_tab[517] #define __pyx_kp_b_iso88591_1_2_4_1_7_A_a_q __pyx_string_tab[518] #define __pyx_kp_b_iso88591_1_4_1 __pyx_string_tab[519] #define __pyx_kp_b_iso88591_1_4t_A_1D_A __pyx_string_tab[520] #define __pyx_kp_b_iso88591_1_4t_A_8_4_1 __pyx_string_tab[521] #define __pyx_kp_b_iso88591_1_4t_A_AQ_5_NN___A_q_q_L_1 __pyx_string_tab[522] #define __pyx_kp_b_iso88591_1_4t_A_Faq_l __pyx_string_tab[523] #define __pyx_kp_b_iso88591_1_XWAQ_a_Qd_6J_Q_a __pyx_string_tab[524] #define __pyx_kp_b_iso88591_1_X__Q_A_A_AT_QnKsRS_Cq_AQ_q_a __pyx_string_tab[525] #define __pyx_kp_b_iso88591_1_a_7_Q_a __pyx_string_tab[526] #define __pyx_kp_b_iso88591_1_a_7_Q_a_2 __pyx_string_tab[527] #define __pyx_kp_b_iso88591_1_q_L_7_Q_a __pyx_string_tab[528] #define __pyx_kp_b_iso88591_1_s_34q_r_2_a_q_L_1_q __pyx_string_tab[529] #define __pyx_kp_b_iso88591_2_4q_7_Q_a_q __pyx_string_tab[530] #define __pyx_kp_b_iso88591_2_5_L_Ct_aq_A_1A_5_L_3d2EQa_A_A __pyx_string_tab[531] #define __pyx_kp_b_iso88591_31_4AT_Q_7_A_a_q __pyx_string_tab[532] #define __pyx_kp_b_iso88591_31_4t_A_aq_5_NN___A_A_l_Q __pyx_string_tab[533] #define __pyx_kp_b_iso88591_31_4t_aq_A_aq_D_Qa_4t_q_a_1_d_q __pyx_string_tab[534] #define __pyx_kp_b_iso88591_3d_34q_2T_2_a_4_1_1_q __pyx_string_tab[535] #define __pyx_kp_b_iso88591_4_3a_a __pyx_string_tab[536] #define __pyx_kp_b_iso88591_4_AQ_1_q __pyx_string_tab[537] #define __pyx_kp_b_iso88591_4q_7_Q_a __pyx_string_tab[538] #define __pyx_kp_b_iso88591_4t_A_Qa_q_L __pyx_string_tab[539] #define __pyx_kp_b_iso88591_4t_A_aq __pyx_string_tab[540] #define __pyx_kp_b_iso88591_4t_A_aq_l __pyx_string_tab[541] #define __pyx_kp_b_iso88591_4t_A_q_4_1 __pyx_string_tab[542] #define __pyx_kp_b_iso88591_4t_A_q_l __pyx_string_tab[543] #define __pyx_kp_b_iso88591_4t_q_4t4_B_1_A_B_1_q_L __pyx_string_tab[544] #define __pyx_kp_b_iso88591_4t_q_4t4_B_1_A_EQa_4_A_3d2B_1_A __pyx_string_tab[545] #define __pyx_kp_b_iso88591_4t_q_A_4_at_1_q __pyx_string_tab[546] #define __pyx_kp_b_iso88591_5Q_4t_aq_A_aq_4AT_Q __pyx_string_tab[547] #define __pyx_kp_b_iso88591_5Q_4t_q_A_LAQ_4AT_Q __pyx_string_tab[548] #define __pyx_kp_b_iso88591_5Q_6at_q_7_A_a_q __pyx_string_tab[549] #define __pyx_kp_b_iso88591_5_L_Ct_aq_A_1_1D_A_1_q __pyx_string_tab[550] #define __pyx_kp_b_iso88591_5_L_Ct_aq_A_q __pyx_string_tab[551] #define __pyx_kp_b_iso88591_6a_0_7_Q_a_A __pyx_string_tab[552] #define __pyx_kp_b_iso88591_6a_4t_q_4t4_B_1_A_Faq_83b_HCq_A __pyx_string_tab[553] #define __pyx_kp_b_iso88591_6a_4t_q_A_1_4_1_1_q __pyx_string_tab[554] #define __pyx_kp_b_iso88591_6a_7q_L_7_A_a_q __pyx_string_tab[555] #define __pyx_kp_b_iso88591_7q_4t_A_Qa_XS_1_A_A __pyx_string_tab[556] #define __pyx_kp_b_iso88591_7q_X__Q_A_9_XWAQ_1_4_3DA_7_Q_a __pyx_string_tab[557] #define __pyx_kp_b_iso88591_7q_q_L_7_Q_a __pyx_string_tab[558] #define __pyx_kp_b_iso88591_8_4t_A_83b_HCq_A_1_4_3a __pyx_string_tab[559] #define __pyx_kp_b_iso88591_8_4t_A_AQ_s_d_d_q_A_1_q_L_1 __pyx_string_tab[560] #define __pyx_kp_b_iso88591_8_4t_q_A_DAQ_4_A_T1A_A_9_q_L_1 __pyx_string_tab[561] #define __pyx_kp_b_iso88591_8_9_l_7_A_a_q __pyx_string_tab[562] #define __pyx_kp_b_iso88591_9_4t_q_A_1_Qd_a_1_q __pyx_string_tab[563] #define __pyx_kp_b_iso88591_AT_S_a __pyx_string_tab[564] #define __pyx_kp_b_iso88591_A_2_4q __pyx_string_tab[565] #define __pyx_kp_b_iso88591_A_4q __pyx_string_tab[566] #define __pyx_kp_b_iso88591_A_4t_A_A_AT_Q __pyx_string_tab[567] #define __pyx_kp_b_iso88591_A_4t_q_A_C1A_1D_A __pyx_string_tab[568] #define __pyx_kp_b_iso88591_A_4t_q_A_C1A_4t_AQ_1_q __pyx_string_tab[569] #define __pyx_kp_b_iso88591_A_5_L_Ct_aq_A_1A_1D_A __pyx_string_tab[570] #define __pyx_kp_b_iso88591_A_6_Bd_1_A_1_6_Bd_1_A_1_AT_S_s __pyx_string_tab[571] #define __pyx_kp_b_iso88591_A_AT_7_Q_a __pyx_string_tab[572] #define __pyx_kp_b_iso88591_A_AT_Q __pyx_string_tab[573] #define __pyx_kp_b_iso88591_A_q_L_7_Q_a_1 __pyx_string_tab[574] #define __pyx_kp_b_iso88591_A_s_D_r_4q_1_q __pyx_string_tab[575] #define __pyx_kp_b_iso88591_C1_4t_q_A_Faq_4_AYc_Qa_A_7q_83b __pyx_string_tab[576] #define __pyx_kp_b_iso88591_EQ_4t_A_83b_HCq_A_1_83d_d_m1A_A __pyx_string_tab[577] #define __pyx_kp_b_iso88591_Gq_1D_Cs __pyx_string_tab[578] #define __pyx_kp_b_iso88591_Gq_6_Bd_1_A_1_6_Bd_1_A_1_1D_Cwc __pyx_string_tab[579] #define __pyx_kp_b_iso88591_I_Qd_c_A __pyx_string_tab[580] #define __pyx_kp_b_iso88591_Oq_1_L_Q_3d_s_aq_q __pyx_string_tab[581] #define __pyx_kp_b_iso88591_Q __pyx_string_tab[582] #define __pyx_kp_b_iso88591_Q_1O1_Qd_a_1_q __pyx_string_tab[583] #define __pyx_kp_b_iso88591_Q_2 __pyx_string_tab[584] #define __pyx_kp_b_iso88591_Q_2T_2_a_3d_34q_Qd_a_1_q __pyx_string_tab[585] #define __pyx_kp_b_iso88591_Q_4t_q_A_AQ_AT_Q __pyx_string_tab[586] #define __pyx_kp_b_iso88591_Q_4z_at_q_1_q __pyx_string_tab[587] #define __pyx_kp_b_iso88591_Q_5L_Q_1_Qa_uA_1_a_q __pyx_string_tab[588] #define __pyx_kp_b_iso88591_Q_5_L_Ct_aq_A_AQ_AT_Q __pyx_string_tab[589] #define __pyx_kp_b_iso88591_Q_5_L_Ct_aq_A_AQ_Qd_a __pyx_string_tab[590] #define __pyx_kp_b_iso88591_Q_AT_Q __pyx_string_tab[591] #define __pyx_kp_b_iso88591_Q_Qd_c __pyx_string_tab[592] #define __pyx_kp_b_iso88591_Q_q_1_4AT_Q_7_Q_a_6aq __pyx_string_tab[593] #define __pyx_kp_b_iso88591_Q_q_L_1_a __pyx_string_tab[594] #define __pyx_kp_b_iso88591_Q_q_L_1_a_2 __pyx_string_tab[595] #define __pyx_kp_b_iso88591_Qd_c_A_7_Q_a_Gq_A __pyx_string_tab[596] #define __pyx_kp_b_iso88591_YYZ_q_L_5_EQR_7_S_G3a_a_1D_q0B __pyx_string_tab[597] #define __pyx_kp_b_iso88591_a_4AT __pyx_string_tab[598] #define __pyx_kp_b_iso88591_a_4t_A_AQ_5_L_Ct_aq_A_aq_q_L_1 __pyx_string_tab[599] #define __pyx_kp_b_iso88591_a_5_L_Ct_aq_A_Qa_Qd_a __pyx_string_tab[600] #define __pyx_kp_b_iso88591_a_5_L_Ct_aq_A_Qa_at_q __pyx_string_tab[601] #define __pyx_kp_b_iso88591_a_6at1_7_Q_a __pyx_string_tab[602] #define __pyx_kp_b_iso88591_a_Q_6at_q_7_Q_aq_AQ_A_a __pyx_string_tab[603] #define __pyx_kp_b_iso88591_a_Qd __pyx_string_tab[604] #define __pyx_kp_b_iso88591_a_Qd_a __pyx_string_tab[605] #define __pyx_kp_b_iso88591_a_at1_7_Q_aq __pyx_string_tab[606] #define __pyx_kp_b_iso88591_a_at_xq_7_Q_aq __pyx_string_tab[607] #define __pyx_kp_b_iso88591_a_q_L_7_Q_a_DAQ __pyx_string_tab[608] #define __pyx_kp_b_iso88591_a_r_2_a_s_34q_4_1_1_q __pyx_string_tab[609] #define __pyx_kp_b_iso88591_l_7_Q_a_H __pyx_string_tab[610] #define __pyx_kp_b_iso88591_q_4t_A_AQ_at_q __pyx_string_tab[611] #define __pyx_kp_b_iso88591_q_4t_A_AQ_at_q_2 __pyx_string_tab[612] #define __pyx_kp_b_iso88591_q_4t_A_B_1_at_q __pyx_string_tab[613] #define __pyx_kp_b_iso88591_q_4t_A_DAQ_at_q __pyx_string_tab[614] #define __pyx_kp_b_iso88591_q_4t_A_DAQ_q_L __pyx_string_tab[615] #define __pyx_kp_b_iso88591_q_4t_q_4t4_B_1_A_DAQ_at_q __pyx_string_tab[616] #define __pyx_kp_b_iso88591_q_4t_q_A_aq_at_q __pyx_string_tab[617] #define __pyx_kp_b_iso88591_q_5_L_Ct_aq_A_aq_q_L __pyx_string_tab[618] #define __pyx_kp_b_iso88591_q_Qd __pyx_string_tab[619] #define __pyx_kp_b_iso88591_q_XWAQ_1_l_7_Q_a_q __pyx_string_tab[620] #define __pyx_kp_b_iso88591_q_q_L __pyx_string_tab[621] #define __pyx_kp_b_iso88591_q_r_4q_s_T_1D_A_1_q __pyx_string_tab[622] #define __pyx_kp_b_iso88591_xq_A __pyx_string_tab[623] #define __pyx_kp_b_iso88591_y_3d_s_aq_q __pyx_string_tab[624] #define __pyx_kp_b_iso88591_y_Q __pyx_string_tab[625] /* #### Code section: module_state_clear ### */ #if CYTHON_USE_MODULE_STATE static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m); if (!clear_module_state) return 0; Py_CLEAR(clear_module_state->__pyx_d); Py_CLEAR(clear_module_state->__pyx_b); Py_CLEAR(clear_module_state->__pyx_cython_runtime); Py_CLEAR(clear_module_state->__pyx_empty_tuple); Py_CLEAR(clear_module_state->__pyx_empty_bytes); Py_CLEAR(clear_module_state->__pyx_empty_unicode); #if CYTHON_PEP489_MULTI_PHASE_INIT __Pyx_State_RemoveModule(NULL); #endif Py_CLEAR(clear_module_state->__pyx_ptype_9planarity_4full_5graph_Graph); Py_CLEAR(clear_module_state->__pyx_type_9planarity_4full_5graph_Graph); for (int i=0; i<130; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } for (int i=0; i<626; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } /* #### Code section: module_state_clear_contents ### */ /* CommonTypesMetaclass.module_state_clear */ Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType); /* CythonFunctionShared.module_state_clear */ Py_CLEAR(clear_module_state->__pyx_CyFunctionType); /* #### Code section: module_state_clear_end ### */ return 0; } #endif /* #### Code section: module_state_traverse ### */ #if CYTHON_USE_MODULE_STATE static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m); if (!traverse_module_state) return 0; Py_VISIT(traverse_module_state->__pyx_d); Py_VISIT(traverse_module_state->__pyx_b); Py_VISIT(traverse_module_state->__pyx_cython_runtime); __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple); __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes); __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode); Py_VISIT(traverse_module_state->__pyx_ptype_9planarity_4full_5graph_Graph); Py_VISIT(traverse_module_state->__pyx_type_9planarity_4full_5graph_Graph); for (int i=0; i<130; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } for (int i=0; i<626; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } /* #### Code section: module_state_traverse_contents ### */ /* CommonTypesMetaclass.module_state_traverse */ Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType); /* CythonFunctionShared.module_state_traverse */ Py_VISIT(traverse_module_state->__pyx_CyFunctionType); /* #### Code section: module_state_traverse_end ### */ return 0; } #endif /* #### Code section: module_code ### */ /* "planarity/full/graph.pyx":50 * * cdef class Graph: * def __cinit__(self): # <<<<<<<<<<<<<< * """Allocates the underlying graph structure with gp_New(). * */ /* Python wrapper */ static int __pyx_pw_9planarity_4full_5graph_5Graph_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_9planarity_4full_5graph_5Graph_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED Py_ssize_t __pyx_nargs; CYTHON_UNUSED PyObject *const *__pyx_kwvalues; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1; #endif __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, __pyx_nargs); return -1; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_VARARGS(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return -1; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__cinit__", __pyx_kwds); return -1;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph___cinit__(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_9planarity_4full_5graph_5Graph___cinit__(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations graphP __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); /* "planarity/full/graph.pyx":57 * """ * global global_id_count * self._theGraph = graphLib.gp_New() # <<<<<<<<<<<<<< * if self._theGraph == NULL: * raise MemoryError("gp_New() failed.") */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_New(); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 57, __pyx_L1_error) __pyx_v_self->_theGraph = __pyx_t_1; /* "planarity/full/graph.pyx":58 * global global_id_count * self._theGraph = graphLib.gp_New() * if self._theGraph == NULL: # <<<<<<<<<<<<<< * raise MemoryError("gp_New() failed.") * */ __pyx_t_2 = (__pyx_v_self->_theGraph == NULL); if (unlikely(__pyx_t_2)) { /* "planarity/full/graph.pyx":59 * self._theGraph = graphLib.gp_New() * if self._theGraph == NULL: * raise MemoryError("gp_New() failed.") # <<<<<<<<<<<<<< * * def __dealloc__(self): */ __pyx_t_4 = NULL; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_gp_New_failed}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 59, __pyx_L1_error) /* "planarity/full/graph.pyx":58 * global global_id_count * self._theGraph = graphLib.gp_New() * if self._theGraph == NULL: # <<<<<<<<<<<<<< * raise MemoryError("gp_New() failed.") * */ } /* "planarity/full/graph.pyx":50 * * cdef class Graph: * def __cinit__(self): # <<<<<<<<<<<<<< * """Allocates the underlying graph structure with gp_New(). * */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":61 * raise MemoryError("gp_New() failed.") * * def __dealloc__(self): # <<<<<<<<<<<<<< * """Frees the underlying graph structure with gp_Free().""" * if self._theGraph != NULL: */ /* Python wrapper */ static void __pyx_pw_9planarity_4full_5graph_5Graph_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_9planarity_4full_5graph_5Graph_3__dealloc__(PyObject *__pyx_v_self) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_pf_9planarity_4full_5graph_5Graph_2__dealloc__(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_9planarity_4full_5graph_5Graph_2__dealloc__(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { int __pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* "planarity/full/graph.pyx":63 * def __dealloc__(self): * """Frees the underlying graph structure with gp_Free().""" * if self._theGraph != NULL: # <<<<<<<<<<<<<< * graphLib.gp_Free(&self._theGraph) * */ __pyx_t_1 = (__pyx_v_self->_theGraph != NULL); if (__pyx_t_1) { /* "planarity/full/graph.pyx":64 * """Frees the underlying graph structure with gp_Free().""" * if self._theGraph != NULL: * graphLib.gp_Free(&self._theGraph) # <<<<<<<<<<<<<< * * def gp_EnsureVertexCapacity(self, int N) -> None: */ __pyx_f_9planarity_4full_8graphLib_gp_Free((&__pyx_v_self->_theGraph)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 64, __pyx_L1_error) /* "planarity/full/graph.pyx":63 * def __dealloc__(self): * """Frees the underlying graph structure with gp_Free().""" * if self._theGraph != NULL: # <<<<<<<<<<<<<< * graphLib.gp_Free(&self._theGraph) * */ } /* "planarity/full/graph.pyx":61 * raise MemoryError("gp_New() failed.") * * def __dealloc__(self): # <<<<<<<<<<<<<< * """Frees the underlying graph structure with gp_Free().""" * if self._theGraph != NULL: */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_WriteUnraisable("planarity.full.graph.Graph.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; } /* "planarity/full/graph.pyx":66 * graphLib.gp_Free(&self._theGraph) * * def gp_EnsureVertexCapacity(self, int N) -> None: # <<<<<<<<<<<<<< * """Allocates memory needed for storage of graph data, especially * N vertices, N virtual vertices, and space for either 3N edges */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_5gp_EnsureVertexCapacity(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_4gp_EnsureVertexCapacity, "Graph.gp_EnsureVertexCapacity(self, int N) -> None\n\nAllocates memory needed for storage of graph data, especially \nN vertices, N virtual vertices, and space for either 3N edges \nor the amount set by gp_EnsureEdgeCapacity(). This method does\nnot currently support being called more than once to increase\nvertex capacity beyond the initial setting for N.\n\nArgs: \n N: The number of vertices\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_5gp_EnsureVertexCapacity = {"gp_EnsureVertexCapacity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_5gp_EnsureVertexCapacity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_4gp_EnsureVertexCapacity}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_5gp_EnsureVertexCapacity(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_N; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_EnsureVertexCapacity (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_N,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 66, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 66, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_EnsureVertexCapacity", 0) < (0)) __PYX_ERR(0, 66, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_EnsureVertexCapacity", 1, 1, 1, i); __PYX_ERR(0, 66, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 66, __pyx_L3_error) } __pyx_v_N = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_N == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 66, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_EnsureVertexCapacity", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 66, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_EnsureVertexCapacity", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_4gp_EnsureVertexCapacity(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_N); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_4gp_EnsureVertexCapacity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_N) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; PyObject *__pyx_t_6[3]; PyObject *__pyx_t_7 = NULL; size_t __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_EnsureVertexCapacity", 0); /* "planarity/full/graph.pyx":80 * """ * # Parameter validation done by the C layer function * result = graphLib.gp_EnsureVertexCapacity(self._theGraph, N) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_EnsureVertexCapacity(__pyx_v_self->_theGraph, __pyx_v_N); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 80, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":81 * # Parameter validation done by the C layer function * result = graphLib.gp_EnsureVertexCapacity(self._theGraph, N) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_EnsureVertexCapacity() failed for given order {N}." */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":82 * result = graphLib.gp_EnsureVertexCapacity(self._theGraph, N) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * f"gp_EnsureVertexCapacity() failed for given order {N}." * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":83 * if result != OK: * raise RuntimeError( * f"gp_EnsureVertexCapacity() failed for given order {N}." # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_N, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_gp_EnsureVertexCapacity_failed_f; __pyx_t_6[1] = __pyx_t_2; __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_; __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 49 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 1, 127); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_8 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 82, __pyx_L1_error) /* "planarity/full/graph.pyx":81 * # Parameter validation done by the C layer function * result = graphLib.gp_EnsureVertexCapacity(self._theGraph, N) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_EnsureVertexCapacity() failed for given order {N}." */ } /* "planarity/full/graph.pyx":66 * graphLib.gp_Free(&self._theGraph) * * def gp_EnsureVertexCapacity(self, int N) -> None: # <<<<<<<<<<<<<< * """Allocates memory needed for storage of graph data, especially * N vertices, N virtual vertices, and space for either 3N edges */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_EnsureVertexCapacity", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":86 * ) * * def gp_EnsureEdgeCapacity(self, int requiredEdgeCapacity) -> None: # <<<<<<<<<<<<<< * """Ensures that the graph has or will have space for at least * requiredEdgeCapacity edges. This method can be called multiple */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_7gp_EnsureEdgeCapacity(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_6gp_EnsureEdgeCapacity, "Graph.gp_EnsureEdgeCapacity(self, int requiredEdgeCapacity) -> None\n\nEnsures that the graph has or will have space for at least\nrequiredEdgeCapacity edges. This method can be called multiple\ntimes to increase edge capacity as needed. If the graph already\nhas at least requiredEdgeCapacity edges, then this method \nsimply returns (edge capacity is not reduced). \n\nArgs:\n requiredEdgeCapacity: The required edge capacity\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_7gp_EnsureEdgeCapacity = {"gp_EnsureEdgeCapacity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_7gp_EnsureEdgeCapacity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_6gp_EnsureEdgeCapacity}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_7gp_EnsureEdgeCapacity(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_requiredEdgeCapacity; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_EnsureEdgeCapacity (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_requiredEdgeCapacity,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 86, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 86, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_EnsureEdgeCapacity", 0) < (0)) __PYX_ERR(0, 86, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_EnsureEdgeCapacity", 1, 1, 1, i); __PYX_ERR(0, 86, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 86, __pyx_L3_error) } __pyx_v_requiredEdgeCapacity = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_requiredEdgeCapacity == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 86, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_EnsureEdgeCapacity", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 86, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_EnsureEdgeCapacity", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_6gp_EnsureEdgeCapacity(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_requiredEdgeCapacity); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_6gp_EnsureEdgeCapacity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_requiredEdgeCapacity) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; PyObject *__pyx_t_6[3]; PyObject *__pyx_t_7 = NULL; size_t __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_EnsureEdgeCapacity", 0); /* "planarity/full/graph.pyx":100 * """ * # Parameter validation done by the C layer function * result = graphLib.gp_EnsureEdgeCapacity(self._theGraph, requiredEdgeCapacity) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_EnsureEdgeCapacity(__pyx_v_self->_theGraph, __pyx_v_requiredEdgeCapacity); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":101 * # Parameter validation done by the C layer function * result = graphLib.gp_EnsureEdgeCapacity(self._theGraph, requiredEdgeCapacity) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_EnsureEdgeCapacity() failed to set edge capacity to " */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 101, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":102 * result = graphLib.gp_EnsureEdgeCapacity(self._theGraph, requiredEdgeCapacity) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "gp_EnsureEdgeCapacity() failed to set edge capacity to " * f"{requiredEdgeCapacity}.") */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":104 * raise RuntimeError( * "gp_EnsureEdgeCapacity() failed to set edge capacity to " * f"{requiredEdgeCapacity}.") # <<<<<<<<<<<<<< * * def gp_ResetGraphStorage(self) -> None: */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_requiredEdgeCapacity, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_gp_EnsureEdgeCapacity_failed_to; __pyx_t_6[1] = __pyx_t_2; __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_; /* "planarity/full/graph.pyx":103 * if result != OK: * raise RuntimeError( * "gp_EnsureEdgeCapacity() failed to set edge capacity to " # <<<<<<<<<<<<<< * f"{requiredEdgeCapacity}.") * */ __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 55 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 1, 127); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_8 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 102, __pyx_L1_error) /* "planarity/full/graph.pyx":101 * # Parameter validation done by the C layer function * result = graphLib.gp_EnsureEdgeCapacity(self._theGraph, requiredEdgeCapacity) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_EnsureEdgeCapacity() failed to set edge capacity to " */ } /* "planarity/full/graph.pyx":86 * ) * * def gp_EnsureEdgeCapacity(self, int requiredEdgeCapacity) -> None: # <<<<<<<<<<<<<< * """Ensures that the graph has or will have space for at least * requiredEdgeCapacity edges. This method can be called multiple */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_EnsureEdgeCapacity", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":106 * f"{requiredEdgeCapacity}.") * * def gp_ResetGraphStorage(self) -> None: # <<<<<<<<<<<<<< * """Resets graph storage (including 'subclass' extension data).""" * graphLib.gp_ResetGraphStorage(self._theGraph) */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_9gp_ResetGraphStorage(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_8gp_ResetGraphStorage, "Graph.gp_ResetGraphStorage(self) -> None\n\nResets graph storage (including 'subclass' extension data)."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_9gp_ResetGraphStorage = {"gp_ResetGraphStorage", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_9gp_ResetGraphStorage, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_8gp_ResetGraphStorage}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_9gp_ResetGraphStorage(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ResetGraphStorage (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_ResetGraphStorage", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_ResetGraphStorage", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_8gp_ResetGraphStorage(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_8gp_ResetGraphStorage(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_ResetGraphStorage", 0); /* "planarity/full/graph.pyx":108 * def gp_ResetGraphStorage(self) -> None: * """Resets graph storage (including 'subclass' extension data).""" * graphLib.gp_ResetGraphStorage(self._theGraph) # <<<<<<<<<<<<<< * * def gp_GetN(self) -> int: */ __pyx_f_9planarity_4full_8graphLib_gp_ResetGraphStorage(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L1_error) /* "planarity/full/graph.pyx":106 * f"{requiredEdgeCapacity}.") * * def gp_ResetGraphStorage(self) -> None: # <<<<<<<<<<<<<< * """Resets graph storage (including 'subclass' extension data).""" * graphLib.gp_ResetGraphStorage(self._theGraph) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ResetGraphStorage", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":110 * graphLib.gp_ResetGraphStorage(self._theGraph) * * def gp_GetN(self) -> int: # <<<<<<<<<<<<<< * """Getter for the number of vertices in the graph. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_11gp_GetN(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_10gp_GetN, "Graph.gp_GetN(self) -> int\n\nGetter for the number of vertices in the graph.\n\nReturns:\n The number of vertices in the graph."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_11gp_GetN = {"gp_GetN", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_11gp_GetN, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_10gp_GetN}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_11gp_GetN(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetN (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_GetN", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_GetN", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_10gp_GetN(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_10gp_GetN(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetN", 0); /* "planarity/full/graph.pyx":116 * The number of vertices in the graph. * """ * return graphLib.gp_GetN(self._theGraph) # <<<<<<<<<<<<<< * * def gp_GetNV(self) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_GetN(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 116, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":110 * graphLib.gp_ResetGraphStorage(self._theGraph) * * def gp_GetN(self) -> int: # <<<<<<<<<<<<<< * """Getter for the number of vertices in the graph. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetN", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":118 * return graphLib.gp_GetN(self._theGraph) * * def gp_GetNV(self) -> int: # <<<<<<<<<<<<<< * """Getter for the number of virtual vertices available in the graph. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_13gp_GetNV(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_12gp_GetNV, "Graph.gp_GetNV(self) -> int\n\nGetter for the number of virtual vertices available in the graph.\n\nReturns:\n The number of virtual vertices available in the graph."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_13gp_GetNV = {"gp_GetNV", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_13gp_GetNV, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_12gp_GetNV}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_13gp_GetNV(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetNV (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_GetNV", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_GetNV", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_12gp_GetNV(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_12gp_GetNV(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetNV", 0); /* "planarity/full/graph.pyx":124 * The number of virtual vertices available in the graph. * """ * return graphLib.gp_GetNV(self._theGraph) # <<<<<<<<<<<<<< * * def gp_GetM(self) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_GetNV(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 124, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 124, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":118 * return graphLib.gp_GetN(self._theGraph) * * def gp_GetNV(self) -> int: # <<<<<<<<<<<<<< * """Getter for the number of virtual vertices available in the graph. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetNV", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":126 * return graphLib.gp_GetNV(self._theGraph) * * def gp_GetM(self) -> int: # <<<<<<<<<<<<<< * """Getter for number of edges in the graph, M. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_15gp_GetM(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_14gp_GetM, "Graph.gp_GetM(self) -> int\n\nGetter for number of edges in the graph, M.\n\nReturns:\n The number of edges in the graph."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_15gp_GetM = {"gp_GetM", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_15gp_GetM, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_14gp_GetM}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_15gp_GetM(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetM (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_GetM", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_GetM", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_14gp_GetM(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_14gp_GetM(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetM", 0); /* "planarity/full/graph.pyx":132 * The number of edges in the graph. * """ * return graphLib.gp_GetM(self._theGraph) # <<<<<<<<<<<<<< * * def gp_GetEdgeCapacity(self) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_GetM(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 132, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":126 * return graphLib.gp_GetNV(self._theGraph) * * def gp_GetM(self) -> int: # <<<<<<<<<<<<<< * """Getter for number of edges in the graph, M. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetM", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":134 * return graphLib.gp_GetM(self._theGraph) * * def gp_GetEdgeCapacity(self) -> int: # <<<<<<<<<<<<<< * """Getter for the edge capacity of the graph. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_17gp_GetEdgeCapacity(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_16gp_GetEdgeCapacity, "Graph.gp_GetEdgeCapacity(self) -> int\n\nGetter for the edge capacity of the graph.\n\nReturns:\n The edge capacity of the graph."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_17gp_GetEdgeCapacity = {"gp_GetEdgeCapacity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_17gp_GetEdgeCapacity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_16gp_GetEdgeCapacity}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_17gp_GetEdgeCapacity(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetEdgeCapacity (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_GetEdgeCapacity", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_GetEdgeCapacity", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_16gp_GetEdgeCapacity(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_16gp_GetEdgeCapacity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetEdgeCapacity", 0); /* "planarity/full/graph.pyx":140 * The edge capacity of the graph. * """ * return graphLib.gp_GetEdgeCapacity(self._theGraph) # <<<<<<<<<<<<<< * * def gp_CopyGraph(self, Graph srcGraph) -> None: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_GetEdgeCapacity(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 140, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":134 * return graphLib.gp_GetM(self._theGraph) * * def gp_GetEdgeCapacity(self) -> int: # <<<<<<<<<<<<<< * """Getter for the edge capacity of the graph. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetEdgeCapacity", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":142 * return graphLib.gp_GetEdgeCapacity(self._theGraph) * * def gp_CopyGraph(self, Graph srcGraph) -> None: # <<<<<<<<<<<<<< * """Copies src_graph into the destination Graph referred to by self. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_19gp_CopyGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_18gp_CopyGraph, "Graph.gp_CopyGraph(self, Graph srcGraph) -> None\n\nCopies src_graph into the destination Graph referred to by self.\n\nArgs:\n srcGraph: the Graph wrapping the graphP you wish to to copy into\n the current Graph's graphP.\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_19gp_CopyGraph = {"gp_CopyGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_19gp_CopyGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_18gp_CopyGraph}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_19gp_CopyGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_srcGraph = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_CopyGraph (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_srcGraph,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 142, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 142, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_CopyGraph", 0) < (0)) __PYX_ERR(0, 142, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_CopyGraph", 1, 1, 1, i); __PYX_ERR(0, 142, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 142, __pyx_L3_error) } __pyx_v_srcGraph = ((struct __pyx_obj_9planarity_4full_5graph_Graph *)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_CopyGraph", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 142, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_CopyGraph", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_srcGraph), __pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, 1, "srcGraph", 0))) __PYX_ERR(0, 142, __pyx_L1_error) __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_18gp_CopyGraph(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_srcGraph); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } goto __pyx_L7_cleaned_up; __pyx_L0:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __pyx_L7_cleaned_up:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_18gp_CopyGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_srcGraph) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_CopyGraph", 0); /* "planarity/full/graph.pyx":153 * """ * # Parameter validation done by the C layer function * result = graphLib.gp_CopyGraph(self._theGraph, srcGraph._theGraph) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError(f"gp_CopyGraph() failed.") */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_CopyGraph(__pyx_v_self->_theGraph, __pyx_v_srcGraph->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 153, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":154 * # Parameter validation done by the C layer function * result = graphLib.gp_CopyGraph(self._theGraph, srcGraph._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError(f"gp_CopyGraph() failed.") * */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":155 * result = graphLib.gp_CopyGraph(self._theGraph, srcGraph._theGraph) * if result != OK: * raise RuntimeError(f"gp_CopyGraph() failed.") # <<<<<<<<<<<<<< * * def gp_DupGraph(self) -> Graph: */ __pyx_t_3 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_gp_CopyGraph_failed}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 155, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 155, __pyx_L1_error) /* "planarity/full/graph.pyx":154 * # Parameter validation done by the C layer function * result = graphLib.gp_CopyGraph(self._theGraph, srcGraph._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError(f"gp_CopyGraph() failed.") * */ } /* "planarity/full/graph.pyx":142 * return graphLib.gp_GetEdgeCapacity(self._theGraph) * * def gp_CopyGraph(self, Graph srcGraph) -> None: # <<<<<<<<<<<<<< * """Copies src_graph into the destination Graph referred to by self. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_CopyGraph", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":157 * raise RuntimeError(f"gp_CopyGraph() failed.") * * def gp_DupGraph(self) -> Graph: # <<<<<<<<<<<<<< * """Creates a Graph wrapping a copy of the current Graph's graphP. * */ /* Python wrapper */ static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pw_9planarity_4full_5graph_5Graph_21gp_DupGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_20gp_DupGraph, "Graph.gp_DupGraph(self) -> Graph\n\nCreates a Graph wrapping a copy of the current Graph's graphP.\n\nReturns:\n A new Graph containing a duplicate of the current Graph's graphP.\n\nRaises:\n MemoryError if gp_DupGraph() failed to duplicate this Graph's graphP"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_21gp_DupGraph = {"gp_DupGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_21gp_DupGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_20gp_DupGraph}; static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pw_9planarity_4full_5graph_5Graph_21gp_DupGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_DupGraph (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_DupGraph", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_DupGraph", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_20gp_DupGraph(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_pf_9planarity_4full_5graph_5Graph_20gp_DupGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { graphP __pyx_v_theGraph_dup; struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_new_graph = 0; struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_r = NULL; __Pyx_RefNannyDeclarations graphP __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_DupGraph", 0); /* "planarity/full/graph.pyx":166 * MemoryError if gp_DupGraph() failed to duplicate this Graph's graphP * """ * cdef graphLib.graphP theGraph_dup = graphLib.gp_DupGraph(self._theGraph) # <<<<<<<<<<<<<< * if theGraph_dup == NULL: * raise MemoryError("gp_DupGraph() failed.") */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_DupGraph(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L1_error) __pyx_v_theGraph_dup = __pyx_t_1; /* "planarity/full/graph.pyx":167 * """ * cdef graphLib.graphP theGraph_dup = graphLib.gp_DupGraph(self._theGraph) * if theGraph_dup == NULL: # <<<<<<<<<<<<<< * raise MemoryError("gp_DupGraph() failed.") * */ __pyx_t_2 = (__pyx_v_theGraph_dup == NULL); if (unlikely(__pyx_t_2)) { /* "planarity/full/graph.pyx":168 * cdef graphLib.graphP theGraph_dup = graphLib.gp_DupGraph(self._theGraph) * if theGraph_dup == NULL: * raise MemoryError("gp_DupGraph() failed.") # <<<<<<<<<<<<<< * * cdef Graph new_graph = Graph() */ __pyx_t_4 = NULL; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_gp_DupGraph_failed}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_MemoryError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 168, __pyx_L1_error) /* "planarity/full/graph.pyx":167 * """ * cdef graphLib.graphP theGraph_dup = graphLib.gp_DupGraph(self._theGraph) * if theGraph_dup == NULL: # <<<<<<<<<<<<<< * raise MemoryError("gp_DupGraph() failed.") * */ } /* "planarity/full/graph.pyx":170 * raise MemoryError("gp_DupGraph() failed.") * * cdef Graph new_graph = Graph() # <<<<<<<<<<<<<< * graphLib.gp_Free(&new_graph._theGraph) * new_graph._theGraph = theGraph_dup */ __pyx_t_4 = NULL; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF((PyObject *)__pyx_t_3); } __pyx_v_new_graph = ((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_t_3); __pyx_t_3 = 0; /* "planarity/full/graph.pyx":171 * * cdef Graph new_graph = Graph() * graphLib.gp_Free(&new_graph._theGraph) # <<<<<<<<<<<<<< * new_graph._theGraph = theGraph_dup * */ __pyx_f_9planarity_4full_8graphLib_gp_Free((&__pyx_v_new_graph->_theGraph)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L1_error) /* "planarity/full/graph.pyx":172 * cdef Graph new_graph = Graph() * graphLib.gp_Free(&new_graph._theGraph) * new_graph._theGraph = theGraph_dup # <<<<<<<<<<<<<< * * return new_graph */ __pyx_v_new_graph->_theGraph = __pyx_v_theGraph_dup; /* "planarity/full/graph.pyx":174 * new_graph._theGraph = theGraph_dup * * return new_graph # <<<<<<<<<<<<<< * * def gp_CopyAdjacencyLists(self, Graph srcGraph) -> None: */ __Pyx_XDECREF((PyObject *)__pyx_r); __Pyx_INCREF((PyObject *)__pyx_v_new_graph); __pyx_r = __pyx_v_new_graph; goto __pyx_L0; /* "planarity/full/graph.pyx":157 * raise RuntimeError(f"gp_CopyGraph() failed.") * * def gp_DupGraph(self) -> Graph: # <<<<<<<<<<<<<< * """Creates a Graph wrapping a copy of the current Graph's graphP. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DupGraph", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_new_graph); __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":176 * return new_graph * * def gp_CopyAdjacencyLists(self, Graph srcGraph) -> None: # <<<<<<<<<<<<<< * """Copies adjacency lists of src_graph into current Graph's graphP. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_23gp_CopyAdjacencyLists(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_22gp_CopyAdjacencyLists, "Graph.gp_CopyAdjacencyLists(self, Graph srcGraph) -> None\n\nCopies adjacency lists of src_graph into current Graph's graphP.\n\nArgs:\n srcGraph: a Graph that wraps the graphP whose adjacency lists you\n wish to copy into the self's graphP.\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_23gp_CopyAdjacencyLists = {"gp_CopyAdjacencyLists", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_23gp_CopyAdjacencyLists, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_22gp_CopyAdjacencyLists}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_23gp_CopyAdjacencyLists(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_srcGraph = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_CopyAdjacencyLists (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_srcGraph,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 176, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 176, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_CopyAdjacencyLists", 0) < (0)) __PYX_ERR(0, 176, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_CopyAdjacencyLists", 1, 1, 1, i); __PYX_ERR(0, 176, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 176, __pyx_L3_error) } __pyx_v_srcGraph = ((struct __pyx_obj_9planarity_4full_5graph_Graph *)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_CopyAdjacencyLists", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 176, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_CopyAdjacencyLists", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_srcGraph), __pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, 1, "srcGraph", 0))) __PYX_ERR(0, 176, __pyx_L1_error) __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_22gp_CopyAdjacencyLists(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_srcGraph); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } goto __pyx_L7_cleaned_up; __pyx_L0:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __pyx_L7_cleaned_up:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_22gp_CopyAdjacencyLists(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_srcGraph) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_CopyAdjacencyLists", 0); /* "planarity/full/graph.pyx":186 * RuntimeError if C graphlib version of this function failed. * """ * result = graphLib.gp_CopyAdjacencyLists(self._theGraph, srcGraph._theGraph) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_CopyAdjacencyLists(__pyx_v_self->_theGraph, __pyx_v_srcGraph->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":187 * """ * result = graphLib.gp_CopyAdjacencyLists(self._theGraph, srcGraph._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Unable to copy adjacency lists from to this graph." */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 187, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 187, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 187, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 187, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":188 * result = graphLib.gp_CopyAdjacencyLists(self._theGraph, srcGraph._theGraph) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "Unable to copy adjacency lists from to this graph." * ) */ __pyx_t_3 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Unable_to_copy_adjacency_lists_f}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 188, __pyx_L1_error) /* "planarity/full/graph.pyx":187 * """ * result = graphLib.gp_CopyAdjacencyLists(self._theGraph, srcGraph._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Unable to copy adjacency lists from to this graph." */ } /* "planarity/full/graph.pyx":176 * return new_graph * * def gp_CopyAdjacencyLists(self, Graph srcGraph) -> None: # <<<<<<<<<<<<<< * """Copies adjacency lists of src_graph into current Graph's graphP. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_CopyAdjacencyLists", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":192 * ) * * def gp_CreateRandomGraph(self) -> None: # <<<<<<<<<<<<<< * """Creates a simple connected graph with a random number of edges, * up to the limit of the graph's edge capacity. */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_25gp_CreateRandomGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_24gp_CreateRandomGraph, "Graph.gp_CreateRandomGraph(self) -> None\n\nCreates a simple connected graph with a random number of edges,\nup to the limit of the graph's edge capacity.\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_25gp_CreateRandomGraph = {"gp_CreateRandomGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_25gp_CreateRandomGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_24gp_CreateRandomGraph}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_25gp_CreateRandomGraph(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_CreateRandomGraph (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_CreateRandomGraph", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_CreateRandomGraph", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_24gp_CreateRandomGraph(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_24gp_CreateRandomGraph(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_CreateRandomGraph", 0); /* "planarity/full/graph.pyx":199 * RuntimeError if C graphlib version of this function failed. * """ * result = graphLib.gp_CreateRandomGraph(self._theGraph) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError("Unable to create random graph.") */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_CreateRandomGraph(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 199, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":200 * """ * result = graphLib.gp_CreateRandomGraph(self._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError("Unable to create random graph.") * */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":201 * result = graphLib.gp_CreateRandomGraph(self._theGraph) * if result != OK: * raise RuntimeError("Unable to create random graph.") # <<<<<<<<<<<<<< * * def gp_CreateRandomGraphEx(self, int numEdges) -> None: */ __pyx_t_3 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Unable_to_create_random_graph}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 201, __pyx_L1_error) /* "planarity/full/graph.pyx":200 * """ * result = graphLib.gp_CreateRandomGraph(self._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError("Unable to create random graph.") * */ } /* "planarity/full/graph.pyx":192 * ) * * def gp_CreateRandomGraph(self) -> None: # <<<<<<<<<<<<<< * """Creates a simple connected graph with a random number of edges, * up to the limit of the graph's edge capacity. */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_CreateRandomGraph", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":203 * raise RuntimeError("Unable to create random graph.") * * def gp_CreateRandomGraphEx(self, int numEdges) -> None: # <<<<<<<<<<<<<< * """Creates a simple connected graph with numEdges edges. If numEdges * does not exceed 3N-6, then the generated graph will be planar. */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_27gp_CreateRandomGraphEx(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_26gp_CreateRandomGraphEx, "Graph.gp_CreateRandomGraphEx(self, int numEdges) -> None\n\nCreates a simple connected graph with numEdges edges. If numEdges\ndoes not exceed 3N-6, then the generated graph will be planar.\n\nArgs:\n numEdges: the desired number of edges for the generated graph\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_27gp_CreateRandomGraphEx = {"gp_CreateRandomGraphEx", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_27gp_CreateRandomGraphEx, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_26gp_CreateRandomGraphEx}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_27gp_CreateRandomGraphEx(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_numEdges; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_CreateRandomGraphEx (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_numEdges,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 203, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 203, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_CreateRandomGraphEx", 0) < (0)) __PYX_ERR(0, 203, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_CreateRandomGraphEx", 1, 1, 1, i); __PYX_ERR(0, 203, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 203, __pyx_L3_error) } __pyx_v_numEdges = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_numEdges == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 203, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_CreateRandomGraphEx", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 203, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_CreateRandomGraphEx", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_26gp_CreateRandomGraphEx(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_numEdges); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_26gp_CreateRandomGraphEx(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_numEdges) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; PyObject *__pyx_t_6[3]; PyObject *__pyx_t_7 = NULL; size_t __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_CreateRandomGraphEx", 0); /* "planarity/full/graph.pyx":214 * """ * # Parameter validation is done by the C layer function * result = graphLib.gp_CreateRandomGraphEx(self._theGraph, numEdges) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_CreateRandomGraphEx(__pyx_v_self->_theGraph, __pyx_v_numEdges); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":215 * # Parameter validation is done by the C layer function * result = graphLib.gp_CreateRandomGraphEx(self._theGraph, numEdges) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"Unable to create random graph with num_edges = {numEdges}." */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":216 * result = graphLib.gp_CreateRandomGraphEx(self._theGraph, numEdges) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * f"Unable to create random graph with num_edges = {numEdges}." * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":217 * if result != OK: * raise RuntimeError( * f"Unable to create random graph with num_edges = {numEdges}." # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_numEdges, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_Unable_to_create_random_graph_wi; __pyx_t_6[1] = __pyx_t_2; __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_; __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 47 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 1, 127); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_8 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 216, __pyx_L1_error) /* "planarity/full/graph.pyx":215 * # Parameter validation is done by the C layer function * result = graphLib.gp_CreateRandomGraphEx(self._theGraph, numEdges) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"Unable to create random graph with num_edges = {numEdges}." */ } /* "planarity/full/graph.pyx":203 * raise RuntimeError("Unable to create random graph.") * * def gp_CreateRandomGraphEx(self, int numEdges) -> None: # <<<<<<<<<<<<<< * """Creates a simple connected graph with numEdges edges. If numEdges * does not exceed 3N-6, then the generated graph will be planar. */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_CreateRandomGraphEx", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":220 * ) * * def gp_IsNeighbor(self, int u, int v) -> int: # <<<<<<<<<<<<<< * """Checks if a vertex or virtual vertex is a neighbor of another vertex * or virtual vertex in the graph. */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_29gp_IsNeighbor(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_28gp_IsNeighbor, "Graph.gp_IsNeighbor(self, int u, int v) -> int\n\nChecks if a vertex or virtual vertex is a neighbor of another vertex\n or virtual vertex in the graph.\n\nArgs:\n u: index of a vertex or virtual vertices in the graph\n v: index of another vertex or virtual vertex in the graph\n\nReturns:\n TRUE if u and v are neighbors, FALSE otherwise"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_29gp_IsNeighbor = {"gp_IsNeighbor", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_29gp_IsNeighbor, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_28gp_IsNeighbor}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_29gp_IsNeighbor(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_u; int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_IsNeighbor (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_u,&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 220, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 220, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 220, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_IsNeighbor", 0) < (0)) __PYX_ERR(0, 220, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_IsNeighbor", 1, 2, 2, i); __PYX_ERR(0, 220, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 220, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 220, __pyx_L3_error) } __pyx_v_u = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_u == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error) __pyx_v_v = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_IsNeighbor", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 220, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsNeighbor", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_28gp_IsNeighbor(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_u, __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_28gp_IsNeighbor(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_IsNeighbor", 0); /* "planarity/full/graph.pyx":232 * """ * # Parameter validation is done by the C layer function * return graphLib.gp_IsNeighbor(self._theGraph, u, v) # <<<<<<<<<<<<<< * * def gp_FindEdge(self, int u, int v) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_IsNeighbor(__pyx_v_self->_theGraph, __pyx_v_u, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 232, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":220 * ) * * def gp_IsNeighbor(self, int u, int v) -> int: # <<<<<<<<<<<<<< * """Checks if a vertex or virtual vertex is a neighbor of another vertex * or virtual vertex in the graph. */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsNeighbor", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":234 * return graphLib.gp_IsNeighbor(self._theGraph, u, v) * * def gp_FindEdge(self, int u, int v) -> int: # <<<<<<<<<<<<<< * """Find index of edge between u and v if it exists in graph. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_31gp_FindEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_30gp_FindEdge, "Graph.gp_FindEdge(self, int u, int v) -> int\n\nFind index of edge between u and v if it exists in graph.\n\nArgs:\n u: index of a vertex in graph\n v: index of another vertex in graph\n\nReturns:\n NIL if edge not found, or the index e of the edge between u and v"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_31gp_FindEdge = {"gp_FindEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_31gp_FindEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_30gp_FindEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_31gp_FindEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_u; int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_FindEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_u,&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 234, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 234, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 234, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_FindEdge", 0) < (0)) __PYX_ERR(0, 234, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_FindEdge", 1, 2, 2, i); __PYX_ERR(0, 234, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 234, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 234, __pyx_L3_error) } __pyx_v_u = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_u == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error) __pyx_v_v = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_FindEdge", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 234, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_FindEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_30gp_FindEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_u, __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_30gp_FindEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_FindEdge", 0); /* "planarity/full/graph.pyx":245 * """ * # Parameter validation is done by the C layer function * return graphLib.gp_FindEdge(self._theGraph, u, v) # <<<<<<<<<<<<<< * * def gp_GetVertexDegree(self, int v) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_FindEdge(__pyx_v_self->_theGraph, __pyx_v_u, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 245, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":234 * return graphLib.gp_IsNeighbor(self._theGraph, u, v) * * def gp_FindEdge(self, int u, int v) -> int: # <<<<<<<<<<<<<< * """Find index of edge between u and v if it exists in graph. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_FindEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":247 * return graphLib.gp_FindEdge(self._theGraph, u, v) * * def gp_GetVertexDegree(self, int v) -> int: # <<<<<<<<<<<<<< * """Gets the number of incident edges of the vertex with given index. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_33gp_GetVertexDegree(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_32gp_GetVertexDegree, "Graph.gp_GetVertexDegree(self, int v) -> int\n\nGets the number of incident edges of the vertex with given index.\n\nArgs:\n v: index of a vertex in the graph\n\nReturns:\n The degree of vertex v in the graph"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_33gp_GetVertexDegree = {"gp_GetVertexDegree", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_33gp_GetVertexDegree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_32gp_GetVertexDegree}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_33gp_GetVertexDegree(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetVertexDegree (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 247, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 247, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetVertexDegree", 0) < (0)) __PYX_ERR(0, 247, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetVertexDegree", 1, 1, 1, i); __PYX_ERR(0, 247, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 247, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 247, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetVertexDegree", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 247, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetVertexDegree", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_32gp_GetVertexDegree(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_32gp_GetVertexDegree(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetVertexDegree", 0); /* "planarity/full/graph.pyx":257 * """ * # Parameter validation is done by the C layer function * return graphLib.gp_GetVertexDegree(self._theGraph, v) # <<<<<<<<<<<<<< * * def gp_IsNeighborDirected(self, int u, int v, unsigned direction) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_GetVertexDegree(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 257, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":247 * return graphLib.gp_FindEdge(self._theGraph, u, v) * * def gp_GetVertexDegree(self, int v) -> int: # <<<<<<<<<<<<<< * """Gets the number of incident edges of the vertex with given index. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetVertexDegree", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":259 * return graphLib.gp_GetVertexDegree(self._theGraph, v) * * def gp_IsNeighborDirected(self, int u, int v, unsigned direction) -> int: # <<<<<<<<<<<<<< * """Checks if edge exists in a given direction between two vertices. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_35gp_IsNeighborDirected(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_34gp_IsNeighborDirected, "Graph.gp_IsNeighborDirected(self, int u, int v, unsigned int direction) -> int\n\nChecks if edge exists in a given direction between two vertices.\n\nArgs:\n u: index of a vertex in graph\n v: index of another vertex in graph\n direction: EDGEFLAG_DIRECTION_INONLY or EDGEFLAG_DIRECTION_OUTONLY\n\nReturns:\n TRUE if u and v are neighbors (the edge is undirected or matches \n the given direction, FALSE otherwise"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_35gp_IsNeighborDirected = {"gp_IsNeighborDirected", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_35gp_IsNeighborDirected, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_34gp_IsNeighborDirected}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_35gp_IsNeighborDirected(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_u; int __pyx_v_v; unsigned int __pyx_v_direction; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_IsNeighborDirected (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_u,&__pyx_mstate_global->__pyx_n_u_v,&__pyx_mstate_global->__pyx_n_u_direction,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 259, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 259, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 259, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 259, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_IsNeighborDirected", 0) < (0)) __PYX_ERR(0, 259, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_IsNeighborDirected", 1, 3, 3, i); __PYX_ERR(0, 259, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 3)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 259, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 259, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 259, __pyx_L3_error) } __pyx_v_u = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_u == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L3_error) __pyx_v_v = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L3_error) __pyx_v_direction = __Pyx_PyLong_As_unsigned_int(values[2]); if (unlikely((__pyx_v_direction == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 259, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_IsNeighborDirected", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 259, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsNeighborDirected", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_34gp_IsNeighborDirected(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_u, __pyx_v_v, __pyx_v_direction); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_34gp_IsNeighborDirected(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_v, unsigned int __pyx_v_direction) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_IsNeighborDirected", 0); /* "planarity/full/graph.pyx":272 * """ * # Parameter validation is done by the C layer function * return graphLib.gp_IsNeighborDirected(self._theGraph, u, v, direction) # <<<<<<<<<<<<<< * * def gp_FindDirectedEdge(self, int u, int v, unsigned direction) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_IsNeighborDirected(__pyx_v_self->_theGraph, __pyx_v_u, __pyx_v_v, __pyx_v_direction); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 272, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 272, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":259 * return graphLib.gp_GetVertexDegree(self._theGraph, v) * * def gp_IsNeighborDirected(self, int u, int v, unsigned direction) -> int: # <<<<<<<<<<<<<< * """Checks if edge exists in a given direction between two vertices. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsNeighborDirected", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":274 * return graphLib.gp_IsNeighborDirected(self._theGraph, u, v, direction) * * def gp_FindDirectedEdge(self, int u, int v, unsigned direction) -> int: # <<<<<<<<<<<<<< * """Find directed index of edge between u and v if it exists in graph. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_37gp_FindDirectedEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_36gp_FindDirectedEdge, "Graph.gp_FindDirectedEdge(self, int u, int v, unsigned int direction) -> int\n\nFind directed index of edge between u and v if it exists in graph.\n\nArgs:\n u: index of a vertex in graph\n v: index of another vertex in graph\n direction: EDGEFLAG_DIRECTION_INONLY or EDGEFLAG_DIRECTION_OUTONLY\n\nReturns:\n NIL if edge not found, or the index e of the directed edge between\n u and v"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_37gp_FindDirectedEdge = {"gp_FindDirectedEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_37gp_FindDirectedEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_36gp_FindDirectedEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_37gp_FindDirectedEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_u; int __pyx_v_v; unsigned int __pyx_v_direction; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_FindDirectedEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_u,&__pyx_mstate_global->__pyx_n_u_v,&__pyx_mstate_global->__pyx_n_u_direction,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 274, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 274, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 274, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 274, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_FindDirectedEdge", 0) < (0)) __PYX_ERR(0, 274, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_FindDirectedEdge", 1, 3, 3, i); __PYX_ERR(0, 274, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 3)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 274, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 274, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 274, __pyx_L3_error) } __pyx_v_u = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_u == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 274, __pyx_L3_error) __pyx_v_v = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 274, __pyx_L3_error) __pyx_v_direction = __Pyx_PyLong_As_unsigned_int(values[2]); if (unlikely((__pyx_v_direction == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 274, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_FindDirectedEdge", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 274, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_FindDirectedEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_36gp_FindDirectedEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_u, __pyx_v_v, __pyx_v_direction); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_36gp_FindDirectedEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_v, unsigned int __pyx_v_direction) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_FindDirectedEdge", 0); /* "planarity/full/graph.pyx":287 * """ * # Parameter validation is done by the C layer function * return graphLib.gp_FindDirectedEdge(self._theGraph, u, v, direction) # <<<<<<<<<<<<<< * * def gp_GetVertexInDegree(self, int v) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_FindDirectedEdge(__pyx_v_self->_theGraph, __pyx_v_u, __pyx_v_v, __pyx_v_direction); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 287, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 287, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":274 * return graphLib.gp_IsNeighborDirected(self._theGraph, u, v, direction) * * def gp_FindDirectedEdge(self, int u, int v, unsigned direction) -> int: # <<<<<<<<<<<<<< * """Find directed index of edge between u and v if it exists in graph. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_FindDirectedEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":289 * return graphLib.gp_FindDirectedEdge(self._theGraph, u, v, direction) * * def gp_GetVertexInDegree(self, int v) -> int: # <<<<<<<<<<<<<< * """Gets in-degree of v, including undirected edges * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_39gp_GetVertexInDegree(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_38gp_GetVertexInDegree, "Graph.gp_GetVertexInDegree(self, int v) -> int\n\nGets in-degree of v, including undirected edges\n\nArgs:\n v: index of a vertex in graph\n\nReturns:\n The in-degree of the vertex with index v"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_39gp_GetVertexInDegree = {"gp_GetVertexInDegree", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_39gp_GetVertexInDegree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_38gp_GetVertexInDegree}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_39gp_GetVertexInDegree(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetVertexInDegree (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 289, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 289, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetVertexInDegree", 0) < (0)) __PYX_ERR(0, 289, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetVertexInDegree", 1, 1, 1, i); __PYX_ERR(0, 289, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 289, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 289, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetVertexInDegree", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 289, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetVertexInDegree", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_38gp_GetVertexInDegree(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_38gp_GetVertexInDegree(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetVertexInDegree", 0); /* "planarity/full/graph.pyx":299 * """ * # Parameter validation is done by the C layer function * return graphLib.gp_GetVertexInDegree(self._theGraph, v) # <<<<<<<<<<<<<< * * def gp_GetVertexOutDegree(self, int v) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_GetVertexInDegree(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 299, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 299, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":289 * return graphLib.gp_FindDirectedEdge(self._theGraph, u, v, direction) * * def gp_GetVertexInDegree(self, int v) -> int: # <<<<<<<<<<<<<< * """Gets in-degree of v, including undirected edges * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetVertexInDegree", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":301 * return graphLib.gp_GetVertexInDegree(self._theGraph, v) * * def gp_GetVertexOutDegree(self, int v) -> int: # <<<<<<<<<<<<<< * """Gets out-degree of v, including undirected edges. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_41gp_GetVertexOutDegree(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_40gp_GetVertexOutDegree, "Graph.gp_GetVertexOutDegree(self, int v) -> int\n\nGets out-degree of v, including undirected edges.\n\nArgs:\n v: index of a vertex in graph\n\nReturns:\n The out-degree of the vertex with index v"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_41gp_GetVertexOutDegree = {"gp_GetVertexOutDegree", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_41gp_GetVertexOutDegree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_40gp_GetVertexOutDegree}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_41gp_GetVertexOutDegree(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetVertexOutDegree (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 301, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 301, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetVertexOutDegree", 0) < (0)) __PYX_ERR(0, 301, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetVertexOutDegree", 1, 1, 1, i); __PYX_ERR(0, 301, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 301, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 301, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetVertexOutDegree", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 301, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetVertexOutDegree", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_40gp_GetVertexOutDegree(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_40gp_GetVertexOutDegree(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetVertexOutDegree", 0); /* "planarity/full/graph.pyx":311 * """ * # Parameter validation is done by the C layer function * return graphLib.gp_GetVertexOutDegree(self._theGraph, v) # <<<<<<<<<<<<<< * * def gp_AddEdge(self, int u, int ulink, int v, int vlink) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_GetVertexOutDegree(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 311, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 311, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":301 * return graphLib.gp_GetVertexInDegree(self._theGraph, v) * * def gp_GetVertexOutDegree(self, int v) -> int: # <<<<<<<<<<<<<< * """Gets out-degree of v, including undirected edges. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetVertexOutDegree", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":313 * return graphLib.gp_GetVertexOutDegree(self._theGraph, v) * * def gp_AddEdge(self, int u, int ulink, int v, int vlink) -> int: # <<<<<<<<<<<<<< * """Adds edge between two vertices (if sufficient edge capacity). * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_43gp_AddEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_42gp_AddEdge, "Graph.gp_AddEdge(self, int u, int ulink, int v, int vlink) -> int\n\nAdds edge between two vertices (if sufficient edge capacity).\n\nArgs:\n u: index of a vertex in graph\n ulink: either 0 or 1; indicates whether the edge record to v in u's\n list should become adjacent to u by its 0 or 1 link\n v: index of another vertex in graph\n vlink: either 0 or 1; indicates whether the edge record to u in v's\n list should become adjacent to v by its 0 or 1 link\n\nReturns:\n Returns OK on success, or AT_EDGE_CAPACITY_LIMIT if adding the edge\n would exceed the graph's edge capacity (the caller can use\n gp_DynamicAddEdge()).\n\nRaises:\n ValueError if ulink or vlink are anything other than 0 or 1\n RuntimeError if gp_AddEdge() returned anything other than OK or\n AT_EDGE_CAPACITY_LIMIT, i.e., returned NOTOK"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_43gp_AddEdge = {"gp_AddEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_43gp_AddEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_42gp_AddEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_43gp_AddEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_u; int __pyx_v_ulink; int __pyx_v_v; int __pyx_v_vlink; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[4] = {0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_AddEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_u,&__pyx_mstate_global->__pyx_n_u_ulink,&__pyx_mstate_global->__pyx_n_u_v,&__pyx_mstate_global->__pyx_n_u_vlink,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 313, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 4: values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 313, __pyx_L3_error) CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 313, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 313, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 313, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_AddEdge", 0) < (0)) __PYX_ERR(0, 313, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 4; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_AddEdge", 1, 4, 4, i); __PYX_ERR(0, 313, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 4)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 313, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 313, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 313, __pyx_L3_error) values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 313, __pyx_L3_error) } __pyx_v_u = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_u == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 313, __pyx_L3_error) __pyx_v_ulink = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_ulink == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 313, __pyx_L3_error) __pyx_v_v = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 313, __pyx_L3_error) __pyx_v_vlink = __Pyx_PyLong_As_int(values[3]); if (unlikely((__pyx_v_vlink == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 313, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_AddEdge", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 313, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_AddEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_42gp_AddEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_u, __pyx_v_ulink, __pyx_v_v, __pyx_v_vlink); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_42gp_AddEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_ulink, int __pyx_v_v, int __pyx_v_vlink) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5[3]; PyObject *__pyx_t_6 = NULL; size_t __pyx_t_7; int __pyx_t_8; int __pyx_t_9; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12[9]; PyObject *__pyx_t_13 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_AddEdge", 0); /* "planarity/full/graph.pyx":335 * """ * # These have to be checked until the C API checks them. * if ulink != 0 and ulink != 1: # <<<<<<<<<<<<<< * raise ValueError( * f"Invalid link index for ulink: '{ulink}'." */ switch (__pyx_v_ulink) { case 0: case 1: __pyx_t_1 = 0; break; default: __pyx_t_1 = 1; break; } if (unlikely(__pyx_t_1)) { /* "planarity/full/graph.pyx":336 * # These have to be checked until the C API checks them. * if ulink != 0 and ulink != 1: * raise ValueError( # <<<<<<<<<<<<<< * f"Invalid link index for ulink: '{ulink}'." * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":337 * if ulink != 0 and ulink != 1: * raise ValueError( * f"Invalid link index for ulink: '{ulink}'." # <<<<<<<<<<<<<< * ) * */ __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_ulink, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 337, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_link_index_for_ulink; __pyx_t_5[1] = __pyx_t_4; __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u__2; __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, 31 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 2, 127); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 337, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_7 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 336, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 336, __pyx_L1_error) /* "planarity/full/graph.pyx":335 * """ * # These have to be checked until the C API checks them. * if ulink != 0 and ulink != 1: # <<<<<<<<<<<<<< * raise ValueError( * f"Invalid link index for ulink: '{ulink}'." */ } /* "planarity/full/graph.pyx":340 * ) * * if vlink != 0 and vlink != 1: # <<<<<<<<<<<<<< * raise ValueError( * f"Invalid link index for vlink: '{vlink}'." */ switch (__pyx_v_vlink) { case 0: case 1: __pyx_t_1 = 0; break; default: __pyx_t_1 = 1; break; } if (unlikely(__pyx_t_1)) { /* "planarity/full/graph.pyx":341 * * if vlink != 0 and vlink != 1: * raise ValueError( # <<<<<<<<<<<<<< * f"Invalid link index for vlink: '{vlink}'." * ) */ __pyx_t_6 = NULL; /* "planarity/full/graph.pyx":342 * if vlink != 0 and vlink != 1: * raise ValueError( * f"Invalid link index for vlink: '{vlink}'." # <<<<<<<<<<<<<< * ) * */ __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_vlink, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_link_index_for_vlink; __pyx_t_5[1] = __pyx_t_3; __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u__2; __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, 31 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 2, 127); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 341, __pyx_L1_error) /* "planarity/full/graph.pyx":340 * ) * * if vlink != 0 and vlink != 1: # <<<<<<<<<<<<<< * raise ValueError( * f"Invalid link index for vlink: '{vlink}'." */ } /* "planarity/full/graph.pyx":346 * * # Parameter validation is done by the C layer function * result = graphLib.gp_AddEdge(self._theGraph, u, ulink, v, vlink) # <<<<<<<<<<<<<< * if result != OK and result != AT_EDGE_CAPACITY_LIMIT: * raise RuntimeError( */ __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_AddEdge(__pyx_v_self->_theGraph, __pyx_v_u, __pyx_v_ulink, __pyx_v_v, __pyx_v_vlink); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 346, __pyx_L1_error) __pyx_v_result = __pyx_t_8; /* "planarity/full/graph.pyx":347 * # Parameter validation is done by the C layer function * result = graphLib.gp_AddEdge(self._theGraph, u, ulink, v, vlink) * if result != OK and result != AT_EDGE_CAPACITY_LIMIT: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_AddEdge() failed: unable to add edge (u, v) = ({u}, {v}) " */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_9) { } else { __pyx_t_1 = __pyx_t_9; goto __pyx_L6_bool_binop_done; } __pyx_t_6 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_AT_EDGE_CAPACITY_LIMIT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = PyObject_RichCompare(__pyx_t_6, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_9; __pyx_L6_bool_binop_done:; if (unlikely(__pyx_t_1)) { /* "planarity/full/graph.pyx":348 * result = graphLib.gp_AddEdge(self._theGraph, u, ulink, v, vlink) * if result != OK and result != AT_EDGE_CAPACITY_LIMIT: * raise RuntimeError( # <<<<<<<<<<<<<< * f"gp_AddEdge() failed: unable to add edge (u, v) = ({u}, {v}) " * f"with ulink = {ulink} and vlink = {vlink}." */ __pyx_t_4 = NULL; /* "planarity/full/graph.pyx":349 * if result != OK and result != AT_EDGE_CAPACITY_LIMIT: * raise RuntimeError( * f"gp_AddEdge() failed: unable to add edge (u, v) = ({u}, {v}) " # <<<<<<<<<<<<<< * f"with ulink = {ulink} and vlink = {vlink}." * ) */ __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_u, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* "planarity/full/graph.pyx":350 * raise RuntimeError( * f"gp_AddEdge() failed: unable to add edge (u, v) = ({u}, {v}) " * f"with ulink = {ulink} and vlink = {vlink}." # <<<<<<<<<<<<<< * ) * */ __pyx_t_10 = __Pyx_PyUnicode_From_int(__pyx_v_ulink, 0, ' ', 'd'); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 350, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = __Pyx_PyUnicode_From_int(__pyx_v_vlink, 0, ' ', 'd'); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 350, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_12[0] = __pyx_mstate_global->__pyx_kp_u_gp_AddEdge_failed_unable_to_add; __pyx_t_12[1] = __pyx_t_6; __pyx_t_12[2] = __pyx_mstate_global->__pyx_kp_u__3; __pyx_t_12[3] = __pyx_t_3; __pyx_t_12[4] = __pyx_mstate_global->__pyx_kp_u_with_ulink; __pyx_t_12[5] = __pyx_t_10; __pyx_t_12[6] = __pyx_mstate_global->__pyx_kp_u_and_vlink; __pyx_t_12[7] = __pyx_t_11; __pyx_t_12[8] = __pyx_mstate_global->__pyx_kp_u_; /* "planarity/full/graph.pyx":349 * if result != OK and result != AT_EDGE_CAPACITY_LIMIT: * raise RuntimeError( * f"gp_AddEdge() failed: unable to add edge (u, v) = ({u}, {v}) " # <<<<<<<<<<<<<< * f"with ulink = {ulink} and vlink = {vlink}." * ) */ __pyx_t_13 = __Pyx_PyUnicode_Join(__pyx_t_12, 9, 50 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11) + 1, 127); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_7 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_13}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 348, __pyx_L1_error) /* "planarity/full/graph.pyx":347 * # Parameter validation is done by the C layer function * result = graphLib.gp_AddEdge(self._theGraph, u, ulink, v, vlink) * if result != OK and result != AT_EDGE_CAPACITY_LIMIT: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_AddEdge() failed: unable to add edge (u, v) = ({u}, {v}) " */ } /* "planarity/full/graph.pyx":353 * ) * * return result # <<<<<<<<<<<<<< * * def gp_DynamicAddEdge(self, int u, int ulink, int v, int vlink) -> None: */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 353, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":313 * return graphLib.gp_GetVertexOutDegree(self._theGraph, v) * * def gp_AddEdge(self, int u, int ulink, int v, int vlink) -> int: # <<<<<<<<<<<<<< * """Adds edge between two vertices (if sufficient edge capacity). * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_13); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_AddEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":355 * return result * * def gp_DynamicAddEdge(self, int u, int ulink, int v, int vlink) -> None: # <<<<<<<<<<<<<< * """Adds edge between two vertices, resizing structures if necessessary. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_45gp_DynamicAddEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_44gp_DynamicAddEdge, "Graph.gp_DynamicAddEdge(self, int u, int ulink, int v, int vlink) -> None\n\nAdds edge between two vertices, resizing structures if necessessary.\n\nArgs:\n u: index of a vertex in graph\n ulink: either 0 or 1; indicates whether the edge record to v in u's\n list should become adjacent to u by its 0 or 1 link\n v: index of another vertex in graph\n vlink: either 0 or 1; indicates whether the edge record to u in v's\n list should become adjacent to v by its 0 or 1 link\n\nRaises:\n ValueError ulink or vlink are anything other than 0 or 1\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_45gp_DynamicAddEdge = {"gp_DynamicAddEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_45gp_DynamicAddEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_44gp_DynamicAddEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_45gp_DynamicAddEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_u; int __pyx_v_ulink; int __pyx_v_v; int __pyx_v_vlink; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[4] = {0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_DynamicAddEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_u,&__pyx_mstate_global->__pyx_n_u_ulink,&__pyx_mstate_global->__pyx_n_u_v,&__pyx_mstate_global->__pyx_n_u_vlink,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 355, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 4: values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 355, __pyx_L3_error) CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 355, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 355, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 355, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_DynamicAddEdge", 0) < (0)) __PYX_ERR(0, 355, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 4; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_DynamicAddEdge", 1, 4, 4, i); __PYX_ERR(0, 355, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 4)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 355, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 355, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 355, __pyx_L3_error) values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 355, __pyx_L3_error) } __pyx_v_u = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_u == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 355, __pyx_L3_error) __pyx_v_ulink = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_ulink == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 355, __pyx_L3_error) __pyx_v_v = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 355, __pyx_L3_error) __pyx_v_vlink = __Pyx_PyLong_As_int(values[3]); if (unlikely((__pyx_v_vlink == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 355, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_DynamicAddEdge", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 355, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DynamicAddEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_44gp_DynamicAddEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_u, __pyx_v_ulink, __pyx_v_v, __pyx_v_vlink); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_44gp_DynamicAddEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_ulink, int __pyx_v_v, int __pyx_v_vlink) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5[3]; PyObject *__pyx_t_6 = NULL; size_t __pyx_t_7; int __pyx_t_8; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11[9]; PyObject *__pyx_t_12 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_DynamicAddEdge", 0); /* "planarity/full/graph.pyx":371 * """ * # These have to be checked until the C API checks them. * if ulink != 0 and ulink != 1: # <<<<<<<<<<<<<< * raise ValueError( * f"Invalid link index for ulink: '{ulink}'." */ switch (__pyx_v_ulink) { case 0: case 1: __pyx_t_1 = 0; break; default: __pyx_t_1 = 1; break; } if (unlikely(__pyx_t_1)) { /* "planarity/full/graph.pyx":372 * # These have to be checked until the C API checks them. * if ulink != 0 and ulink != 1: * raise ValueError( # <<<<<<<<<<<<<< * f"Invalid link index for ulink: '{ulink}'." * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":373 * if ulink != 0 and ulink != 1: * raise ValueError( * f"Invalid link index for ulink: '{ulink}'." # <<<<<<<<<<<<<< * ) * */ __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_ulink, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_link_index_for_ulink; __pyx_t_5[1] = __pyx_t_4; __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u__2; __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, 31 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 2, 127); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_7 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 372, __pyx_L1_error) /* "planarity/full/graph.pyx":371 * """ * # These have to be checked until the C API checks them. * if ulink != 0 and ulink != 1: # <<<<<<<<<<<<<< * raise ValueError( * f"Invalid link index for ulink: '{ulink}'." */ } /* "planarity/full/graph.pyx":376 * ) * * if vlink != 0 and vlink != 1: # <<<<<<<<<<<<<< * raise ValueError( * f"Invalid link index for vlink: '{vlink}'." */ switch (__pyx_v_vlink) { case 0: case 1: __pyx_t_1 = 0; break; default: __pyx_t_1 = 1; break; } if (unlikely(__pyx_t_1)) { /* "planarity/full/graph.pyx":377 * * if vlink != 0 and vlink != 1: * raise ValueError( # <<<<<<<<<<<<<< * f"Invalid link index for vlink: '{vlink}'." * ) */ __pyx_t_6 = NULL; /* "planarity/full/graph.pyx":378 * if vlink != 0 and vlink != 1: * raise ValueError( * f"Invalid link index for vlink: '{vlink}'." # <<<<<<<<<<<<<< * ) * */ __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_vlink, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5[0] = __pyx_mstate_global->__pyx_kp_u_Invalid_link_index_for_vlink; __pyx_t_5[1] = __pyx_t_3; __pyx_t_5[2] = __pyx_mstate_global->__pyx_kp_u__2; __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, 31 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 2, 127); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 377, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 377, __pyx_L1_error) /* "planarity/full/graph.pyx":376 * ) * * if vlink != 0 and vlink != 1: # <<<<<<<<<<<<<< * raise ValueError( * f"Invalid link index for vlink: '{vlink}'." */ } /* "planarity/full/graph.pyx":382 * * # Parameter validation is done by the C layer function * result = graphLib.gp_DynamicAddEdge(self._theGraph, u, ulink, v, vlink) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_DynamicAddEdge(__pyx_v_self->_theGraph, __pyx_v_u, __pyx_v_ulink, __pyx_v_v, __pyx_v_vlink); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 382, __pyx_L1_error) __pyx_v_result = __pyx_t_8; /* "planarity/full/graph.pyx":383 * # Parameter validation is done by the C layer function * result = graphLib.gp_DynamicAddEdge(self._theGraph, u, ulink, v, vlink) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_DynamicAddEdge() failed: unable to add edge (u, v) = " */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 383, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 383, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 383, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(__pyx_t_1)) { /* "planarity/full/graph.pyx":384 * result = graphLib.gp_DynamicAddEdge(self._theGraph, u, ulink, v, vlink) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "gp_DynamicAddEdge() failed: unable to add edge (u, v) = " * f"({u}, {v}) with ulink = {ulink} and vlink = {vlink}." */ __pyx_t_4 = NULL; /* "planarity/full/graph.pyx":386 * raise RuntimeError( * "gp_DynamicAddEdge() failed: unable to add edge (u, v) = " * f"({u}, {v}) with ulink = {ulink} and vlink = {vlink}." # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_u, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 386, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 386, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_9 = __Pyx_PyUnicode_From_int(__pyx_v_ulink, 0, ' ', 'd'); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 386, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = __Pyx_PyUnicode_From_int(__pyx_v_vlink, 0, ' ', 'd'); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 386, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_11[0] = __pyx_mstate_global->__pyx_kp_u_gp_DynamicAddEdge_failed_unable; __pyx_t_11[1] = __pyx_t_2; __pyx_t_11[2] = __pyx_mstate_global->__pyx_kp_u__3; __pyx_t_11[3] = __pyx_t_3; __pyx_t_11[4] = __pyx_mstate_global->__pyx_kp_u_with_ulink; __pyx_t_11[5] = __pyx_t_9; __pyx_t_11[6] = __pyx_mstate_global->__pyx_kp_u_and_vlink; __pyx_t_11[7] = __pyx_t_10; __pyx_t_11[8] = __pyx_mstate_global->__pyx_kp_u_; /* "planarity/full/graph.pyx":385 * if result != OK: * raise RuntimeError( * "gp_DynamicAddEdge() failed: unable to add edge (u, v) = " # <<<<<<<<<<<<<< * f"({u}, {v}) with ulink = {ulink} and vlink = {vlink}." * ) */ __pyx_t_12 = __Pyx_PyUnicode_Join(__pyx_t_11, 9, 57 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 15 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9) + 13 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + 1, 127); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 385, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_7 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_12}; __pyx_t_6 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 384, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); } __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __PYX_ERR(0, 384, __pyx_L1_error) /* "planarity/full/graph.pyx":383 * # Parameter validation is done by the C layer function * result = graphLib.gp_DynamicAddEdge(self._theGraph, u, ulink, v, vlink) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_DynamicAddEdge() failed: unable to add edge (u, v) = " */ } /* "planarity/full/graph.pyx":355 * return result * * def gp_DynamicAddEdge(self, int u, int ulink, int v, int vlink) -> None: # <<<<<<<<<<<<<< * """Adds edge between two vertices, resizing structures if necessessary. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_12); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DynamicAddEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":389 * ) * * def gp_InsertEdge(self, int u, int e_u, int e_ulink, int v, int e_v, int e_vlink) -> int: # <<<<<<<<<<<<<< * """Insert edge between u and v in specific positions of adjacency lists. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_47gp_InsertEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_46gp_InsertEdge, "Graph.gp_InsertEdge(self, int u, int e_u, int e_ulink, int v, int e_v, int e_vlink) -> int\n\nInsert edge between u and v in specific positions of adjacency lists.\n\nArgs:\n u: index of a vertex in graph\n e_u: new edge is added next to this edge in u's adjacency list\n e_ulink: 0 or 1; which side of e_u to add new edge (or which side\n of the adjacency list of u if e_u is NIL)\n v: index of a vertex in graph\n e_v: new edge is added next to this edge in v's adjacency list\n e_vlink: 0 or 1; which side of e_v to add new edge (or which side\n of the adjacency list of v if e_v is NIL)\n\nReturns:\n OK on success, or AT_EDGE_CAPACITY_LIMIT if adding the edge would\n exceed the graph's edge capacity (gp_EnsureEdgeCapacity() can be\n called before this method).\n\nRaises:\n RuntimeError if gp_InsertEdge() returned anything other than OK or\n AT_EDGE_CAPACITY_LIMIT"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_47gp_InsertEdge = {"gp_InsertEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_47gp_InsertEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_46gp_InsertEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_47gp_InsertEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_u; int __pyx_v_e_u; int __pyx_v_e_ulink; int __pyx_v_v; int __pyx_v_e_v; int __pyx_v_e_vlink; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[6] = {0,0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_InsertEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_u,&__pyx_mstate_global->__pyx_n_u_e_u,&__pyx_mstate_global->__pyx_n_u_e_ulink,&__pyx_mstate_global->__pyx_n_u_v,&__pyx_mstate_global->__pyx_n_u_e_v,&__pyx_mstate_global->__pyx_n_u_e_vlink,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 389, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 6: values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 389, __pyx_L3_error) CYTHON_FALLTHROUGH; case 5: values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 389, __pyx_L3_error) CYTHON_FALLTHROUGH; case 4: values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 389, __pyx_L3_error) CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 389, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 389, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 389, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_InsertEdge", 0) < (0)) __PYX_ERR(0, 389, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 6; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_InsertEdge", 1, 6, 6, i); __PYX_ERR(0, 389, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 6)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 389, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 389, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 389, __pyx_L3_error) values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 389, __pyx_L3_error) values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 389, __pyx_L3_error) values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 389, __pyx_L3_error) } __pyx_v_u = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_u == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 389, __pyx_L3_error) __pyx_v_e_u = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_e_u == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 389, __pyx_L3_error) __pyx_v_e_ulink = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_e_ulink == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 389, __pyx_L3_error) __pyx_v_v = __Pyx_PyLong_As_int(values[3]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 389, __pyx_L3_error) __pyx_v_e_v = __Pyx_PyLong_As_int(values[4]); if (unlikely((__pyx_v_e_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 389, __pyx_L3_error) __pyx_v_e_vlink = __Pyx_PyLong_As_int(values[5]); if (unlikely((__pyx_v_e_vlink == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 389, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_InsertEdge", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 389, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_InsertEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_46gp_InsertEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_u, __pyx_v_e_u, __pyx_v_e_ulink, __pyx_v_v, __pyx_v_e_v, __pyx_v_e_vlink); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_46gp_InsertEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_e_u, int __pyx_v_e_ulink, int __pyx_v_v, int __pyx_v_e_v, int __pyx_v_e_vlink) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12[13]; PyObject *__pyx_t_13 = NULL; size_t __pyx_t_14; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_InsertEdge", 0); /* "planarity/full/graph.pyx":412 * """ * # Parameter validation is done by the C layer function * result = graphLib.gp_InsertEdge(self._theGraph, u, e_u, e_ulink, v, e_v, e_vlink) # <<<<<<<<<<<<<< * if result != OK and result != AT_EDGE_CAPACITY_LIMIT: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_InsertEdge(__pyx_v_self->_theGraph, __pyx_v_u, __pyx_v_e_u, __pyx_v_e_ulink, __pyx_v_v, __pyx_v_e_v, __pyx_v_e_vlink); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 412, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":413 * # Parameter validation is done by the C layer function * result = graphLib.gp_InsertEdge(self._theGraph, u, e_u, e_ulink, v, e_v, e_vlink) * if result != OK and result != AT_EDGE_CAPACITY_LIMIT: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_InsertEdge() failed: unable to insert edge (u, v) = " */ __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { } else { __pyx_t_2 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_AT_EDGE_CAPACITY_LIMIT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = __pyx_t_6; __pyx_L4_bool_binop_done:; if (unlikely(__pyx_t_2)) { /* "planarity/full/graph.pyx":414 * result = graphLib.gp_InsertEdge(self._theGraph, u, e_u, e_ulink, v, e_v, e_vlink) * if result != OK and result != AT_EDGE_CAPACITY_LIMIT: * raise RuntimeError( # <<<<<<<<<<<<<< * "gp_InsertEdge() failed: unable to insert edge (u, v) = " * f"({u}, {v}) adjacent to e_u = {e_u} by e_ulink = {e_ulink} in " */ __pyx_t_4 = NULL; /* "planarity/full/graph.pyx":416 * raise RuntimeError( * "gp_InsertEdge() failed: unable to insert edge (u, v) = " * f"({u}, {v}) adjacent to e_u = {e_u} by e_ulink = {e_ulink} in " # <<<<<<<<<<<<<< * f"u's adjacency list and adjacent to e_v = {e_v} by e_vlink = " * f"{e_vlink} in v's adjacency list." */ __pyx_t_5 = __Pyx_PyUnicode_From_int(__pyx_v_u, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 416, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 416, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyUnicode_From_int(__pyx_v_e_u, 0, ' ', 'd'); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 416, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = __Pyx_PyUnicode_From_int(__pyx_v_e_ulink, 0, ' ', 'd'); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 416, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); /* "planarity/full/graph.pyx":417 * "gp_InsertEdge() failed: unable to insert edge (u, v) = " * f"({u}, {v}) adjacent to e_u = {e_u} by e_ulink = {e_ulink} in " * f"u's adjacency list and adjacent to e_v = {e_v} by e_vlink = " # <<<<<<<<<<<<<< * f"{e_vlink} in v's adjacency list." * ) */ __pyx_t_10 = __Pyx_PyUnicode_From_int(__pyx_v_e_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 417, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); /* "planarity/full/graph.pyx":418 * f"({u}, {v}) adjacent to e_u = {e_u} by e_ulink = {e_ulink} in " * f"u's adjacency list and adjacent to e_v = {e_v} by e_vlink = " * f"{e_vlink} in v's adjacency list." # <<<<<<<<<<<<<< * ) * */ __pyx_t_11 = __Pyx_PyUnicode_From_int(__pyx_v_e_vlink, 0, ' ', 'd'); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 418, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_12[0] = __pyx_mstate_global->__pyx_kp_u_gp_InsertEdge_failed_unable_to_i; __pyx_t_12[1] = __pyx_t_5; __pyx_t_12[2] = __pyx_mstate_global->__pyx_kp_u__3; __pyx_t_12[3] = __pyx_t_7; __pyx_t_12[4] = __pyx_mstate_global->__pyx_kp_u_adjacent_to_e_u; __pyx_t_12[5] = __pyx_t_8; __pyx_t_12[6] = __pyx_mstate_global->__pyx_kp_u_by_e_ulink; __pyx_t_12[7] = __pyx_t_9; __pyx_t_12[8] = __pyx_mstate_global->__pyx_kp_u_in_u_s_adjacency_list_and_adjac; __pyx_t_12[9] = __pyx_t_10; __pyx_t_12[10] = __pyx_mstate_global->__pyx_kp_u_by_e_vlink; __pyx_t_12[11] = __pyx_t_11; __pyx_t_12[12] = __pyx_mstate_global->__pyx_kp_u_in_v_s_adjacency_list; /* "planarity/full/graph.pyx":415 * if result != OK and result != AT_EDGE_CAPACITY_LIMIT: * raise RuntimeError( * "gp_InsertEdge() failed: unable to insert edge (u, v) = " # <<<<<<<<<<<<<< * f"({u}, {v}) adjacent to e_u = {e_u} by e_ulink = {e_ulink} in " * f"u's adjacency list and adjacent to e_v = {e_v} by e_vlink = " */ __pyx_t_13 = __Pyx_PyUnicode_Join(__pyx_t_12, 13, 56 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7) + 20 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 14 * 2 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9) + 45 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_10) + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_11) + 23, 127); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 415, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_14 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_13}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_14, (2-__pyx_t_14) | (__pyx_t_14*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 414, __pyx_L1_error) /* "planarity/full/graph.pyx":413 * # Parameter validation is done by the C layer function * result = graphLib.gp_InsertEdge(self._theGraph, u, e_u, e_ulink, v, e_v, e_vlink) * if result != OK and result != AT_EDGE_CAPACITY_LIMIT: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_InsertEdge() failed: unable to insert edge (u, v) = " */ } /* "planarity/full/graph.pyx":421 * ) * * return result # <<<<<<<<<<<<<< * * def gp_DeleteEdge(self, int e) -> None: */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 421, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__Pyx_PyInt_FromNumber(&__pyx_t_3, NULL, 0) < (0)) __PYX_ERR(0, 421, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":389 * ) * * def gp_InsertEdge(self, int u, int e_u, int e_ulink, int v, int e_v, int e_vlink) -> int: # <<<<<<<<<<<<<< * """Insert edge between u and v in specific positions of adjacency lists. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_13); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_InsertEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":423 * return result * * def gp_DeleteEdge(self, int e) -> None: # <<<<<<<<<<<<<< * """Deletes edge with index e from the graph. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_49gp_DeleteEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_48gp_DeleteEdge, "Graph.gp_DeleteEdge(self, int e) -> None\n\nDeletes edge with index e from the graph.\n\nArgs:\n e: index of edge in graph to delete\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_49gp_DeleteEdge = {"gp_DeleteEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_49gp_DeleteEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_48gp_DeleteEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_49gp_DeleteEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_DeleteEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 423, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 423, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_DeleteEdge", 0) < (0)) __PYX_ERR(0, 423, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_DeleteEdge", 1, 1, 1, i); __PYX_ERR(0, 423, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 423, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 423, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_DeleteEdge", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 423, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DeleteEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_48gp_DeleteEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_48gp_DeleteEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; size_t __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_DeleteEdge", 0); /* "planarity/full/graph.pyx":433 * """ * # Parameter validation is done by the C layer function * result = graphLib.gp_DeleteEdge(self._theGraph, e) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_DeleteEdge(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 433, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":434 * # Parameter validation is done by the C layer function * result = graphLib.gp_DeleteEdge(self._theGraph, e) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_DeleteEdge() failed: unable to delete edge e = {e}" */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 434, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 434, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 434, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 434, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":435 * result = graphLib.gp_DeleteEdge(self._theGraph, e) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * f"gp_DeleteEdge() failed: unable to delete edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":436 * if result != OK: * raise RuntimeError( * f"gp_DeleteEdge() failed: unable to delete edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_DeleteEdge_failed_unable_to_d, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 436, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_7 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 435, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 435, __pyx_L1_error) /* "planarity/full/graph.pyx":434 * # Parameter validation is done by the C layer function * result = graphLib.gp_DeleteEdge(self._theGraph, e) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_DeleteEdge() failed: unable to delete edge e = {e}" */ } /* "planarity/full/graph.pyx":423 * return result * * def gp_DeleteEdge(self, int e) -> None: # <<<<<<<<<<<<<< * """Deletes edge with index e from the graph. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DeleteEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":439 * ) * * def gp_HideEdge(self, int e) -> None: # <<<<<<<<<<<<<< * """Hides edge with index e within the graph. The edge still exists * in edge storage but has been unhooked from the adjacency lists of */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_51gp_HideEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_50gp_HideEdge, "Graph.gp_HideEdge(self, int e) -> None\n\nHides edge with index e within the graph. The edge still exists\nin edge storage but has been unhooked from the adjacency lists of\nits endpoint vertices. See gp_RestoreEdge()\n\nArgs:\n e: index of edge in graph to hide"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_51gp_HideEdge = {"gp_HideEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_51gp_HideEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_50gp_HideEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_51gp_HideEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_HideEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 439, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 439, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_HideEdge", 0) < (0)) __PYX_ERR(0, 439, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_HideEdge", 1, 1, 1, i); __PYX_ERR(0, 439, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 439, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 439, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_HideEdge", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 439, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_HideEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_50gp_HideEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_50gp_HideEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_HideEdge", 0); /* "planarity/full/graph.pyx":448 * """ * # Parameter validation is done by the C layer function * graphLib.gp_HideEdge(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_RestoreEdge(self, int e) -> None: */ __pyx_f_9planarity_4full_8graphLib_gp_HideEdge(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 448, __pyx_L1_error) /* "planarity/full/graph.pyx":439 * ) * * def gp_HideEdge(self, int e) -> None: # <<<<<<<<<<<<<< * """Hides edge with index e within the graph. The edge still exists * in edge storage but has been unhooked from the adjacency lists of */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("planarity.full.graph.Graph.gp_HideEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":450 * graphLib.gp_HideEdge(self._theGraph, e) * * def gp_RestoreEdge(self, int e) -> None: # <<<<<<<<<<<<<< * """Restore edge to adjacency lists from which it was previously hidden. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_53gp_RestoreEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_52gp_RestoreEdge, "Graph.gp_RestoreEdge(self, int e) -> None\n\nRestore edge to adjacency lists from which it was previously hidden.\n\nArgs:\n e: index of edge in graph to restore"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_53gp_RestoreEdge = {"gp_RestoreEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_53gp_RestoreEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_52gp_RestoreEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_53gp_RestoreEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_RestoreEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 450, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 450, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_RestoreEdge", 0) < (0)) __PYX_ERR(0, 450, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_RestoreEdge", 1, 1, 1, i); __PYX_ERR(0, 450, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 450, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 450, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_RestoreEdge", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 450, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_RestoreEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_52gp_RestoreEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_52gp_RestoreEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_RestoreEdge", 0); /* "planarity/full/graph.pyx":457 * """ * # Parameter validation is done by the C layer function * graphLib.gp_RestoreEdge(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_HideVertex(self, int vertex) -> None: */ __pyx_f_9planarity_4full_8graphLib_gp_RestoreEdge(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 457, __pyx_L1_error) /* "planarity/full/graph.pyx":450 * graphLib.gp_HideEdge(self._theGraph, e) * * def gp_RestoreEdge(self, int e) -> None: # <<<<<<<<<<<<<< * """Restore edge to adjacency lists from which it was previously hidden. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("planarity.full.graph.Graph.gp_RestoreEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":459 * graphLib.gp_RestoreEdge(self._theGraph, e) * * def gp_HideVertex(self, int vertex) -> None: # <<<<<<<<<<<<<< * """Hides vertex within the graph by hiding its edges and storing * additional internal information that enables the vertex to be */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_55gp_HideVertex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_54gp_HideVertex, "Graph.gp_HideVertex(self, int vertex) -> None\n\nHides vertex within the graph by hiding its edges and storing \nadditional internal information that enables the vertex to be \nrestored by gp_RestoreVertex() if and only if vertices are \nrestored in the exact opposite order in which they were hidden.\n\nArgs:\n vertex: index of vertex in graph to hide\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_55gp_HideVertex = {"gp_HideVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_55gp_HideVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_54gp_HideVertex}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_55gp_HideVertex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_vertex; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_HideVertex (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_vertex,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 459, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 459, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_HideVertex", 0) < (0)) __PYX_ERR(0, 459, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_HideVertex", 1, 1, 1, i); __PYX_ERR(0, 459, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 459, __pyx_L3_error) } __pyx_v_vertex = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_vertex == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 459, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_HideVertex", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 459, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_HideVertex", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_54gp_HideVertex(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_vertex); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_54gp_HideVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_vertex) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; PyObject *__pyx_t_6[3]; PyObject *__pyx_t_7 = NULL; size_t __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_HideVertex", 0); /* "planarity/full/graph.pyx":472 * """ * # Parameter validation is done by the C layer function * result = graphLib.gp_HideVertex(self._theGraph, vertex) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_HideVertex(__pyx_v_self->_theGraph, __pyx_v_vertex); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 472, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":473 * # Parameter validation is done by the C layer function * result = graphLib.gp_HideVertex(self._theGraph, vertex) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_HideVertex() failed: unable to hide vertex {vertex}." */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 473, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":474 * result = graphLib.gp_HideVertex(self._theGraph, vertex) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * f"gp_HideVertex() failed: unable to hide vertex {vertex}." * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":475 * if result != OK: * raise RuntimeError( * f"gp_HideVertex() failed: unable to hide vertex {vertex}." # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_vertex, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6[0] = __pyx_mstate_global->__pyx_kp_u_gp_HideVertex_failed_unable_to_h; __pyx_t_6[1] = __pyx_t_2; __pyx_t_6[2] = __pyx_mstate_global->__pyx_kp_u_; __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_6, 3, 46 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 1, 127); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_8 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 474, __pyx_L1_error) /* "planarity/full/graph.pyx":473 * # Parameter validation is done by the C layer function * result = graphLib.gp_HideVertex(self._theGraph, vertex) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_HideVertex() failed: unable to hide vertex {vertex}." */ } /* "planarity/full/graph.pyx":459 * graphLib.gp_RestoreEdge(self._theGraph, e) * * def gp_HideVertex(self, int vertex) -> None: # <<<<<<<<<<<<<< * """Hides vertex within the graph by hiding its edges and storing * additional internal information that enables the vertex to be */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_HideVertex", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":478 * ) * * def gp_RestoreVertex(self) -> None: # <<<<<<<<<<<<<< * """Restore the last vertex hidden by gp_HideVertex(). If the vertex was * hidden as part of an edge contraction or vertex identification, then its */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_57gp_RestoreVertex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_56gp_RestoreVertex, "Graph.gp_RestoreVertex(self) -> None\n\nRestore the last vertex hidden by gp_HideVertex(). If the vertex was\nhidden as part of an edge contraction or vertex identification, then its\nadjacency list is extricated from the vertex with which it was merged.\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_57gp_RestoreVertex = {"gp_RestoreVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_57gp_RestoreVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_56gp_RestoreVertex}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_57gp_RestoreVertex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_RestoreVertex (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_RestoreVertex", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_RestoreVertex", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_56gp_RestoreVertex(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_56gp_RestoreVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_RestoreVertex", 0); /* "planarity/full/graph.pyx":487 * """ * # Parameter validation is done by the C layer function * result = graphLib.gp_RestoreVertex(self._theGraph) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_RestoreVertex(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 487, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":488 * # Parameter validation is done by the C layer function * result = graphLib.gp_RestoreVertex(self._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_RestoreVertex() failed: unable to restore vertex." */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 488, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":489 * result = graphLib.gp_RestoreVertex(self._theGraph) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * f"gp_RestoreVertex() failed: unable to restore vertex." * ) */ __pyx_t_3 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_gp_RestoreVertex_failed_unable_t}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 489, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 489, __pyx_L1_error) /* "planarity/full/graph.pyx":488 * # Parameter validation is done by the C layer function * result = graphLib.gp_RestoreVertex(self._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_RestoreVertex() failed: unable to restore vertex." */ } /* "planarity/full/graph.pyx":478 * ) * * def gp_RestoreVertex(self) -> None: # <<<<<<<<<<<<<< * """Restore the last vertex hidden by gp_HideVertex(). If the vertex was * hidden as part of an edge contraction or vertex identification, then its */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_RestoreVertex", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":493 * ) * * def gp_ContractEdge(self, int e) -> None: # <<<<<<<<<<<<<< * """Contracts the edge e = (u, v) by hiding e and identifying v with u. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_59gp_ContractEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_58gp_ContractEdge, "Graph.gp_ContractEdge(self, int e) -> None\n\nContracts the edge e = (u, v) by hiding e and identifying v with u.\n\nArgs:\n e: index of edge in graph to contract\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_59gp_ContractEdge = {"gp_ContractEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_59gp_ContractEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_58gp_ContractEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_59gp_ContractEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ContractEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 493, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 493, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_ContractEdge", 0) < (0)) __PYX_ERR(0, 493, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_ContractEdge", 1, 1, 1, i); __PYX_ERR(0, 493, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 493, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 493, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_ContractEdge", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 493, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ContractEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_58gp_ContractEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_58gp_ContractEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; size_t __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_ContractEdge", 0); /* "planarity/full/graph.pyx":503 * """ * # Parameter validation is done by the C layer function * result = graphLib.gp_ContractEdge(self._theGraph, e) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_ContractEdge(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 503, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":504 * # Parameter validation is done by the C layer function * result = graphLib.gp_ContractEdge(self._theGraph, e) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_ContractEdge() failed: unable to contract edge e = {e}" */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 504, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 504, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 504, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 504, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":505 * result = graphLib.gp_ContractEdge(self._theGraph, e) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * f"gp_ContractEdge() failed: unable to contract edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":506 * if result != OK: * raise RuntimeError( * f"gp_ContractEdge() failed: unable to contract edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_ContractEdge_failed_unable_to, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_7 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 505, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 505, __pyx_L1_error) /* "planarity/full/graph.pyx":504 * # Parameter validation is done by the C layer function * result = graphLib.gp_ContractEdge(self._theGraph, e) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_ContractEdge() failed: unable to contract edge e = {e}" */ } /* "planarity/full/graph.pyx":493 * ) * * def gp_ContractEdge(self, int e) -> None: # <<<<<<<<<<<<<< * """Contracts the edge e = (u, v) by hiding e and identifying v with u. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ContractEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":509 * ) * * def gp_IdentifyVertices(self, int u, int v, int eBefore) -> None: # <<<<<<<<<<<<<< * """Identify vertex v with u by transferring all adjacencies from v to u. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_61gp_IdentifyVertices(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_60gp_IdentifyVertices, "Graph.gp_IdentifyVertices(self, int u, int v, int eBefore) -> None\n\nIdentify vertex v with u by transferring all adjacencies from v to u.\n\nArgs:\n u: index of vertex in graph to which v will be identified\n v: index of vertex in graph to identify with u\n eBefore: the index in u's adjacency list before which v's adjacencies\n should be inserted, or NIL to append the edges to u's list\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_61gp_IdentifyVertices = {"gp_IdentifyVertices", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_61gp_IdentifyVertices, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_60gp_IdentifyVertices}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_61gp_IdentifyVertices(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_u; int __pyx_v_v; int __pyx_v_eBefore; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_IdentifyVertices (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_u,&__pyx_mstate_global->__pyx_n_u_v,&__pyx_mstate_global->__pyx_n_u_eBefore,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 509, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 509, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 509, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 509, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_IdentifyVertices", 0) < (0)) __PYX_ERR(0, 509, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_IdentifyVertices", 1, 3, 3, i); __PYX_ERR(0, 509, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 3)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 509, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 509, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 509, __pyx_L3_error) } __pyx_v_u = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_u == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 509, __pyx_L3_error) __pyx_v_v = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 509, __pyx_L3_error) __pyx_v_eBefore = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_eBefore == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 509, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_IdentifyVertices", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 509, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IdentifyVertices", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_60gp_IdentifyVertices(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_u, __pyx_v_v, __pyx_v_eBefore); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_60gp_IdentifyVertices(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_u, int __pyx_v_v, int __pyx_v_eBefore) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7[4]; PyObject *__pyx_t_8 = NULL; size_t __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_IdentifyVertices", 0); /* "planarity/full/graph.pyx":522 * """ * # Parameter validation is done by the C layer function * result = graphLib.gp_IdentifyVertices(self._theGraph, u, v, eBefore) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_IdentifyVertices(__pyx_v_self->_theGraph, __pyx_v_u, __pyx_v_v, __pyx_v_eBefore); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 522, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":523 * # Parameter validation is done by the C layer function * result = graphLib.gp_IdentifyVertices(self._theGraph, u, v, eBefore) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_IdentifyVertices() failed: unable to identify v = {v} " */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 523, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":524 * result = graphLib.gp_IdentifyVertices(self._theGraph, u, v, eBefore) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * f"gp_IdentifyVertices() failed: unable to identify v = {v} " * f"with u = {u}" */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":525 * if result != OK: * raise RuntimeError( * f"gp_IdentifyVertices() failed: unable to identify v = {v} " # <<<<<<<<<<<<<< * f"with u = {u}" * ) */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 525, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); /* "planarity/full/graph.pyx":526 * raise RuntimeError( * f"gp_IdentifyVertices() failed: unable to identify v = {v} " * f"with u = {u}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_u, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 526, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_gp_IdentifyVertices_failed_unabl; __pyx_t_7[1] = __pyx_t_2; __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u_with_u; __pyx_t_7[3] = __pyx_t_6; /* "planarity/full/graph.pyx":525 * if result != OK: * raise RuntimeError( * f"gp_IdentifyVertices() failed: unable to identify v = {v} " # <<<<<<<<<<<<<< * f"with u = {u}" * ) */ __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 4, 53 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 10 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6), 127); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 525, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_9 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_8}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 524, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 524, __pyx_L1_error) /* "planarity/full/graph.pyx":523 * # Parameter validation is done by the C layer function * result = graphLib.gp_IdentifyVertices(self._theGraph, u, v, eBefore) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_IdentifyVertices() failed: unable to identify v = {v} " */ } /* "planarity/full/graph.pyx":509 * ) * * def gp_IdentifyVertices(self, int u, int v, int eBefore) -> None: # <<<<<<<<<<<<<< * """Identify vertex v with u by transferring all adjacencies from v to u. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IdentifyVertices", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":529 * ) * * def gp_RestoreVertices(self) -> None: # <<<<<<<<<<<<<< * """Restores all vertices hidden during a series of hide vertex, * edge contraction or vertex identification operations. */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_63gp_RestoreVertices(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_62gp_RestoreVertices, "Graph.gp_RestoreVertices(self) -> None\n\nRestores all vertices hidden during a series of hide vertex, \nedge contraction or vertex identification operations.\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_63gp_RestoreVertices = {"gp_RestoreVertices", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_63gp_RestoreVertices, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_62gp_RestoreVertices}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_63gp_RestoreVertices(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_RestoreVertices (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_RestoreVertices", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_RestoreVertices", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_62gp_RestoreVertices(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_62gp_RestoreVertices(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_RestoreVertices", 0); /* "planarity/full/graph.pyx":537 * """ * # Parameter validation is done by the C layer function * result = graphLib.gp_RestoreVertices(self._theGraph) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_RestoreVertices(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 537, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":538 * # Parameter validation is done by the C layer function * result = graphLib.gp_RestoreVertices(self._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_RestoreVertices() failed: unable to restores all vertices " */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":539 * result = graphLib.gp_RestoreVertices(self._theGraph) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "gp_RestoreVertices() failed: unable to restores all vertices " * "hidden during an edge contraction or vertex identification." */ __pyx_t_3 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_gp_RestoreVertices_failed_unable}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 539, __pyx_L1_error) /* "planarity/full/graph.pyx":538 * # Parameter validation is done by the C layer function * result = graphLib.gp_RestoreVertices(self._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_RestoreVertices() failed: unable to restores all vertices " */ } /* "planarity/full/graph.pyx":529 * ) * * def gp_RestoreVertices(self) -> None: # <<<<<<<<<<<<<< * """Restores all vertices hidden during a series of hide vertex, * edge contraction or vertex identification operations. */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_RestoreVertices", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":544 * ) * * def gp_GetGraphFlags(self) -> int: # <<<<<<<<<<<<<< * """Returns flags set on the Graph's graphP * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_65gp_GetGraphFlags(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_64gp_GetGraphFlags, "Graph.gp_GetGraphFlags(self) -> int\n\nReturns flags set on the Graph's graphP\n\nReturns:\n An integer representing the flags set on the graphP"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_65gp_GetGraphFlags = {"gp_GetGraphFlags", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_65gp_GetGraphFlags, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_64gp_GetGraphFlags}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_65gp_GetGraphFlags(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetGraphFlags (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_GetGraphFlags", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_GetGraphFlags", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_64gp_GetGraphFlags(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_64gp_GetGraphFlags(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetGraphFlags", 0); /* "planarity/full/graph.pyx":550 * An integer representing the flags set on the graphP * """ * return graphLib.gp_GetGraphFlags(self._theGraph) # <<<<<<<<<<<<<< * * def gp_GetFirstEdge(self, int v) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_GetGraphFlags(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 550, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 550, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":544 * ) * * def gp_GetGraphFlags(self) -> int: # <<<<<<<<<<<<<< * """Returns flags set on the Graph's graphP * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetGraphFlags", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":552 * return graphLib.gp_GetGraphFlags(self._theGraph) * * def gp_GetFirstEdge(self, int v) -> int: # <<<<<<<<<<<<<< * """Get index of first edge incident to vertex v. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_67gp_GetFirstEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_66gp_GetFirstEdge, "Graph.gp_GetFirstEdge(self, int v) -> int\n\nGet index of first edge incident to vertex v.\n\nArgs:\n v: index of a vertex in the graph\n\nReturns:\n The index of the first edge in v's adjacency list\n\nRaises:\n ValueError if v is not a valid vertex index"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_67gp_GetFirstEdge = {"gp_GetFirstEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_67gp_GetFirstEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_66gp_GetFirstEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_67gp_GetFirstEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetFirstEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 552, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 552, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetFirstEdge", 0) < (0)) __PYX_ERR(0, 552, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetFirstEdge", 1, 1, 1, i); __PYX_ERR(0, 552, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 552, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 552, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetFirstEdge", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 552, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetFirstEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_66gp_GetFirstEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_66gp_GetFirstEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8[3]; PyObject *__pyx_t_9 = NULL; int __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetFirstEdge", 0); /* "planarity/full/graph.pyx":564 * ValueError if v is not a valid vertex index * """ * if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetFirstEdge() failed: invalid vertex index '{v}'." */ __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 564, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_7 = (!__pyx_t_6); if (__pyx_t_7) { } else { __pyx_t_1 = __pyx_t_7; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 564, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = (!__pyx_t_7); __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; if (unlikely(__pyx_t_1)) { /* "planarity/full/graph.pyx":565 * """ * if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetFirstEdge() failed: invalid vertex index '{v}'." * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":566 * if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): * raise ValueError( * f"gp_GetFirstEdge() failed: invalid vertex index '{v}'." # <<<<<<<<<<<<<< * ) * */ __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 566, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_gp_GetFirstEdge_failed_invalid_v; __pyx_t_8[1] = __pyx_t_4; __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u__2; __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_8, 3, 48 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4) + 2, 127); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 566, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_9}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 565, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 565, __pyx_L1_error) /* "planarity/full/graph.pyx":564 * ValueError if v is not a valid vertex index * """ * if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetFirstEdge() failed: invalid vertex index '{v}'." */ } /* "planarity/full/graph.pyx":569 * ) * * return graphLib.gp_GetFirstEdge(self._theGraph, v) # <<<<<<<<<<<<<< * * def gp_GetLastEdge(self, int v) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_10 = __pyx_f_9planarity_4full_8graphLib_gp_GetFirstEdge(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 569, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 569, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 569, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":552 * return graphLib.gp_GetGraphFlags(self._theGraph) * * def gp_GetFirstEdge(self, int v) -> int: # <<<<<<<<<<<<<< * """Get index of first edge incident to vertex v. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetFirstEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":571 * return graphLib.gp_GetFirstEdge(self._theGraph, v) * * def gp_GetLastEdge(self, int v) -> int: # <<<<<<<<<<<<<< * """Get index of last edge incident to vertex v. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_69gp_GetLastEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_68gp_GetLastEdge, "Graph.gp_GetLastEdge(self, int v) -> int\n\nGet index of last edge incident to vertex v.\n\nArgs:\n v: index of a vertex in the graph\n\nReturns:\n The index of the last edge in v's adjacency list\n\nRaises:\n ValueError if v is not a valid vertex index"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_69gp_GetLastEdge = {"gp_GetLastEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_69gp_GetLastEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_68gp_GetLastEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_69gp_GetLastEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetLastEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 571, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 571, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetLastEdge", 0) < (0)) __PYX_ERR(0, 571, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetLastEdge", 1, 1, 1, i); __PYX_ERR(0, 571, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 571, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 571, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetLastEdge", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 571, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetLastEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_68gp_GetLastEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_68gp_GetLastEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; int __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetLastEdge", 0); /* "planarity/full/graph.pyx":583 * ValueError if v is not a valid vertex index * """ * if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetLastEdge() failed: invalid vertex index v = {v}" */ __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 583, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 583, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 583, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_7 = (!__pyx_t_6); if (__pyx_t_7) { } else { __pyx_t_1 = __pyx_t_7; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 583, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 583, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 583, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = (!__pyx_t_7); __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; if (unlikely(__pyx_t_1)) { /* "planarity/full/graph.pyx":584 * """ * if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetLastEdge() failed: invalid vertex index v = {v}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":585 * if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): * raise ValueError( * f"gp_GetLastEdge() failed: invalid vertex index v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 585, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetLastEdge_failed_invalid_ve, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 585, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_8}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 584, __pyx_L1_error) /* "planarity/full/graph.pyx":583 * ValueError if v is not a valid vertex index * """ * if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetLastEdge() failed: invalid vertex index v = {v}" */ } /* "planarity/full/graph.pyx":588 * ) * * return graphLib.gp_GetLastEdge(self._theGraph, v) # <<<<<<<<<<<<<< * * def gp_GetEdgeByLink(self, int v, int theLink) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_9 = __pyx_f_9planarity_4full_8graphLib_gp_GetLastEdge(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 588, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 588, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 588, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":571 * return graphLib.gp_GetFirstEdge(self._theGraph, v) * * def gp_GetLastEdge(self, int v) -> int: # <<<<<<<<<<<<<< * """Get index of last edge incident to vertex v. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetLastEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":590 * return graphLib.gp_GetLastEdge(self._theGraph, v) * * def gp_GetEdgeByLink(self, int v, int theLink) -> int: # <<<<<<<<<<<<<< * """Get the first or last edge in the adjacency list of v, indicated by theLink * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_71gp_GetEdgeByLink(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_70gp_GetEdgeByLink, "Graph.gp_GetEdgeByLink(self, int v, int theLink) -> int\n\nGet the first or last edge in the adjacency list of v, indicated by theLink\n\nArgs:\n v: index of a vertex in the graph\n theLink: the direction of adjacency for the edge to return, either\n first (0) or last (1)\n\nReturns:\n The index of the first or last edge in V's adjacency list \n\nRaises:\n ValueError if v is not a valid vertex index or theLink is an\n invalid direction indicator (0 or 1)"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_71gp_GetEdgeByLink = {"gp_GetEdgeByLink", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_71gp_GetEdgeByLink, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_70gp_GetEdgeByLink}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_71gp_GetEdgeByLink(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; int __pyx_v_theLink; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetEdgeByLink (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,&__pyx_mstate_global->__pyx_n_u_theLink,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 590, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 590, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 590, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetEdgeByLink", 0) < (0)) __PYX_ERR(0, 590, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetEdgeByLink", 1, 2, 2, i); __PYX_ERR(0, 590, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 590, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 590, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 590, __pyx_L3_error) __pyx_v_theLink = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_theLink == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 590, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetEdgeByLink", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 590, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetEdgeByLink", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_70gp_GetEdgeByLink(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v, __pyx_v_theLink); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_70gp_GetEdgeByLink(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v, int __pyx_v_theLink) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; int __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetEdgeByLink", 0); /* "planarity/full/graph.pyx":605 * invalid direction indicator (0 or 1) * """ * if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetEdgeByLink() failed: invalid vertex index v = {v}" */ __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 605, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 605, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 605, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_7 = (!__pyx_t_6); if (__pyx_t_7) { } else { __pyx_t_1 = __pyx_t_7; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 605, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 605, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 605, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = (!__pyx_t_7); __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; if (unlikely(__pyx_t_1)) { /* "planarity/full/graph.pyx":606 * """ * if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetEdgeByLink() failed: invalid vertex index v = {v}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":607 * if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): * raise ValueError( * f"gp_GetEdgeByLink() failed: invalid vertex index v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 607, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetEdgeByLink_failed_invalid, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 607, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_8}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 606, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 606, __pyx_L1_error) /* "planarity/full/graph.pyx":605 * invalid direction indicator (0 or 1) * """ * if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetEdgeByLink() failed: invalid vertex index v = {v}" */ } /* "planarity/full/graph.pyx":610 * ) * * if theLink != 0 and theLink != 1: # <<<<<<<<<<<<<< * raise ValueError( * "gp_GetEdgeByLink() failed: invalid value for theLink = " */ switch (__pyx_v_theLink) { case 0: case 1: __pyx_t_1 = 0; break; default: __pyx_t_1 = 1; break; } if (unlikely(__pyx_t_1)) { /* "planarity/full/graph.pyx":611 * * if theLink != 0 and theLink != 1: * raise ValueError( # <<<<<<<<<<<<<< * "gp_GetEdgeByLink() failed: invalid value for theLink = " * f"{theLink}" */ __pyx_t_8 = NULL; /* "planarity/full/graph.pyx":613 * raise ValueError( * "gp_GetEdgeByLink() failed: invalid value for theLink = " * f"{theLink}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_theLink, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 613, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* "planarity/full/graph.pyx":612 * if theLink != 0 and theLink != 1: * raise ValueError( * "gp_GetEdgeByLink() failed: invalid value for theLink = " # <<<<<<<<<<<<<< * f"{theLink}" * ) */ __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetEdgeByLink_failed_invalid_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 611, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 611, __pyx_L1_error) /* "planarity/full/graph.pyx":610 * ) * * if theLink != 0 and theLink != 1: # <<<<<<<<<<<<<< * raise ValueError( * "gp_GetEdgeByLink() failed: invalid value for theLink = " */ } /* "planarity/full/graph.pyx":616 * ) * * return graphLib.gp_GetEdgeByLink(self._theGraph, v, theLink) # <<<<<<<<<<<<<< * * def gp_SetFirstEdge(self, int v, int newFirstEdge) -> None: */ __Pyx_XDECREF(__pyx_r); __pyx_t_9 = __pyx_f_9planarity_4full_8graphLib_gp_GetEdgeByLink(__pyx_v_self->_theGraph, __pyx_v_v, __pyx_v_theLink); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 616, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 616, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 616, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":590 * return graphLib.gp_GetLastEdge(self._theGraph, v) * * def gp_GetEdgeByLink(self, int v, int theLink) -> int: # <<<<<<<<<<<<<< * """Get the first or last edge in the adjacency list of v, indicated by theLink * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetEdgeByLink", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":618 * return graphLib.gp_GetEdgeByLink(self._theGraph, v, theLink) * * def gp_SetFirstEdge(self, int v, int newFirstEdge) -> None: # <<<<<<<<<<<<<< * """Sets the first edge in v's adjacency list to newFirstEdge * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_73gp_SetFirstEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_72gp_SetFirstEdge, "Graph.gp_SetFirstEdge(self, int v, int newFirstEdge) -> None\n\nSets the first edge in v's adjacency list to newFirstEdge\n\nArgs:\n v: index of a vertex in the graph\n newFirstEdge: the index of an edge to set as the first edge \n in v's adjacency list\n\nRaises:\n ValueError for invalid vertex v or edge newFirstEdge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_73gp_SetFirstEdge = {"gp_SetFirstEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_73gp_SetFirstEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_72gp_SetFirstEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_73gp_SetFirstEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; int __pyx_v_newFirstEdge; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_SetFirstEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,&__pyx_mstate_global->__pyx_n_u_newFirstEdge,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 618, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 618, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 618, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_SetFirstEdge", 0) < (0)) __PYX_ERR(0, 618, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_SetFirstEdge", 1, 2, 2, i); __PYX_ERR(0, 618, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 618, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 618, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 618, __pyx_L3_error) __pyx_v_newFirstEdge = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_newFirstEdge == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 618, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_SetFirstEdge", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 618, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetFirstEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_72gp_SetFirstEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v, __pyx_v_newFirstEdge); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_72gp_SetFirstEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v, int __pyx_v_newFirstEdge) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9[3]; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_SetFirstEdge", 0); /* "planarity/full/graph.pyx":629 * ValueError for invalid vertex v or edge newFirstEdge * """ * if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetFirstEdge() failed: invalid vertex index v = {v}" */ __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 629, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 629, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 629, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_7 = (!__pyx_t_6); if (__pyx_t_7) { } else { __pyx_t_1 = __pyx_t_7; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 629, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 629, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 629, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = (!__pyx_t_7); __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; if (unlikely(__pyx_t_1)) { /* "planarity/full/graph.pyx":630 * """ * if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetFirstEdge() failed: invalid vertex index v = {v}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":631 * if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): * raise ValueError( * f"gp_SetFirstEdge() failed: invalid vertex index v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 631, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetFirstEdge_failed_invalid_v, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 631, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_8}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 630, __pyx_L1_error) /* "planarity/full/graph.pyx":629 * ValueError for invalid vertex v or edge newFirstEdge * """ * if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetFirstEdge() failed: invalid vertex index v = {v}" */ } /* "planarity/full/graph.pyx":634 * ) * * if self.gp_IsNotEdge(newFirstEdge) or self.gp_EdgeNotInUse(newFirstEdge): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetFirstEdge() failed: newFirstEdge = {newFirstEdge} " */ __pyx_t_8 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_8); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_newFirstEdge); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_3}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsNotEdge, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L7_bool_binop_done; } __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = __Pyx_PyLong_From_int(__pyx_v_newFirstEdge); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_8}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeNotInUse, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 634, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_6; __pyx_L7_bool_binop_done:; if (unlikely(__pyx_t_1)) { /* "planarity/full/graph.pyx":635 * * if self.gp_IsNotEdge(newFirstEdge) or self.gp_EdgeNotInUse(newFirstEdge): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetFirstEdge() failed: newFirstEdge = {newFirstEdge} " * "is not a valid edge index." */ __pyx_t_8 = NULL; /* "planarity/full/graph.pyx":636 * if self.gp_IsNotEdge(newFirstEdge) or self.gp_EdgeNotInUse(newFirstEdge): * raise ValueError( * f"gp_SetFirstEdge() failed: newFirstEdge = {newFirstEdge} " # <<<<<<<<<<<<<< * "is not a valid edge index." * ) */ __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_newFirstEdge, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 636, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_9[0] = __pyx_mstate_global->__pyx_kp_u_gp_SetFirstEdge_failed_newFirstE; __pyx_t_9[1] = __pyx_t_3; __pyx_t_9[2] = __pyx_mstate_global->__pyx_kp_u_is_not_a_valid_edge_index; __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_9, 3, 41 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 27, 127); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 636, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 635, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 635, __pyx_L1_error) /* "planarity/full/graph.pyx":634 * ) * * if self.gp_IsNotEdge(newFirstEdge) or self.gp_EdgeNotInUse(newFirstEdge): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetFirstEdge() failed: newFirstEdge = {newFirstEdge} " */ } /* "planarity/full/graph.pyx":640 * ) * * graphLib.gp_SetFirstEdge(self._theGraph, v, newFirstEdge) # <<<<<<<<<<<<<< * * def gp_SetLastEdge(self, int v, int newLastEdge) -> None: */ __pyx_f_9planarity_4full_8graphLib_gp_SetFirstEdge(__pyx_v_self->_theGraph, __pyx_v_v, __pyx_v_newFirstEdge); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L1_error) /* "planarity/full/graph.pyx":618 * return graphLib.gp_GetEdgeByLink(self._theGraph, v, theLink) * * def gp_SetFirstEdge(self, int v, int newFirstEdge) -> None: # <<<<<<<<<<<<<< * """Sets the first edge in v's adjacency list to newFirstEdge * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetFirstEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":642 * graphLib.gp_SetFirstEdge(self._theGraph, v, newFirstEdge) * * def gp_SetLastEdge(self, int v, int newLastEdge) -> None: # <<<<<<<<<<<<<< * """Sets the last edge in v's adjacency list to newLastEdge. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_75gp_SetLastEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_74gp_SetLastEdge, "Graph.gp_SetLastEdge(self, int v, int newLastEdge) -> None\n\nSets the last edge in v's adjacency list to newLastEdge.\n\nArgs:\n v: index of vertex in graph for which you wish to set the last edge\n in its adjacency list\n newLastEdge: the index of an edge in the edge array that you wish\n to set as the last edge in v's adjacency list\n\nRaises:\n ValueError for invalid vertex v or edge newLastEdge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_75gp_SetLastEdge = {"gp_SetLastEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_75gp_SetLastEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_74gp_SetLastEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_75gp_SetLastEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; int __pyx_v_newLastEdge; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_SetLastEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,&__pyx_mstate_global->__pyx_n_u_newLastEdge,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 642, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 642, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 642, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_SetLastEdge", 0) < (0)) __PYX_ERR(0, 642, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_SetLastEdge", 1, 2, 2, i); __PYX_ERR(0, 642, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 642, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 642, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 642, __pyx_L3_error) __pyx_v_newLastEdge = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_newLastEdge == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 642, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_SetLastEdge", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 642, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetLastEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_74gp_SetLastEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v, __pyx_v_newLastEdge); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_74gp_SetLastEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v, int __pyx_v_newLastEdge) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8[3]; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_SetLastEdge", 0); /* "planarity/full/graph.pyx":654 * ValueError for invalid vertex v or edge newLastEdge * """ * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetLastEdge() failed: invalid vertex index v = {v}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 654, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 654, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 654, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":655 * """ * if not self.gp_IsVertex(v): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetLastEdge() failed: invalid vertex index v = {v}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":656 * if not self.gp_IsVertex(v): * raise ValueError( * f"gp_SetLastEdge() failed: invalid vertex index v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 656, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetLastEdge_failed_invalid_ve, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 656, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 655, __pyx_L1_error) /* "planarity/full/graph.pyx":654 * ValueError for invalid vertex v or edge newLastEdge * """ * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetLastEdge() failed: invalid vertex index v = {v}" */ } /* "planarity/full/graph.pyx":659 * ) * * if self.gp_IsNotEdge(newLastEdge) or self.gp_EdgeNotInUse(newLastEdge): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetLastEdge() failed: newLastEdge = {newLastEdge} " */ __pyx_t_7 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_7); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_newLastEdge); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsNotEdge, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_newLastEdge); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeNotInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = __pyx_t_5; __pyx_L5_bool_binop_done:; if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":660 * * if self.gp_IsNotEdge(newLastEdge) or self.gp_EdgeNotInUse(newLastEdge): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetLastEdge() failed: newLastEdge = {newLastEdge} " * "is not a valid edge index." */ __pyx_t_7 = NULL; /* "planarity/full/graph.pyx":661 * if self.gp_IsNotEdge(newLastEdge) or self.gp_EdgeNotInUse(newLastEdge): * raise ValueError( * f"gp_SetLastEdge() failed: newLastEdge = {newLastEdge} " # <<<<<<<<<<<<<< * "is not a valid edge index." * ) */ __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_newLastEdge, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 661, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_gp_SetLastEdge_failed_newLastEdg; __pyx_t_8[1] = __pyx_t_3; __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u_is_not_a_valid_edge_index; __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_8, 3, 39 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 27, 127); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 661, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_2}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 660, __pyx_L1_error) /* "planarity/full/graph.pyx":659 * ) * * if self.gp_IsNotEdge(newLastEdge) or self.gp_EdgeNotInUse(newLastEdge): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetLastEdge() failed: newLastEdge = {newLastEdge} " */ } /* "planarity/full/graph.pyx":665 * ) * * graphLib.gp_SetLastEdge(self._theGraph, v, newLastEdge) # <<<<<<<<<<<<<< * * def gp_SetEdgeByLink(self, int v, int theLink, int newEdge) -> None: */ __pyx_f_9planarity_4full_8graphLib_gp_SetLastEdge(__pyx_v_self->_theGraph, __pyx_v_v, __pyx_v_newLastEdge); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 665, __pyx_L1_error) /* "planarity/full/graph.pyx":642 * graphLib.gp_SetFirstEdge(self._theGraph, v, newFirstEdge) * * def gp_SetLastEdge(self, int v, int newLastEdge) -> None: # <<<<<<<<<<<<<< * """Sets the last edge in v's adjacency list to newLastEdge. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetLastEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":667 * graphLib.gp_SetLastEdge(self._theGraph, v, newLastEdge) * * def gp_SetEdgeByLink(self, int v, int theLink, int newEdge) -> None: # <<<<<<<<<<<<<< * """Set the first or last edge in v's adjacency list, indicated by theLink. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_77gp_SetEdgeByLink(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_76gp_SetEdgeByLink, "Graph.gp_SetEdgeByLink(self, int v, int theLink, int newEdge) -> None\n\nSet the first or last edge in v's adjacency list, indicated by theLink.\n\nArgs:\n v: index of a vertex in the graph\n theLink: the direction of adjacency for which edge to set, either\n first (0) or last (1)\n newEdge: the index of an edge to set as the first or last edge\n in v's adjacency list\n\nRaises:\n ValueError if v is not a valid vertex, if theLink is not 0 nor 1, or\n invalid newEdge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_77gp_SetEdgeByLink = {"gp_SetEdgeByLink", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_77gp_SetEdgeByLink, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_76gp_SetEdgeByLink}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_77gp_SetEdgeByLink(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; int __pyx_v_theLink; int __pyx_v_newEdge; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_SetEdgeByLink (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,&__pyx_mstate_global->__pyx_n_u_theLink,&__pyx_mstate_global->__pyx_n_u_newEdge,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 667, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 667, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 667, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 667, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_SetEdgeByLink", 0) < (0)) __PYX_ERR(0, 667, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_SetEdgeByLink", 1, 3, 3, i); __PYX_ERR(0, 667, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 3)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 667, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 667, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 667, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 667, __pyx_L3_error) __pyx_v_theLink = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_theLink == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 667, __pyx_L3_error) __pyx_v_newEdge = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_newEdge == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 667, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_SetEdgeByLink", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 667, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetEdgeByLink", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_76gp_SetEdgeByLink(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v, __pyx_v_theLink, __pyx_v_newEdge); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_76gp_SetEdgeByLink(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v, int __pyx_v_theLink, int __pyx_v_newEdge) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8[3]; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_SetEdgeByLink", 0); /* "planarity/full/graph.pyx":681 * invalid newEdge * """ * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetEdgeByLink() failed: invalid vertex index v = {v}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 681, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 681, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 681, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":682 * """ * if not self.gp_IsVertex(v): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetEdgeByLink() failed: invalid vertex index v = {v}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":683 * if not self.gp_IsVertex(v): * raise ValueError( * f"gp_SetEdgeByLink() failed: invalid vertex index v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 683, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetEdgeByLink_failed_invalid, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 683, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 682, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 682, __pyx_L1_error) /* "planarity/full/graph.pyx":681 * invalid newEdge * """ * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetEdgeByLink() failed: invalid vertex index v = {v}" */ } /* "planarity/full/graph.pyx":686 * ) * * if self.gp_IsNotEdge(newEdge) or self.gp_EdgeNotInUse(newEdge): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetEdgeByLink() failed: newEdge = {newEdge} " */ __pyx_t_7 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_7); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_newEdge); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 686, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsNotEdge, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 686, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 686, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_newEdge); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 686, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeNotInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 686, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 686, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = __pyx_t_5; __pyx_L5_bool_binop_done:; if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":687 * * if self.gp_IsNotEdge(newEdge) or self.gp_EdgeNotInUse(newEdge): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetEdgeByLink() failed: newEdge = {newEdge} " * "is not a valid edge." */ __pyx_t_7 = NULL; /* "planarity/full/graph.pyx":688 * if self.gp_IsNotEdge(newEdge) or self.gp_EdgeNotInUse(newEdge): * raise ValueError( * f"gp_SetEdgeByLink() failed: newEdge = {newEdge} " # <<<<<<<<<<<<<< * "is not a valid edge." * ) */ __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_newEdge, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 688, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_gp_SetEdgeByLink_failed_newEdge; __pyx_t_8[1] = __pyx_t_3; __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u_is_not_a_valid_edge; __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_8, 3, 37 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 21, 127); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 688, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_2}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 687, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 687, __pyx_L1_error) /* "planarity/full/graph.pyx":686 * ) * * if self.gp_IsNotEdge(newEdge) or self.gp_EdgeNotInUse(newEdge): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetEdgeByLink() failed: newEdge = {newEdge} " */ } /* "planarity/full/graph.pyx":692 * ) * * if theLink != 0 and theLink != 1: # <<<<<<<<<<<<<< * raise ValueError( * "gp_SetEdgeByLink() failed: invalid value for theLink = " */ switch (__pyx_v_theLink) { case 0: case 1: __pyx_t_6 = 0; break; default: __pyx_t_6 = 1; break; } if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":693 * * if theLink != 0 and theLink != 1: * raise ValueError( # <<<<<<<<<<<<<< * "gp_SetEdgeByLink() failed: invalid value for theLink = " * f"{theLink}" */ __pyx_t_2 = NULL; /* "planarity/full/graph.pyx":695 * raise ValueError( * "gp_SetEdgeByLink() failed: invalid value for theLink = " * f"{theLink}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_7 = __Pyx_PyUnicode_From_int(__pyx_v_theLink, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); /* "planarity/full/graph.pyx":694 * if theLink != 0 and theLink != 1: * raise ValueError( * "gp_SetEdgeByLink() failed: invalid value for theLink = " # <<<<<<<<<<<<<< * f"{theLink}" * ) */ __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetEdgeByLink_failed_invalid_2, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 694, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 693, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 693, __pyx_L1_error) /* "planarity/full/graph.pyx":692 * ) * * if theLink != 0 and theLink != 1: # <<<<<<<<<<<<<< * raise ValueError( * "gp_SetEdgeByLink() failed: invalid value for theLink = " */ } /* "planarity/full/graph.pyx":698 * ) * * graphLib.gp_SetEdgeByLink(self._theGraph, v, theLink, newEdge) # <<<<<<<<<<<<<< * * def gp_LowerBoundVertices(self) -> int: */ __pyx_f_9planarity_4full_8graphLib_gp_SetEdgeByLink(__pyx_v_self->_theGraph, __pyx_v_v, __pyx_v_theLink, __pyx_v_newEdge); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 698, __pyx_L1_error) /* "planarity/full/graph.pyx":667 * graphLib.gp_SetLastEdge(self._theGraph, v, newLastEdge) * * def gp_SetEdgeByLink(self, int v, int theLink, int newEdge) -> None: # <<<<<<<<<<<<<< * """Set the first or last edge in v's adjacency list, indicated by theLink. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetEdgeByLink", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":700 * graphLib.gp_SetEdgeByLink(self._theGraph, v, theLink, newEdge) * * def gp_LowerBoundVertices(self) -> int: # <<<<<<<<<<<<<< * """Get the lower bound of the graph's vertex indices. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_79gp_LowerBoundVertices(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_78gp_LowerBoundVertices, "Graph.gp_LowerBoundVertices(self) -> int\n\nGet the lower bound of the graph's vertex indices.\n\nReturns:\n The lower bound of the vertex indices"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_79gp_LowerBoundVertices = {"gp_LowerBoundVertices", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_79gp_LowerBoundVertices, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_78gp_LowerBoundVertices}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_79gp_LowerBoundVertices(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_LowerBoundVertices (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_LowerBoundVertices", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_LowerBoundVertices", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_78gp_LowerBoundVertices(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_78gp_LowerBoundVertices(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_LowerBoundVertices", 0); /* "planarity/full/graph.pyx":706 * The lower bound of the vertex indices * """ * return graphLib.gp_LowerBoundVertices(self._theGraph) # <<<<<<<<<<<<<< * * def gp_UpperBoundVertices(self) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_LowerBoundVertices(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 706, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 706, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 706, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":700 * graphLib.gp_SetEdgeByLink(self._theGraph, v, theLink, newEdge) * * def gp_LowerBoundVertices(self) -> int: # <<<<<<<<<<<<<< * """Get the lower bound of the graph's vertex indices. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_LowerBoundVertices", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":708 * return graphLib.gp_LowerBoundVertices(self._theGraph) * * def gp_UpperBoundVertices(self) -> int: # <<<<<<<<<<<<<< * """Get the upper bound of the graph's vertex indices. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_81gp_UpperBoundVertices(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_80gp_UpperBoundVertices, "Graph.gp_UpperBoundVertices(self) -> int\n\nGet the upper bound of the graph's vertex indices.\n\nReturns:\n The upper bound of the vertex indices"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_81gp_UpperBoundVertices = {"gp_UpperBoundVertices", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_81gp_UpperBoundVertices, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_80gp_UpperBoundVertices}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_81gp_UpperBoundVertices(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_UpperBoundVertices (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_UpperBoundVertices", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_UpperBoundVertices", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_80gp_UpperBoundVertices(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_80gp_UpperBoundVertices(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_UpperBoundVertices", 0); /* "planarity/full/graph.pyx":714 * The upper bound of the vertex indices * """ * return graphLib.gp_UpperBoundVertices(self._theGraph) # <<<<<<<<<<<<<< * * def gp_LowerBoundVirtualVertices(self) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_UpperBoundVertices(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 714, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 714, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 714, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":708 * return graphLib.gp_LowerBoundVertices(self._theGraph) * * def gp_UpperBoundVertices(self) -> int: # <<<<<<<<<<<<<< * """Get the upper bound of the graph's vertex indices. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_UpperBoundVertices", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":716 * return graphLib.gp_UpperBoundVertices(self._theGraph) * * def gp_LowerBoundVirtualVertices(self) -> int: # <<<<<<<<<<<<<< * """Get the lower bound of the graph's virtual vertex indices. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_83gp_LowerBoundVirtualVertices(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_82gp_LowerBoundVirtualVertices, "Graph.gp_LowerBoundVirtualVertices(self) -> int\n\nGet the lower bound of the graph's virtual vertex indices.\n\nReturns:\n The lower bound of the virtual vertex indices."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_83gp_LowerBoundVirtualVertices = {"gp_LowerBoundVirtualVertices", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_83gp_LowerBoundVirtualVertices, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_82gp_LowerBoundVirtualVertices}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_83gp_LowerBoundVirtualVertices(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_LowerBoundVirtualVertices (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_LowerBoundVirtualVertices", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_LowerBoundVirtualVertices", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_82gp_LowerBoundVirtualVertices(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_82gp_LowerBoundVirtualVertices(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_LowerBoundVirtualVertices", 0); /* "planarity/full/graph.pyx":722 * The lower bound of the virtual vertex indices. * """ * return graphLib.gp_LowerBoundVirtualVertices(self._theGraph) # <<<<<<<<<<<<<< * * def gp_UpperBoundVirtualVertices(self) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_LowerBoundVirtualVertices(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 722, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 722, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 722, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":716 * return graphLib.gp_UpperBoundVertices(self._theGraph) * * def gp_LowerBoundVirtualVertices(self) -> int: # <<<<<<<<<<<<<< * """Get the lower bound of the graph's virtual vertex indices. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_LowerBoundVirtualVertices", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":724 * return graphLib.gp_LowerBoundVirtualVertices(self._theGraph) * * def gp_UpperBoundVirtualVertices(self) -> int: # <<<<<<<<<<<<<< * """Get the upper bound of the graph's virtual vertex indices. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_85gp_UpperBoundVirtualVertices(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_84gp_UpperBoundVirtualVertices, "Graph.gp_UpperBoundVirtualVertices(self) -> int\n\nGet the upper bound of the graph's virtual vertex indices.\n\nReturns:\n The upper bound of the virtual vertex indices"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_85gp_UpperBoundVirtualVertices = {"gp_UpperBoundVirtualVertices", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_85gp_UpperBoundVirtualVertices, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_84gp_UpperBoundVirtualVertices}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_85gp_UpperBoundVirtualVertices(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_UpperBoundVirtualVertices (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_UpperBoundVirtualVertices", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_UpperBoundVirtualVertices", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_84gp_UpperBoundVirtualVertices(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_84gp_UpperBoundVirtualVertices(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_UpperBoundVirtualVertices", 0); /* "planarity/full/graph.pyx":730 * The upper bound of the virtual vertex indices * """ * return graphLib.gp_UpperBoundVirtualVertices(self._theGraph) # <<<<<<<<<<<<<< * * def gp_LowerBoundVertexStorage(self) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_UpperBoundVirtualVertices(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 730, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 730, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 730, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":724 * return graphLib.gp_LowerBoundVirtualVertices(self._theGraph) * * def gp_UpperBoundVirtualVertices(self) -> int: # <<<<<<<<<<<<<< * """Get the upper bound of the graph's virtual vertex indices. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_UpperBoundVirtualVertices", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":732 * return graphLib.gp_UpperBoundVirtualVertices(self._theGraph) * * def gp_LowerBoundVertexStorage(self) -> int: # <<<<<<<<<<<<<< * """Get lower bound of graph's storage for non-virtual and virtual vertices. * Use gp_LowerBoundVertices() unless you know why you're using this. */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_87gp_LowerBoundVertexStorage(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_86gp_LowerBoundVertexStorage, "Graph.gp_LowerBoundVertexStorage(self) -> int\n\nGet lower bound of graph's storage for non-virtual and virtual vertices.\nUse gp_LowerBoundVertices() unless you know why you're using this.\n\nReturns:\n The lower bound for all non-virtual and virtual vertices, to be used\n for some types of iteration."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_87gp_LowerBoundVertexStorage = {"gp_LowerBoundVertexStorage", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_87gp_LowerBoundVertexStorage, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_86gp_LowerBoundVertexStorage}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_87gp_LowerBoundVertexStorage(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_LowerBoundVertexStorage (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_LowerBoundVertexStorage", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_LowerBoundVertexStorage", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_86gp_LowerBoundVertexStorage(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_86gp_LowerBoundVertexStorage(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_LowerBoundVertexStorage", 0); /* "planarity/full/graph.pyx":740 * for some types of iteration. * """ * return graphLib.gp_LowerBoundVertexStorage(self._theGraph) # <<<<<<<<<<<<<< * * def gp_UpperBoundVertexStorage(self) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_LowerBoundVertexStorage(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 740, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 740, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":732 * return graphLib.gp_UpperBoundVirtualVertices(self._theGraph) * * def gp_LowerBoundVertexStorage(self) -> int: # <<<<<<<<<<<<<< * """Get lower bound of graph's storage for non-virtual and virtual vertices. * Use gp_LowerBoundVertices() unless you know why you're using this. */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_LowerBoundVertexStorage", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":742 * return graphLib.gp_LowerBoundVertexStorage(self._theGraph) * * def gp_UpperBoundVertexStorage(self) -> int: # <<<<<<<<<<<<<< * """Get upper bound of graph's storage for non-virtual and virtual vertices. * Use gp_UpperBoundVertices() unless you know why you're using this. */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_89gp_UpperBoundVertexStorage(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_88gp_UpperBoundVertexStorage, "Graph.gp_UpperBoundVertexStorage(self) -> int\n\nGet upper bound of graph's storage for non-virtual and virtual vertices.\nUse gp_UpperBoundVertices() unless you know why you're using this.\n\nReturns:\n The upper bound for all non-virtual and virtual vertices, to be used\n for some types of iteration."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_89gp_UpperBoundVertexStorage = {"gp_UpperBoundVertexStorage", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_89gp_UpperBoundVertexStorage, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_88gp_UpperBoundVertexStorage}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_89gp_UpperBoundVertexStorage(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_UpperBoundVertexStorage (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_UpperBoundVertexStorage", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_UpperBoundVertexStorage", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_88gp_UpperBoundVertexStorage(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_88gp_UpperBoundVertexStorage(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_UpperBoundVertexStorage", 0); /* "planarity/full/graph.pyx":750 * for some types of iteration. * """ * return graphLib.gp_UpperBoundVertexStorage(self._theGraph) # <<<<<<<<<<<<<< * * def gp_IsVertex(self, int v) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_UpperBoundVertexStorage(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 750, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 750, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 750, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":742 * return graphLib.gp_LowerBoundVertexStorage(self._theGraph) * * def gp_UpperBoundVertexStorage(self) -> int: # <<<<<<<<<<<<<< * """Get upper bound of graph's storage for non-virtual and virtual vertices. * Use gp_UpperBoundVertices() unless you know why you're using this. */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_UpperBoundVertexStorage", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":752 * return graphLib.gp_UpperBoundVertexStorage(self._theGraph) * * def gp_IsVertex(self, int v) -> int: # <<<<<<<<<<<<<< * """Determine if index v corresponds to a non-virtual vertex. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_91gp_IsVertex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_90gp_IsVertex, "Graph.gp_IsVertex(self, int v) -> int\n\nDetermine if index v corresponds to a non-virtual vertex.\n\nArgs:\n v: candidate index of a non-virtual vertex in the graph\n\nReturns:\n TRUE if v is within the allowed bounds for vertices and if the\n value returned by the C-layer call to gp_IsVertex() is truthy,\n otherwise FALSE."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_91gp_IsVertex = {"gp_IsVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_91gp_IsVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_90gp_IsVertex}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_91gp_IsVertex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_IsVertex (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 752, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 752, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_IsVertex", 0) < (0)) __PYX_ERR(0, 752, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_IsVertex", 1, 1, 1, i); __PYX_ERR(0, 752, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 752, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 752, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_IsVertex", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 752, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsVertex", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_90gp_IsVertex(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_90gp_IsVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_IsVertex", 0); /* "planarity/full/graph.pyx":764 * """ * if ( * (v >= self.gp_LowerBoundVertices()) and # <<<<<<<<<<<<<< * (v < self.gp_UpperBoundVertices()) and * graphLib.gp_IsVertex(self._theGraph, v) */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 764, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_LowerBoundVertices, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 764, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 764, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 764, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } /* "planarity/full/graph.pyx":765 * if ( * (v >= self.gp_LowerBoundVertices()) and * (v < self.gp_UpperBoundVertices()) and # <<<<<<<<<<<<<< * graphLib.gp_IsVertex(self._theGraph, v) * ): */ __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 765, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_UpperBoundVertices, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 765, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 765, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 765, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } /* "planarity/full/graph.pyx":766 * (v >= self.gp_LowerBoundVertices()) and * (v < self.gp_UpperBoundVertices()) and * graphLib.gp_IsVertex(self._theGraph, v) # <<<<<<<<<<<<<< * ): * return TRUE */ __pyx_t_7 = __pyx_f_9planarity_4full_8graphLib_gp_IsVertex(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 766, __pyx_L1_error) __pyx_t_6 = (__pyx_t_7 != 0); __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; /* "planarity/full/graph.pyx":763 * otherwise FALSE. * """ * if ( # <<<<<<<<<<<<<< * (v >= self.gp_LowerBoundVertices()) and * (v < self.gp_UpperBoundVertices()) and */ if (__pyx_t_1) { /* "planarity/full/graph.pyx":768 * graphLib.gp_IsVertex(self._theGraph, v) * ): * return TRUE # <<<<<<<<<<<<<< * * return FALSE */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_TRUE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 768, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 768, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":763 * otherwise FALSE. * """ * if ( # <<<<<<<<<<<<<< * (v >= self.gp_LowerBoundVertices()) and * (v < self.gp_UpperBoundVertices()) and */ } /* "planarity/full/graph.pyx":770 * return TRUE * * return FALSE # <<<<<<<<<<<<<< * * def gp_IsVirtualVertex(self, int v) -> int: */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FALSE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 770, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 770, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":752 * return graphLib.gp_UpperBoundVertexStorage(self._theGraph) * * def gp_IsVertex(self, int v) -> int: # <<<<<<<<<<<<<< * """Determine if index v corresponds to a non-virtual vertex. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsVertex", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":772 * return FALSE * * def gp_IsVirtualVertex(self, int v) -> int: # <<<<<<<<<<<<<< * """Determine if index v corresponds to a virtual vertex * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_93gp_IsVirtualVertex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_92gp_IsVirtualVertex, "Graph.gp_IsVirtualVertex(self, int v) -> int\n\nDetermine if index v corresponds to a virtual vertex\n\nArgs:\n v: candidate index of a virtual vertex in the graph\n\nReturns:\n TRUE if v is within the allowed bounds for virtual vertices and if\n the value returned by the C-layer call to gp_IsVirtualVertex() is\n truthy, otherwise FALSE."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_93gp_IsVirtualVertex = {"gp_IsVirtualVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_93gp_IsVirtualVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_92gp_IsVirtualVertex}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_93gp_IsVirtualVertex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_IsVirtualVertex (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 772, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 772, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_IsVirtualVertex", 0) < (0)) __PYX_ERR(0, 772, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_IsVirtualVertex", 1, 1, 1, i); __PYX_ERR(0, 772, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 772, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_IsVirtualVertex", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 772, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsVirtualVertex", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_92gp_IsVirtualVertex(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_92gp_IsVirtualVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_IsVirtualVertex", 0); /* "planarity/full/graph.pyx":784 * """ * if ( * (v >= self.gp_LowerBoundVirtualVertices()) and # <<<<<<<<<<<<<< * (v < self.gp_UpperBoundVirtualVertices()) and * graphLib.gp_IsVirtualVertex(self._theGraph, v) */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 784, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_LowerBoundVirtualVertices, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 784, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 784, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 784, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } /* "planarity/full/graph.pyx":785 * if ( * (v >= self.gp_LowerBoundVirtualVertices()) and * (v < self.gp_UpperBoundVirtualVertices()) and # <<<<<<<<<<<<<< * graphLib.gp_IsVirtualVertex(self._theGraph, v) * ): */ __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 785, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_UpperBoundVirtualVertices, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 785, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 785, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 785, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } /* "planarity/full/graph.pyx":786 * (v >= self.gp_LowerBoundVirtualVertices()) and * (v < self.gp_UpperBoundVirtualVertices()) and * graphLib.gp_IsVirtualVertex(self._theGraph, v) # <<<<<<<<<<<<<< * ): * return TRUE */ __pyx_t_7 = __pyx_f_9planarity_4full_8graphLib_gp_IsVirtualVertex(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 786, __pyx_L1_error) __pyx_t_6 = (__pyx_t_7 != 0); __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; /* "planarity/full/graph.pyx":783 * truthy, otherwise FALSE. * """ * if ( # <<<<<<<<<<<<<< * (v >= self.gp_LowerBoundVirtualVertices()) and * (v < self.gp_UpperBoundVirtualVertices()) and */ if (__pyx_t_1) { /* "planarity/full/graph.pyx":788 * graphLib.gp_IsVirtualVertex(self._theGraph, v) * ): * return TRUE # <<<<<<<<<<<<<< * * return FALSE */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_TRUE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 788, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 788, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":783 * truthy, otherwise FALSE. * """ * if ( # <<<<<<<<<<<<<< * (v >= self.gp_LowerBoundVirtualVertices()) and * (v < self.gp_UpperBoundVirtualVertices()) and */ } /* "planarity/full/graph.pyx":790 * return TRUE * * return FALSE # <<<<<<<<<<<<<< * * def gp_IsNotVertex(self, int v) -> int: */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FALSE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 790, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 790, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":772 * return FALSE * * def gp_IsVirtualVertex(self, int v) -> int: # <<<<<<<<<<<<<< * """Determine if index v corresponds to a virtual vertex * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsVirtualVertex", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":792 * return FALSE * * def gp_IsNotVertex(self, int v) -> int: # <<<<<<<<<<<<<< * """Determine if index v does not correspond to a non-virtual vertex * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_95gp_IsNotVertex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_94gp_IsNotVertex, "Graph.gp_IsNotVertex(self, int v) -> int\n\nDetermine if index v does not correspond to a non-virtual vertex\n\nArgs:\n v: candidate index of a non-virtual vertex in the graph\n\nReturns:\n TRUE if v is not within the allowed bounds for non-virtual vertices,\n or if the value returned by the C-layer call to gp_IsNotVertex() is\n truthy, otherwise FALSE."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_95gp_IsNotVertex = {"gp_IsNotVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_95gp_IsNotVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_94gp_IsNotVertex}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_95gp_IsNotVertex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_IsNotVertex (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 792, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 792, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_IsNotVertex", 0) < (0)) __PYX_ERR(0, 792, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_IsNotVertex", 1, 1, 1, i); __PYX_ERR(0, 792, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 792, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 792, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_IsNotVertex", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 792, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsNotVertex", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_94gp_IsNotVertex(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_94gp_IsNotVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_IsNotVertex", 0); /* "planarity/full/graph.pyx":804 * """ * if ( * (v < self.gp_LowerBoundVertices()) or # <<<<<<<<<<<<<< * (v >= self.gp_UpperBoundlVertices()) or * graphLib.gp_IsNotVertex(self._theGraph, v) */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 804, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_LowerBoundVertices, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 804, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 804, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 804, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } /* "planarity/full/graph.pyx":805 * if ( * (v < self.gp_LowerBoundVertices()) or * (v >= self.gp_UpperBoundlVertices()) or # <<<<<<<<<<<<<< * graphLib.gp_IsNotVertex(self._theGraph, v) * ): */ __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 805, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_UpperBoundlVertices, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 805, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 805, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 805, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } /* "planarity/full/graph.pyx":806 * (v < self.gp_LowerBoundVertices()) or * (v >= self.gp_UpperBoundlVertices()) or * graphLib.gp_IsNotVertex(self._theGraph, v) # <<<<<<<<<<<<<< * ): * return TRUE */ __pyx_t_7 = __pyx_f_9planarity_4full_8graphLib_gp_IsNotVertex(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 806, __pyx_L1_error) __pyx_t_6 = (__pyx_t_7 != 0); __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; /* "planarity/full/graph.pyx":803 * truthy, otherwise FALSE. * """ * if ( # <<<<<<<<<<<<<< * (v < self.gp_LowerBoundVertices()) or * (v >= self.gp_UpperBoundlVertices()) or */ if (__pyx_t_1) { /* "planarity/full/graph.pyx":808 * graphLib.gp_IsNotVertex(self._theGraph, v) * ): * return TRUE # <<<<<<<<<<<<<< * * return FALSE */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_TRUE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 808, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 808, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":803 * truthy, otherwise FALSE. * """ * if ( # <<<<<<<<<<<<<< * (v < self.gp_LowerBoundVertices()) or * (v >= self.gp_UpperBoundlVertices()) or */ } /* "planarity/full/graph.pyx":810 * return TRUE * * return FALSE # <<<<<<<<<<<<<< * * def gp_IsNotVirtualVertex(self, int v) -> int: */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FALSE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 810, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 810, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":792 * return FALSE * * def gp_IsNotVertex(self, int v) -> int: # <<<<<<<<<<<<<< * """Determine if index v does not correspond to a non-virtual vertex * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsNotVertex", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":812 * return FALSE * * def gp_IsNotVirtualVertex(self, int v) -> int: # <<<<<<<<<<<<<< * """Determine if index v does not correspond to a virtual vertex * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_97gp_IsNotVirtualVertex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_96gp_IsNotVirtualVertex, "Graph.gp_IsNotVirtualVertex(self, int v) -> int\n\nDetermine if index v does not correspond to a virtual vertex\n\nArgs:\n v: candidate index of a virtual vertex in the graph\n\nReturns:\n TRUE if v is not within the allowed bounds for virtual vertices or\n if the value returned by the C-layer call to gp_IsNotVirtualVertex()\n is truthy, otherwise FALSE."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_97gp_IsNotVirtualVertex = {"gp_IsNotVirtualVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_97gp_IsNotVirtualVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_96gp_IsNotVirtualVertex}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_97gp_IsNotVirtualVertex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_IsNotVirtualVertex (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 812, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 812, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_IsNotVirtualVertex", 0) < (0)) __PYX_ERR(0, 812, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_IsNotVirtualVertex", 1, 1, 1, i); __PYX_ERR(0, 812, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 812, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 812, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_IsNotVirtualVertex", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 812, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsNotVirtualVertex", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_96gp_IsNotVirtualVertex(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_96gp_IsNotVirtualVertex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_IsNotVirtualVertex", 0); /* "planarity/full/graph.pyx":824 * """ * if ( * (v < self.gp_LowerBoundVirtualVertices()) or # <<<<<<<<<<<<<< * (v >= self.gp_UpperBoundVirtualVertices()) or * graphLib.gp_IsNotVirtualVertex(self._theGraph, v) */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 824, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_LowerBoundVirtualVertices, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 824, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 824, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 824, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } /* "planarity/full/graph.pyx":825 * if ( * (v < self.gp_LowerBoundVirtualVertices()) or * (v >= self.gp_UpperBoundVirtualVertices()) or # <<<<<<<<<<<<<< * graphLib.gp_IsNotVirtualVertex(self._theGraph, v) * ): */ __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 825, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_UpperBoundVirtualVertices, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 825, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 825, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 825, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } /* "planarity/full/graph.pyx":826 * (v < self.gp_LowerBoundVirtualVertices()) or * (v >= self.gp_UpperBoundVirtualVertices()) or * graphLib.gp_IsNotVirtualVertex(self._theGraph, v) # <<<<<<<<<<<<<< * ): * return TRUE */ __pyx_t_7 = __pyx_f_9planarity_4full_8graphLib_gp_IsNotVirtualVertex(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 826, __pyx_L1_error) __pyx_t_6 = (__pyx_t_7 != 0); __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; /* "planarity/full/graph.pyx":823 * is truthy, otherwise FALSE. * """ * if ( # <<<<<<<<<<<<<< * (v < self.gp_LowerBoundVirtualVertices()) or * (v >= self.gp_UpperBoundVirtualVertices()) or */ if (__pyx_t_1) { /* "planarity/full/graph.pyx":828 * graphLib.gp_IsNotVirtualVertex(self._theGraph, v) * ): * return TRUE # <<<<<<<<<<<<<< * * return FALSE */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_TRUE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 828, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":823 * is truthy, otherwise FALSE. * """ * if ( # <<<<<<<<<<<<<< * (v < self.gp_LowerBoundVirtualVertices()) or * (v >= self.gp_UpperBoundVirtualVertices()) or */ } /* "planarity/full/graph.pyx":830 * return TRUE * * return FALSE # <<<<<<<<<<<<<< * * def gp_VirtualVertexInUse(self, int virtualVertex) -> int: */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FALSE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 830, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 830, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":812 * return FALSE * * def gp_IsNotVirtualVertex(self, int v) -> int: # <<<<<<<<<<<<<< * """Determine if index v does not correspond to a virtual vertex * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsNotVirtualVertex", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":832 * return FALSE * * def gp_VirtualVertexInUse(self, int virtualVertex) -> int: # <<<<<<<<<<<<<< * """Determines if virtualVertex corresponds to a virtual vertex in use. * A virtual vertex is in use if it has any incident edges. */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_99gp_VirtualVertexInUse(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_98gp_VirtualVertexInUse, "Graph.gp_VirtualVertexInUse(self, int virtualVertex) -> int\n\nDetermines if virtualVertex corresponds to a virtual vertex in use.\nA virtual vertex is in use if it has any incident edges.\n\nArgs:\n virtualVertex: candidate virtual vertex to test\n\nReturns:\n TRUE if virtualVertex is a valid virtual vertex and is in use,\n otherwise FALSE."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_99gp_VirtualVertexInUse = {"gp_VirtualVertexInUse", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_99gp_VirtualVertexInUse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_98gp_VirtualVertexInUse}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_99gp_VirtualVertexInUse(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_virtualVertex; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_VirtualVertexInUse (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_virtualVertex,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 832, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 832, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_VirtualVertexInUse", 0) < (0)) __PYX_ERR(0, 832, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_VirtualVertexInUse", 1, 1, 1, i); __PYX_ERR(0, 832, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 832, __pyx_L3_error) } __pyx_v_virtualVertex = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_virtualVertex == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 832, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_VirtualVertexInUse", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 832, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_VirtualVertexInUse", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_98gp_VirtualVertexInUse(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_virtualVertex); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_98gp_VirtualVertexInUse(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_virtualVertex) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_VirtualVertexInUse", 0); /* "planarity/full/graph.pyx":844 * """ * if ( * self.gp_IsVirtualVertex(virtualVertex) and # <<<<<<<<<<<<<< * graphLib.gp_VirtualVertexInUse(self._theGraph, virtualVertex) * ): */ __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_virtualVertex); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 844, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 844, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 844, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } /* "planarity/full/graph.pyx":845 * if ( * self.gp_IsVirtualVertex(virtualVertex) and * graphLib.gp_VirtualVertexInUse(self._theGraph, virtualVertex) # <<<<<<<<<<<<<< * ): * return TRUE */ __pyx_t_7 = __pyx_f_9planarity_4full_8graphLib_gp_VirtualVertexInUse(__pyx_v_self->_theGraph, __pyx_v_virtualVertex); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 845, __pyx_L1_error) __pyx_t_6 = (__pyx_t_7 != 0); __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; /* "planarity/full/graph.pyx":843 * otherwise FALSE. * """ * if ( # <<<<<<<<<<<<<< * self.gp_IsVirtualVertex(virtualVertex) and * graphLib.gp_VirtualVertexInUse(self._theGraph, virtualVertex) */ if (__pyx_t_1) { /* "planarity/full/graph.pyx":847 * graphLib.gp_VirtualVertexInUse(self._theGraph, virtualVertex) * ): * return TRUE # <<<<<<<<<<<<<< * * return FALSE */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_TRUE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 847, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 847, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":843 * otherwise FALSE. * """ * if ( # <<<<<<<<<<<<<< * self.gp_IsVirtualVertex(virtualVertex) and * graphLib.gp_VirtualVertexInUse(self._theGraph, virtualVertex) */ } /* "planarity/full/graph.pyx":849 * return TRUE * * return FALSE # <<<<<<<<<<<<<< * * def gp_VirtualVertexNotInUse(self, int virtualVertex) -> int: */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FALSE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 849, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 849, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":832 * return FALSE * * def gp_VirtualVertexInUse(self, int virtualVertex) -> int: # <<<<<<<<<<<<<< * """Determines if virtualVertex corresponds to a virtual vertex in use. * A virtual vertex is in use if it has any incident edges. */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_VirtualVertexInUse", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":851 * return FALSE * * def gp_VirtualVertexNotInUse(self, int virtualVertex) -> int: # <<<<<<<<<<<<<< * """Determines if virtualVertex corresponds to a virtual vertex not in use. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_101gp_VirtualVertexNotInUse(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_100gp_VirtualVertexNotInUse, "Graph.gp_VirtualVertexNotInUse(self, int virtualVertex) -> int\n\nDetermines if virtualVertex corresponds to a virtual vertex not in use.\n\nArgs:\n virtualVertex: candidate virtual vertex to test \n\nReturns:\n TRUE if virtualVertex is a valid virtual vertex and is not in use,\n FALSE if virtualVertex is not a valid virtual vertex or if it is\n a virtual vertex but is in use."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_101gp_VirtualVertexNotInUse = {"gp_VirtualVertexNotInUse", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_101gp_VirtualVertexNotInUse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_100gp_VirtualVertexNotInUse}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_101gp_VirtualVertexNotInUse(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_virtualVertex; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_VirtualVertexNotInUse (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_virtualVertex,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 851, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 851, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_VirtualVertexNotInUse", 0) < (0)) __PYX_ERR(0, 851, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_VirtualVertexNotInUse", 1, 1, 1, i); __PYX_ERR(0, 851, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 851, __pyx_L3_error) } __pyx_v_virtualVertex = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_virtualVertex == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 851, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_VirtualVertexNotInUse", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 851, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_VirtualVertexNotInUse", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_100gp_VirtualVertexNotInUse(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_virtualVertex); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_100gp_VirtualVertexNotInUse(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_virtualVertex) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_VirtualVertexNotInUse", 0); /* "planarity/full/graph.pyx":863 * """ * if ( * self.gp_IsVirtualVertex(virtualVertex) and # <<<<<<<<<<<<<< * graphLib.gp_VirtualVertexNotInUse(self._theGraph, virtualVertex) * ): */ __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_virtualVertex); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 863, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 863, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 863, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } /* "planarity/full/graph.pyx":864 * if ( * self.gp_IsVirtualVertex(virtualVertex) and * graphLib.gp_VirtualVertexNotInUse(self._theGraph, virtualVertex) # <<<<<<<<<<<<<< * ): * return TRUE */ __pyx_t_7 = __pyx_f_9planarity_4full_8graphLib_gp_VirtualVertexNotInUse(__pyx_v_self->_theGraph, __pyx_v_virtualVertex); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 864, __pyx_L1_error) __pyx_t_6 = (__pyx_t_7 != 0); __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; /* "planarity/full/graph.pyx":862 * a virtual vertex but is in use. * """ * if ( # <<<<<<<<<<<<<< * self.gp_IsVirtualVertex(virtualVertex) and * graphLib.gp_VirtualVertexNotInUse(self._theGraph, virtualVertex) */ if (__pyx_t_1) { /* "planarity/full/graph.pyx":866 * graphLib.gp_VirtualVertexNotInUse(self._theGraph, virtualVertex) * ): * return TRUE # <<<<<<<<<<<<<< * * return FALSE */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_TRUE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 866, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 866, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":862 * a virtual vertex but is in use. * """ * if ( # <<<<<<<<<<<<<< * self.gp_IsVirtualVertex(virtualVertex) and * graphLib.gp_VirtualVertexNotInUse(self._theGraph, virtualVertex) */ } /* "planarity/full/graph.pyx":868 * return TRUE * * return FALSE # <<<<<<<<<<<<<< * * def gp_GetIndex(self, int v) -> int: */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FALSE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 868, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 868, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":851 * return FALSE * * def gp_VirtualVertexNotInUse(self, int virtualVertex) -> int: # <<<<<<<<<<<<<< * """Determines if virtualVertex corresponds to a virtual vertex not in use. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_VirtualVertexNotInUse", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":870 * return FALSE * * def gp_GetIndex(self, int v) -> int: # <<<<<<<<<<<<<< * """Get the index data member value of vertex v * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_103gp_GetIndex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_102gp_GetIndex, "Graph.gp_GetIndex(self, int v) -> int\n\nGet the index data member value of vertex v\n\nArgs:\n v: the vertex in the graph whose index field to get\n\nReturns:\n The value of the index field of the vertex record corresponding to v\n\nRaises:\n ValueError if v doesn't correspond to a non-virtual or virtual\n vertex."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_103gp_GetIndex = {"gp_GetIndex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_103gp_GetIndex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_102gp_GetIndex}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_103gp_GetIndex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetIndex (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 870, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 870, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetIndex", 0) < (0)) __PYX_ERR(0, 870, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetIndex", 1, 1, 1, i); __PYX_ERR(0, 870, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 870, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 870, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetIndex", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 870, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetIndex", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_102gp_GetIndex(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_102gp_GetIndex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetIndex", 0); /* "planarity/full/graph.pyx":883 * vertex. * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetIndex() failed: invalid vertex v = {v}" */ __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 883, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 883, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 883, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 883, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 883, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 883, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; __pyx_t_6 = (!__pyx_t_1); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":884 * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetIndex() failed: invalid vertex v = {v}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":885 * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( * f"gp_GetIndex() failed: invalid vertex v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 885, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetIndex_failed_invalid_verte, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 885, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 884, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 884, __pyx_L1_error) /* "planarity/full/graph.pyx":883 * vertex. * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetIndex() failed: invalid vertex v = {v}" */ } /* "planarity/full/graph.pyx":888 * ) * * return graphLib.gp_GetIndex(self._theGraph, v) # <<<<<<<<<<<<<< * * def gp_SetIndex(self, int v, int theIndex) -> None: */ __Pyx_XDECREF(__pyx_r); __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_GetIndex(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 888, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 888, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 888, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":870 * return FALSE * * def gp_GetIndex(self, int v) -> int: # <<<<<<<<<<<<<< * """Get the index data member value of vertex v * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetIndex", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":890 * return graphLib.gp_GetIndex(self._theGraph, v) * * def gp_SetIndex(self, int v, int theIndex) -> None: # <<<<<<<<<<<<<< * """Set the index data member of vertex v to theIndex * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_105gp_SetIndex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_104gp_SetIndex, "Graph.gp_SetIndex(self, int v, int theIndex) -> None\n\nSet the index data member of vertex v to theIndex\n\nArgs:\n v: the vertex in the graph whose index to set to theIndex\n theIndex: new value you wish to assign to the vertex's index field\n\nRaises:\n ValueError if v or theIndex don't correspond to a non-virtual or\n virtual vertex."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_105gp_SetIndex = {"gp_SetIndex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_105gp_SetIndex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_104gp_SetIndex}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_105gp_SetIndex(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; int __pyx_v_theIndex; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_SetIndex (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,&__pyx_mstate_global->__pyx_n_u_theIndex,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 890, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 890, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 890, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_SetIndex", 0) < (0)) __PYX_ERR(0, 890, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_SetIndex", 1, 2, 2, i); __PYX_ERR(0, 890, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 890, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 890, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 890, __pyx_L3_error) __pyx_v_theIndex = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_theIndex == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 890, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_SetIndex", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 890, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetIndex", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_104gp_SetIndex(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v, __pyx_v_theIndex); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_104gp_SetIndex(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v, int __pyx_v_theIndex) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8[3]; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_SetIndex", 0); /* "planarity/full/graph.pyx":901 * virtual vertex. * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetIndex() failed: invalid vertex v = {v}" */ __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 901, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 901, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 901, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 901, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 901, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 901, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; __pyx_t_6 = (!__pyx_t_1); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":902 * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetIndex() failed: invalid vertex v = {v}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":903 * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( * f"gp_SetIndex() failed: invalid vertex v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 903, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetIndex_failed_invalid_verte, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 903, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 902, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 902, __pyx_L1_error) /* "planarity/full/graph.pyx":901 * virtual vertex. * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetIndex() failed: invalid vertex v = {v}" */ } /* "planarity/full/graph.pyx":906 * ) * * if not (self.gp_IsVertex(theIndex) or self.gp_IsVirtualVertex(theIndex)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetIndex() failed: invalid value theIndex = {theIndex} to " */ __pyx_t_7 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_7); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_theIndex); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 906, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_3}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 906, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 906, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_1) { } else { __pyx_t_6 = __pyx_t_1; goto __pyx_L7_bool_binop_done; } __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_theIndex); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 906, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 906, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 906, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = __pyx_t_1; __pyx_L7_bool_binop_done:; __pyx_t_1 = (!__pyx_t_6); if (unlikely(__pyx_t_1)) { /* "planarity/full/graph.pyx":907 * * if not (self.gp_IsVertex(theIndex) or self.gp_IsVirtualVertex(theIndex)): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetIndex() failed: invalid value theIndex = {theIndex} to " * "which you wish to set the index of v = {v}" */ __pyx_t_7 = NULL; /* "planarity/full/graph.pyx":908 * if not (self.gp_IsVertex(theIndex) or self.gp_IsVirtualVertex(theIndex)): * raise ValueError( * f"gp_SetIndex() failed: invalid value theIndex = {theIndex} to " # <<<<<<<<<<<<<< * "which you wish to set the index of v = {v}" * ) */ __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_theIndex, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 908, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8[0] = __pyx_mstate_global->__pyx_kp_u_gp_SetIndex_failed_invalid_value; __pyx_t_8[1] = __pyx_t_3; __pyx_t_8[2] = __pyx_mstate_global->__pyx_kp_u_to_which_you_wish_to_set_the_in; __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_8, 3, 47 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 46, 127); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 908, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 907, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 907, __pyx_L1_error) /* "planarity/full/graph.pyx":906 * ) * * if not (self.gp_IsVertex(theIndex) or self.gp_IsVirtualVertex(theIndex)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetIndex() failed: invalid value theIndex = {theIndex} to " */ } /* "planarity/full/graph.pyx":912 * ) * * graphLib.gp_SetIndex(self._theGraph, v, theIndex) # <<<<<<<<<<<<<< * * def gp_InitFlags(self, int v) -> None: */ __pyx_f_9planarity_4full_8graphLib_gp_SetIndex(__pyx_v_self->_theGraph, __pyx_v_v, __pyx_v_theIndex); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 912, __pyx_L1_error) /* "planarity/full/graph.pyx":890 * return graphLib.gp_GetIndex(self._theGraph, v) * * def gp_SetIndex(self, int v, int theIndex) -> None: # <<<<<<<<<<<<<< * """Set the index data member of vertex v to theIndex * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetIndex", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":914 * graphLib.gp_SetIndex(self._theGraph, v, theIndex) * * def gp_InitFlags(self, int v) -> None: # <<<<<<<<<<<<<< * """Resets (clears) all flags for a given vertex. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_107gp_InitFlags(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_106gp_InitFlags, "Graph.gp_InitFlags(self, int v) -> None\n\nResets (clears) all flags for a given vertex.\n\nArgs:\n v: index of vertex in graph whose flags you wish to clear\n\nRaises:\n ValueError if v is not a non-virtual nor virtual vertex."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_107gp_InitFlags = {"gp_InitFlags", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_107gp_InitFlags, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_106gp_InitFlags}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_107gp_InitFlags(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_InitFlags (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 914, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 914, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_InitFlags", 0) < (0)) __PYX_ERR(0, 914, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_InitFlags", 1, 1, 1, i); __PYX_ERR(0, 914, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 914, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 914, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_InitFlags", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 914, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_InitFlags", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_106gp_InitFlags(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_106gp_InitFlags(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_InitFlags", 0); /* "planarity/full/graph.pyx":923 * ValueError if v is not a non-virtual nor virtual vertex. * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_InitFlags() failed: invalid vertex v = {v}" */ __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 923, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 923, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 923, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 923, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 923, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 923, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; __pyx_t_6 = (!__pyx_t_1); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":924 * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_InitFlags() failed: invalid vertex v = {v}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":925 * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( * f"gp_InitFlags() failed: invalid vertex v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 925, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_InitFlags_failed_invalid_vert, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 925, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 924, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 924, __pyx_L1_error) /* "planarity/full/graph.pyx":923 * ValueError if v is not a non-virtual nor virtual vertex. * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_InitFlags() failed: invalid vertex v = {v}" */ } /* "planarity/full/graph.pyx":928 * ) * * graphLib.gp_InitFlags(self._theGraph, v) # <<<<<<<<<<<<<< * * def gp_GetVisited(self, int v) -> int: */ __pyx_f_9planarity_4full_8graphLib_gp_InitFlags(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 928, __pyx_L1_error) /* "planarity/full/graph.pyx":914 * graphLib.gp_SetIndex(self._theGraph, v, theIndex) * * def gp_InitFlags(self, int v) -> None: # <<<<<<<<<<<<<< * """Resets (clears) all flags for a given vertex. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_InitFlags", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":930 * graphLib.gp_InitFlags(self._theGraph, v) * * def gp_GetVisited(self, int v) -> int: # <<<<<<<<<<<<<< * """Gets the visited flag of vertex v. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_109gp_GetVisited(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_108gp_GetVisited, "Graph.gp_GetVisited(self, int v) -> int\n\nGets the visited flag of vertex v.\n\nArgs:\n v: index of vertex in graph whose visited flag you wish to get\n\nReturns:\n The visited flag for v, i.e., 0 (falsy) or VERTEX_VISITED_MASK (truthy)\n\nRaises:\n ValueError if v is neither a non-virtual nor a virtual vertex"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_109gp_GetVisited = {"gp_GetVisited", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_109gp_GetVisited, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_108gp_GetVisited}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_109gp_GetVisited(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetVisited (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 930, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 930, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetVisited", 0) < (0)) __PYX_ERR(0, 930, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetVisited", 1, 1, 1, i); __PYX_ERR(0, 930, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 930, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 930, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetVisited", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 930, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetVisited", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_108gp_GetVisited(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_108gp_GetVisited(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetVisited", 0); /* "planarity/full/graph.pyx":942 * ValueError if v is neither a non-virtual nor a virtual vertex * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetVisited() failed: invalid vertex v = {v}" */ __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 942, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 942, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 942, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 942, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 942, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 942, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; __pyx_t_6 = (!__pyx_t_1); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":943 * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetVisited() failed: invalid vertex v = {v}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":944 * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( * f"gp_GetVisited() failed: invalid vertex v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 944, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetVisited_failed_invalid_ver, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 944, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 943, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 943, __pyx_L1_error) /* "planarity/full/graph.pyx":942 * ValueError if v is neither a non-virtual nor a virtual vertex * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetVisited() failed: invalid vertex v = {v}" */ } /* "planarity/full/graph.pyx":947 * ) * * return graphLib.gp_GetVisited(self._theGraph, v) # <<<<<<<<<<<<<< * * def gp_ClearVisited(self, int v) -> None: */ __Pyx_XDECREF(__pyx_r); __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_GetVisited(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 947, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 947, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 947, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":930 * graphLib.gp_InitFlags(self._theGraph, v) * * def gp_GetVisited(self, int v) -> int: # <<<<<<<<<<<<<< * """Gets the visited flag of vertex v. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetVisited", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":949 * return graphLib.gp_GetVisited(self._theGraph, v) * * def gp_ClearVisited(self, int v) -> None: # <<<<<<<<<<<<<< * """Clears the visited flag of vertex v. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_111gp_ClearVisited(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_110gp_ClearVisited, "Graph.gp_ClearVisited(self, int v) -> None\n\nClears the visited flag of vertex v.\n\nArgs:\n v: index of vertex in graph whose visited flag you wish to clear\n\nRaises:\n ValueError if v is neither a non-virtual nor a virtual vertex"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_111gp_ClearVisited = {"gp_ClearVisited", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_111gp_ClearVisited, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_110gp_ClearVisited}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_111gp_ClearVisited(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ClearVisited (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 949, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 949, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_ClearVisited", 0) < (0)) __PYX_ERR(0, 949, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_ClearVisited", 1, 1, 1, i); __PYX_ERR(0, 949, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 949, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 949, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_ClearVisited", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 949, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ClearVisited", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_110gp_ClearVisited(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_110gp_ClearVisited(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_ClearVisited", 0); /* "planarity/full/graph.pyx":958 * ValueError if v is neither a non-virtual nor a virtual vertex * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_ClearVisited() failed: invalid vertex v = {v}" */ __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 958, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 958, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 958, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 958, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 958, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 958, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; __pyx_t_6 = (!__pyx_t_1); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":959 * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_ClearVisited() failed: invalid vertex v = {v}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":960 * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( * f"gp_ClearVisited() failed: invalid vertex v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 960, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_ClearVisited_failed_invalid_v, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 960, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 959, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 959, __pyx_L1_error) /* "planarity/full/graph.pyx":958 * ValueError if v is neither a non-virtual nor a virtual vertex * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_ClearVisited() failed: invalid vertex v = {v}" */ } /* "planarity/full/graph.pyx":963 * ) * * graphLib.gp_ClearVisited(self._theGraph, v) # <<<<<<<<<<<<<< * * def gp_SetVisited(self, int v) -> None: */ __pyx_f_9planarity_4full_8graphLib_gp_ClearVisited(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 963, __pyx_L1_error) /* "planarity/full/graph.pyx":949 * return graphLib.gp_GetVisited(self._theGraph, v) * * def gp_ClearVisited(self, int v) -> None: # <<<<<<<<<<<<<< * """Clears the visited flag of vertex v. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ClearVisited", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":965 * graphLib.gp_ClearVisited(self._theGraph, v) * * def gp_SetVisited(self, int v) -> None: # <<<<<<<<<<<<<< * """Sets the visited flag of vertex v. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_113gp_SetVisited(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_112gp_SetVisited, "Graph.gp_SetVisited(self, int v) -> None\n\nSets the visited flag of vertex v.\n\nArgs:\n v: index of vertex in graph whose visited flag you wish to set\n\nRaises:\n ValueError if v is neither a non-virtual nor a virtual vertex"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_113gp_SetVisited = {"gp_SetVisited", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_113gp_SetVisited, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_112gp_SetVisited}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_113gp_SetVisited(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_SetVisited (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 965, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 965, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_SetVisited", 0) < (0)) __PYX_ERR(0, 965, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_SetVisited", 1, 1, 1, i); __PYX_ERR(0, 965, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 965, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 965, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_SetVisited", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 965, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetVisited", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_112gp_SetVisited(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_112gp_SetVisited(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_SetVisited", 0); /* "planarity/full/graph.pyx":974 * ValueError if v is neither a non-virtual nor a virtual vertex * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetVisited() failed: invalid vertex v = {v}" */ __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 974, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 974, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 974, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 974, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 974, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 974, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; __pyx_t_6 = (!__pyx_t_1); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":975 * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetVisited() failed: invalid vertex v = {v}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":976 * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( * f"gp_SetVisited() failed: invalid vertex v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 976, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetVisited_failed_invalid_ver, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 976, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 975, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 975, __pyx_L1_error) /* "planarity/full/graph.pyx":974 * ValueError if v is neither a non-virtual nor a virtual vertex * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetVisited() failed: invalid vertex v = {v}" */ } /* "planarity/full/graph.pyx":979 * ) * * graphLib.gp_SetVisited(self._theGraph, v) # <<<<<<<<<<<<<< * * def gp_GetMarked(self, int v) -> int: */ __pyx_f_9planarity_4full_8graphLib_gp_SetVisited(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 979, __pyx_L1_error) /* "planarity/full/graph.pyx":965 * graphLib.gp_ClearVisited(self._theGraph, v) * * def gp_SetVisited(self, int v) -> None: # <<<<<<<<<<<<<< * """Sets the visited flag of vertex v. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetVisited", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":981 * graphLib.gp_SetVisited(self._theGraph, v) * * def gp_GetMarked(self, int v) -> int: # <<<<<<<<<<<<<< * """Gets the marked flag of vertex v. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_115gp_GetMarked(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_114gp_GetMarked, "Graph.gp_GetMarked(self, int v) -> int\n\nGets the marked flag of vertex v.\n\nArgs:\n v: vertex whose marked flag you wish to get\n\nReturns:\n The marked flag for v, i.e., 0 (falsy) or VERTEX_MARKED_MASK (truthy)\n\nRaises:\n ValueError if v is neither a non-virtual nor a virtual vertex"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_115gp_GetMarked = {"gp_GetMarked", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_115gp_GetMarked, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_114gp_GetMarked}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_115gp_GetMarked(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetMarked (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 981, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 981, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetMarked", 0) < (0)) __PYX_ERR(0, 981, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetMarked", 1, 1, 1, i); __PYX_ERR(0, 981, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 981, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 981, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetMarked", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 981, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetMarked", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_114gp_GetMarked(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_114gp_GetMarked(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetMarked", 0); /* "planarity/full/graph.pyx":993 * ValueError if v is neither a non-virtual nor a virtual vertex * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetMarked() failed: invalid vertex v = {v}" */ __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 993, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 993, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 993, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 993, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 993, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 993, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; __pyx_t_6 = (!__pyx_t_1); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":994 * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetMarked() failed: invalid vertex v = {v}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":995 * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( * f"gp_GetMarked() failed: invalid vertex v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 995, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetMarked_failed_invalid_vert, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 995, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 994, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 994, __pyx_L1_error) /* "planarity/full/graph.pyx":993 * ValueError if v is neither a non-virtual nor a virtual vertex * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetMarked() failed: invalid vertex v = {v}" */ } /* "planarity/full/graph.pyx":998 * ) * * return graphLib.gp_GetMarked(self._theGraph, v) # <<<<<<<<<<<<<< * * def gp_ClearMarked(self, int v) -> None: */ __Pyx_XDECREF(__pyx_r); __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_GetMarked(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 998, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 998, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 998, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":981 * graphLib.gp_SetVisited(self._theGraph, v) * * def gp_GetMarked(self, int v) -> int: # <<<<<<<<<<<<<< * """Gets the marked flag of vertex v. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetMarked", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1000 * return graphLib.gp_GetMarked(self._theGraph, v) * * def gp_ClearMarked(self, int v) -> None: # <<<<<<<<<<<<<< * """Clears the marked flag of vertex v. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_117gp_ClearMarked(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_116gp_ClearMarked, "Graph.gp_ClearMarked(self, int v) -> None\n\nClears the marked flag of vertex v.\n\nArgs:\n v: vertex whose marked flag you wish to clear\n\nRaises:\n ValueError if v is neither a non-virtual nor a virtual vertex"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_117gp_ClearMarked = {"gp_ClearMarked", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_117gp_ClearMarked, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_116gp_ClearMarked}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_117gp_ClearMarked(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ClearMarked (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1000, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1000, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_ClearMarked", 0) < (0)) __PYX_ERR(0, 1000, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_ClearMarked", 1, 1, 1, i); __PYX_ERR(0, 1000, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1000, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1000, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_ClearMarked", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1000, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ClearMarked", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_116gp_ClearMarked(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_116gp_ClearMarked(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_ClearMarked", 0); /* "planarity/full/graph.pyx":1009 * ValueError if v is neither a non-virtual nor a virtual vertex * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_ClearMarked() failed: invalid vertex v = {v}" */ __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1009, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1009, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1009, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1009, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1009, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1009, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; __pyx_t_6 = (!__pyx_t_1); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1010 * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_ClearMarked() failed: invalid vertex v = {v}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1011 * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( * f"gp_ClearMarked() failed: invalid vertex v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1011, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_ClearMarked_failed_invalid_ve, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1011, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1010, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 1010, __pyx_L1_error) /* "planarity/full/graph.pyx":1009 * ValueError if v is neither a non-virtual nor a virtual vertex * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_ClearMarked() failed: invalid vertex v = {v}" */ } /* "planarity/full/graph.pyx":1014 * ) * * graphLib.gp_ClearMarked(self._theGraph, v) # <<<<<<<<<<<<<< * * def gp_SetMarked(self, int v) -> None: */ __pyx_f_9planarity_4full_8graphLib_gp_ClearMarked(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1014, __pyx_L1_error) /* "planarity/full/graph.pyx":1000 * return graphLib.gp_GetMarked(self._theGraph, v) * * def gp_ClearMarked(self, int v) -> None: # <<<<<<<<<<<<<< * """Clears the marked flag of vertex v. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ClearMarked", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1016 * graphLib.gp_ClearMarked(self._theGraph, v) * * def gp_SetMarked(self, int v) -> None: # <<<<<<<<<<<<<< * """Sets the marked flag of vertex v. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_119gp_SetMarked(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_118gp_SetMarked, "Graph.gp_SetMarked(self, int v) -> None\n\nSets the marked flag of vertex v.\n\nArgs:\n v: vertex whose marked flag you wish to set\n\nRaises:\n ValueError if v is neither a non-virtual nor a virtual vertex"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_119gp_SetMarked = {"gp_SetMarked", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_119gp_SetMarked, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_118gp_SetMarked}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_119gp_SetMarked(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_SetMarked (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1016, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1016, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_SetMarked", 0) < (0)) __PYX_ERR(0, 1016, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_SetMarked", 1, 1, 1, i); __PYX_ERR(0, 1016, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1016, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1016, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_SetMarked", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1016, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetMarked", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_118gp_SetMarked(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_118gp_SetMarked(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_SetMarked", 0); /* "planarity/full/graph.pyx":1025 * ValueError if v is neither a non-virtual nor a virtual vertex * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetMarked() failed: invalid vertex v = {v}" */ __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1025, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1025, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1025, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1025, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1025, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1025, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; __pyx_t_6 = (!__pyx_t_1); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1026 * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetMarked() failed: invalid vertex v = {v}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1027 * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( * f"gp_SetMarked() failed: invalid vertex v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1027, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetMarked_failed_invalid_vert, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1027, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1026, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 1026, __pyx_L1_error) /* "planarity/full/graph.pyx":1025 * ValueError if v is neither a non-virtual nor a virtual vertex * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetMarked() failed: invalid vertex v = {v}" */ } /* "planarity/full/graph.pyx":1030 * ) * * graphLib.gp_SetMarked(self._theGraph, v) # <<<<<<<<<<<<<< * * def gp_GetTwin(self, int e) -> int: */ __pyx_f_9planarity_4full_8graphLib_gp_SetMarked(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1030, __pyx_L1_error) /* "planarity/full/graph.pyx":1016 * graphLib.gp_ClearMarked(self._theGraph, v) * * def gp_SetMarked(self, int v) -> None: # <<<<<<<<<<<<<< * """Sets the marked flag of vertex v. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetMarked", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1032 * graphLib.gp_SetMarked(self._theGraph, v) * * def gp_GetTwin(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the twin edge record of the edge record indicated by e, * enabling constant-time navigation between the two halves of */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_121gp_GetTwin(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_120gp_GetTwin, "Graph.gp_GetTwin(self, int e) -> int\n\nGet the twin edge record of the edge record indicated by e,\nenabling constant-time navigation between the two halves of\nthe data structure representing an edge.\n\nArgs:\n e: edge whose twin edge record you wish to get\n\nReturns:\n The index of the twin edge record of e\n\nRaises:\n ValueError if e is not a valid in-use edge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_121gp_GetTwin = {"gp_GetTwin", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_121gp_GetTwin, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_120gp_GetTwin}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_121gp_GetTwin(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetTwin (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1032, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1032, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetTwin", 0) < (0)) __PYX_ERR(0, 1032, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetTwin", 1, 1, 1, i); __PYX_ERR(0, 1032, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1032, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1032, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetTwin", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1032, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetTwin", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_120gp_GetTwin(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_120gp_GetTwin(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetTwin", 0); /* "planarity/full/graph.pyx":1047 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetTwin() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1047, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1047, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1047, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1048 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetTwin() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1049 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_GetTwin() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1049, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetTwin_failed_invalid_edge_e, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1049, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1048, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1048, __pyx_L1_error) /* "planarity/full/graph.pyx":1047 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetTwin() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1052 * ) * * return graphLib.gp_GetTwin(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_GetNextEdge(self, int e) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_GetTwin(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1052, __pyx_L1_error) __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1052, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 1052, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1032 * graphLib.gp_SetMarked(self._theGraph, v) * * def gp_GetTwin(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the twin edge record of the edge record indicated by e, * enabling constant-time navigation between the two halves of */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetTwin", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1054 * return graphLib.gp_GetTwin(self._theGraph, e) * * def gp_GetNextEdge(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the next edge after e in the adjacency list containing e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_123gp_GetNextEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_122gp_GetNextEdge, "Graph.gp_GetNextEdge(self, int e) -> int\n\nGet the next edge after e in the adjacency list containing e.\n\nArgs:\n e: edge for which you wish to get next edge\n\nReturns:\n The next edge after e, or NIL if e is the last in the list\n\nRaises:\n ValueError if e is not a valid in-use edge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_123gp_GetNextEdge = {"gp_GetNextEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_123gp_GetNextEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_122gp_GetNextEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_123gp_GetNextEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetNextEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1054, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1054, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetNextEdge", 0) < (0)) __PYX_ERR(0, 1054, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetNextEdge", 1, 1, 1, i); __PYX_ERR(0, 1054, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1054, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1054, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetNextEdge", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1054, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetNextEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_122gp_GetNextEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_122gp_GetNextEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetNextEdge", 0); /* "planarity/full/graph.pyx":1067 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetNextEdge() failed: invalid edge index e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1067, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1067, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1067, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1068 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetNextEdge() failed: invalid edge index e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1069 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_GetNextEdge() failed: invalid edge index e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1069, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetNextEdge_failed_invalid_ed, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1069, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1068, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1068, __pyx_L1_error) /* "planarity/full/graph.pyx":1067 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetNextEdge() failed: invalid edge index e = {e}" */ } /* "planarity/full/graph.pyx":1072 * ) * * return graphLib.gp_GetNextEdge(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_GetPrevEdge(self, int e) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_GetNextEdge(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1072, __pyx_L1_error) __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1072, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 1072, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1054 * return graphLib.gp_GetTwin(self._theGraph, e) * * def gp_GetNextEdge(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the next edge after e in the adjacency list containing e. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetNextEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1074 * return graphLib.gp_GetNextEdge(self._theGraph, e) * * def gp_GetPrevEdge(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the previous edge before e in the adjacency list containing e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_125gp_GetPrevEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_124gp_GetPrevEdge, "Graph.gp_GetPrevEdge(self, int e) -> int\n\nGet the previous edge before e in the adjacency list containing e.\n\nArgs:\n e: edge for which you wish to get previous edge\n\nReturns:\n The previous edge before e, or NIL if e is the first\n\nRaises:\n ValueError if e is not a valid in-use edge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_125gp_GetPrevEdge = {"gp_GetPrevEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_125gp_GetPrevEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_124gp_GetPrevEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_125gp_GetPrevEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetPrevEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1074, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1074, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetPrevEdge", 0) < (0)) __PYX_ERR(0, 1074, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetPrevEdge", 1, 1, 1, i); __PYX_ERR(0, 1074, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1074, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1074, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetPrevEdge", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1074, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetPrevEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_124gp_GetPrevEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_124gp_GetPrevEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetPrevEdge", 0); /* "planarity/full/graph.pyx":1087 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetPrevEdge() failed: invalid edge index e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1087, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1087, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1087, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1088 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetPrevEdge() failed: invalid edge index e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1089 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_GetPrevEdge() failed: invalid edge index e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1089, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetPrevEdge_failed_invalid_ed, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1089, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1088, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1088, __pyx_L1_error) /* "planarity/full/graph.pyx":1087 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetPrevEdge() failed: invalid edge index e = {e}" */ } /* "planarity/full/graph.pyx":1092 * ) * * return graphLib.gp_GetPrevEdge(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_GetAdjacentEdge(self, int e, int theLink) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_GetPrevEdge(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1092, __pyx_L1_error) __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1092, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 1092, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1074 * return graphLib.gp_GetNextEdge(self._theGraph, e) * * def gp_GetPrevEdge(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the previous edge before e in the adjacency list containing e. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetPrevEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1094 * return graphLib.gp_GetPrevEdge(self._theGraph, e) * * def gp_GetAdjacentEdge(self, int e, int theLink) -> int: # <<<<<<<<<<<<<< * """Get the edge adjacent to e in direction indicated by theLink. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_127gp_GetAdjacentEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_126gp_GetAdjacentEdge, "Graph.gp_GetAdjacentEdge(self, int e, int theLink) -> int\n\nGet the edge adjacent to e in direction indicated by theLink.\n\nArgs:\n e: edge for which you wish to get edge adjacent in direction theLink\n theLink: either 0 for next edge or 1 for previous edge\n\nReturns:\n The edge adjacent to e in direction theLink, or NIL if e is \n the last in the direction given by theLink\n\nRaises:\n ValueError if e is not a valid in-use edge or \n if theLink is neither 0 nor 1"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_127gp_GetAdjacentEdge = {"gp_GetAdjacentEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_127gp_GetAdjacentEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_126gp_GetAdjacentEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_127gp_GetAdjacentEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; int __pyx_v_theLink; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetAdjacentEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,&__pyx_mstate_global->__pyx_n_u_theLink,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1094, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1094, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1094, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetAdjacentEdge", 0) < (0)) __PYX_ERR(0, 1094, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetAdjacentEdge", 1, 2, 2, i); __PYX_ERR(0, 1094, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1094, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1094, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1094, __pyx_L3_error) __pyx_v_theLink = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_theLink == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1094, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetAdjacentEdge", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1094, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetAdjacentEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_126gp_GetAdjacentEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e, __pyx_v_theLink); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_126gp_GetAdjacentEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e, int __pyx_v_theLink) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetAdjacentEdge", 0); /* "planarity/full/graph.pyx":1110 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetAdjacentEdge() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1110, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1111 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetAdjacentEdge() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1112 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_GetAdjacentEdge() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetAdjacentEdge_failed_invali, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1111, __pyx_L1_error) /* "planarity/full/graph.pyx":1110 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetAdjacentEdge() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1115 * ) * * if theLink != 0 and theLink != 1: # <<<<<<<<<<<<<< * raise ValueError( * "gp_GetAdjacentEdge() failed: invalid value for theLink = " */ switch (__pyx_v_theLink) { case 0: case 1: __pyx_t_6 = 0; break; default: __pyx_t_6 = 1; break; } if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1116 * * if theLink != 0 and theLink != 1: * raise ValueError( # <<<<<<<<<<<<<< * "gp_GetAdjacentEdge() failed: invalid value for theLink = " * f"{theLink}" */ __pyx_t_7 = NULL; /* "planarity/full/graph.pyx":1118 * raise ValueError( * "gp_GetAdjacentEdge() failed: invalid value for theLink = " * f"{theLink}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_theLink, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* "planarity/full/graph.pyx":1117 * if theLink != 0 and theLink != 1: * raise ValueError( * "gp_GetAdjacentEdge() failed: invalid value for theLink = " # <<<<<<<<<<<<<< * f"{theLink}" * ) */ __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetAdjacentEdge_failed_invali_2, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_2}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1116, __pyx_L1_error) /* "planarity/full/graph.pyx":1115 * ) * * if theLink != 0 and theLink != 1: # <<<<<<<<<<<<<< * raise ValueError( * "gp_GetAdjacentEdge() failed: invalid value for theLink = " */ } /* "planarity/full/graph.pyx":1121 * ) * * return graphLib.gp_GetAdjacentEdge(self._theGraph, e, theLink) # <<<<<<<<<<<<<< * * def gp_SetNextEdge(self, int e, int newNextEdge) -> None: */ __Pyx_XDECREF(__pyx_r); __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_GetAdjacentEdge(__pyx_v_self->_theGraph, __pyx_v_e, __pyx_v_theLink); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1121, __pyx_L1_error) __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 1121, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1094 * return graphLib.gp_GetPrevEdge(self._theGraph, e) * * def gp_GetAdjacentEdge(self, int e, int theLink) -> int: # <<<<<<<<<<<<<< * """Get the edge adjacent to e in direction indicated by theLink. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetAdjacentEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1123 * return graphLib.gp_GetAdjacentEdge(self._theGraph, e, theLink) * * def gp_SetNextEdge(self, int e, int newNextEdge) -> None: # <<<<<<<<<<<<<< * """Set the next edge after e to newNextEdge. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_129gp_SetNextEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_128gp_SetNextEdge, "Graph.gp_SetNextEdge(self, int e, int newNextEdge) -> None\n\nSet the next edge after e to newNextEdge.\n\nArgs:\n e: edge for which you wish to set the next edge\n newNextEdge: the next edge for e, or NIL\n\nRaises:\n ValueError if e is not a valid in-use edge, or if\n newNextEdge is neither NIL nor a valid in-use edge "); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_129gp_SetNextEdge = {"gp_SetNextEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_129gp_SetNextEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_128gp_SetNextEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_129gp_SetNextEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; int __pyx_v_newNextEdge; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_SetNextEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,&__pyx_mstate_global->__pyx_n_u_newNextEdge,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1123, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1123, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1123, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_SetNextEdge", 0) < (0)) __PYX_ERR(0, 1123, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_SetNextEdge", 1, 2, 2, i); __PYX_ERR(0, 1123, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1123, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1123, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1123, __pyx_L3_error) __pyx_v_newNextEdge = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_newNextEdge == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1123, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_SetNextEdge", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1123, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetNextEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_128gp_SetNextEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e, __pyx_v_newNextEdge); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_128gp_SetNextEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e, int __pyx_v_newNextEdge) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_SetNextEdge", 0); /* "planarity/full/graph.pyx":1135 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetNextEdge() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1135, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1136 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetNextEdge() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1137 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_SetNextEdge() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetNextEdge_failed_invalid_ed, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1136, __pyx_L1_error) /* "planarity/full/graph.pyx":1135 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetNextEdge() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1140 * ) * * if newNextEdge != NIL and not self.gp_EdgeInUse(newNextEdge): # <<<<<<<<<<<<<< * raise ValueError( * "gp_SetNextEdge() failed: invalid edge newNextEdge = " */ __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_newNextEdge); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1140, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_NIL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1140, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1140, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1140, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_7 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_7); __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_newNextEdge); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1140, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_1}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1140, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1140, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_8 = (!__pyx_t_5); __pyx_t_6 = __pyx_t_8; __pyx_L5_bool_binop_done:; if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1141 * * if newNextEdge != NIL and not self.gp_EdgeInUse(newNextEdge): * raise ValueError( # <<<<<<<<<<<<<< * "gp_SetNextEdge() failed: invalid edge newNextEdge = " * f"{newNextEdge}" */ __pyx_t_1 = NULL; /* "planarity/full/graph.pyx":1143 * raise ValueError( * "gp_SetNextEdge() failed: invalid edge newNextEdge = " * f"{newNextEdge}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_7 = __Pyx_PyUnicode_From_int(__pyx_v_newNextEdge, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1143, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); /* "planarity/full/graph.pyx":1142 * if newNextEdge != NIL and not self.gp_EdgeInUse(newNextEdge): * raise ValueError( * "gp_SetNextEdge() failed: invalid edge newNextEdge = " # <<<<<<<<<<<<<< * f"{newNextEdge}" * ) */ __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetNextEdge_failed_invalid_ed_2, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1142, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_2}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1141, __pyx_L1_error) /* "planarity/full/graph.pyx":1140 * ) * * if newNextEdge != NIL and not self.gp_EdgeInUse(newNextEdge): # <<<<<<<<<<<<<< * raise ValueError( * "gp_SetNextEdge() failed: invalid edge newNextEdge = " */ } /* "planarity/full/graph.pyx":1146 * ) * * graphLib.gp_SetNextEdge(self._theGraph, e, newNextEdge) # <<<<<<<<<<<<<< * * def gp_SetPrevEdge(self, int e, int newPrevEdge) -> None: */ __pyx_f_9planarity_4full_8graphLib_gp_SetNextEdge(__pyx_v_self->_theGraph, __pyx_v_e, __pyx_v_newNextEdge); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1146, __pyx_L1_error) /* "planarity/full/graph.pyx":1123 * return graphLib.gp_GetAdjacentEdge(self._theGraph, e, theLink) * * def gp_SetNextEdge(self, int e, int newNextEdge) -> None: # <<<<<<<<<<<<<< * """Set the next edge after e to newNextEdge. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetNextEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1148 * graphLib.gp_SetNextEdge(self._theGraph, e, newNextEdge) * * def gp_SetPrevEdge(self, int e, int newPrevEdge) -> None: # <<<<<<<<<<<<<< * """Set the previous edge before e to newPrevEdge. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_131gp_SetPrevEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_130gp_SetPrevEdge, "Graph.gp_SetPrevEdge(self, int e, int newPrevEdge) -> None\n\nSet the previous edge before e to newPrevEdge.\n\nArgs:\n e: edge for which you wish to set previous edge\n newPrevEdge: the previous edge for e, or NIL\n\nRaises:\n ValueError if e is not a valid in-use edge, or if\n newPrevEdge is neither NIL nor a valid in-use edge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_131gp_SetPrevEdge = {"gp_SetPrevEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_131gp_SetPrevEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_130gp_SetPrevEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_131gp_SetPrevEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; int __pyx_v_newPrevEdge; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_SetPrevEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,&__pyx_mstate_global->__pyx_n_u_newPrevEdge,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1148, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1148, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1148, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_SetPrevEdge", 0) < (0)) __PYX_ERR(0, 1148, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_SetPrevEdge", 1, 2, 2, i); __PYX_ERR(0, 1148, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1148, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1148, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1148, __pyx_L3_error) __pyx_v_newPrevEdge = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_newPrevEdge == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1148, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_SetPrevEdge", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1148, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetPrevEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_130gp_SetPrevEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e, __pyx_v_newPrevEdge); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_130gp_SetPrevEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e, int __pyx_v_newPrevEdge) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_SetPrevEdge", 0); /* "planarity/full/graph.pyx":1160 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetPrevEdge() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1160, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1161 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetPrevEdge() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1162 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_SetPrevEdge() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetPrevEdge_failed_invalid_ed, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1161, __pyx_L1_error) /* "planarity/full/graph.pyx":1160 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetPrevEdge() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1165 * ) * * if newPrevEdge != NIL and not self.gp_EdgeInUse(newPrevEdge): # <<<<<<<<<<<<<< * raise ValueError( * "gp_SetPrevEdge() failed: invalid edge newPrevEdge = " */ __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_newPrevEdge); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_NIL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1165, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1165, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_7 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_7); __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_newPrevEdge); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_1}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1165, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_8 = (!__pyx_t_5); __pyx_t_6 = __pyx_t_8; __pyx_L5_bool_binop_done:; if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1166 * * if newPrevEdge != NIL and not self.gp_EdgeInUse(newPrevEdge): * raise ValueError( # <<<<<<<<<<<<<< * "gp_SetPrevEdge() failed: invalid edge newPrevEdge = " * f"{newPrevEdge}" */ __pyx_t_1 = NULL; /* "planarity/full/graph.pyx":1168 * raise ValueError( * "gp_SetPrevEdge() failed: invalid edge newPrevEdge = " * f"{newPrevEdge}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_7 = __Pyx_PyUnicode_From_int(__pyx_v_newPrevEdge, 0, ' ', 'd'); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); /* "planarity/full/graph.pyx":1167 * if newPrevEdge != NIL and not self.gp_EdgeInUse(newPrevEdge): * raise ValueError( * "gp_SetPrevEdge() failed: invalid edge newPrevEdge = " # <<<<<<<<<<<<<< * f"{newPrevEdge}" * ) */ __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetPrevEdge_failed_invalid_ed_2, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_2}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1166, __pyx_L1_error) /* "planarity/full/graph.pyx":1165 * ) * * if newPrevEdge != NIL and not self.gp_EdgeInUse(newPrevEdge): # <<<<<<<<<<<<<< * raise ValueError( * "gp_SetPrevEdge() failed: invalid edge newPrevEdge = " */ } /* "planarity/full/graph.pyx":1171 * ) * * graphLib.gp_SetPrevEdge(self._theGraph, e, newPrevEdge) # <<<<<<<<<<<<<< * * def gp_SetAdjacentEdge(self, int e, int theLink, int newEdge) -> None: */ __pyx_f_9planarity_4full_8graphLib_gp_SetPrevEdge(__pyx_v_self->_theGraph, __pyx_v_e, __pyx_v_newPrevEdge); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1171, __pyx_L1_error) /* "planarity/full/graph.pyx":1148 * graphLib.gp_SetNextEdge(self._theGraph, e, newNextEdge) * * def gp_SetPrevEdge(self, int e, int newPrevEdge) -> None: # <<<<<<<<<<<<<< * """Set the previous edge before e to newPrevEdge. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetPrevEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1173 * graphLib.gp_SetPrevEdge(self._theGraph, e, newPrevEdge) * * def gp_SetAdjacentEdge(self, int e, int theLink, int newEdge) -> None: # <<<<<<<<<<<<<< * """Set the edge adjacent to e in direction indicated by theLink. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_133gp_SetAdjacentEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_132gp_SetAdjacentEdge, "Graph.gp_SetAdjacentEdge(self, int e, int theLink, int newEdge) -> None\n\nSet the edge adjacent to e in direction indicated by theLink.\n\nArgs:\n e: edge for which you wish to set edge adjacent in direction theLink\n theLink: either 0 for the next edge or 1 for the previous edge\n newEdge: the next or previous edge for e, or NIL\n\nRaises:\n ValueError if e is not a valid in-use edge, or if\n newEdge is neither NIL nor a valid in-use edge, or if\n theLink is neither 0 nor 1"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_133gp_SetAdjacentEdge = {"gp_SetAdjacentEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_133gp_SetAdjacentEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_132gp_SetAdjacentEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_133gp_SetAdjacentEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; int __pyx_v_theLink; int __pyx_v_newEdge; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[3] = {0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_SetAdjacentEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,&__pyx_mstate_global->__pyx_n_u_theLink,&__pyx_mstate_global->__pyx_n_u_newEdge,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1173, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 3: values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1173, __pyx_L3_error) CYTHON_FALLTHROUGH; case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1173, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1173, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_SetAdjacentEdge", 0) < (0)) __PYX_ERR(0, 1173, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 3; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_SetAdjacentEdge", 1, 3, 3, i); __PYX_ERR(0, 1173, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 3)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1173, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1173, __pyx_L3_error) values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1173, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1173, __pyx_L3_error) __pyx_v_theLink = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_theLink == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1173, __pyx_L3_error) __pyx_v_newEdge = __Pyx_PyLong_As_int(values[2]); if (unlikely((__pyx_v_newEdge == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1173, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_SetAdjacentEdge", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1173, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetAdjacentEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_132gp_SetAdjacentEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e, __pyx_v_theLink, __pyx_v_newEdge); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_132gp_SetAdjacentEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e, int __pyx_v_theLink, int __pyx_v_newEdge) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_SetAdjacentEdge", 0); /* "planarity/full/graph.pyx":1187 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetAdjacentEdge() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1187, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1187, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1187, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1188 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetAdjacentEdge() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1189 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_SetAdjacentEdge() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetAdjacentEdge_failed_invali, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1188, __pyx_L1_error) /* "planarity/full/graph.pyx":1187 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetAdjacentEdge() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1192 * ) * * if theLink != 0 and theLink != 1: # <<<<<<<<<<<<<< * raise ValueError( * "gp_SetAdjacentEdge() failed: invalid value for theLink = " */ switch (__pyx_v_theLink) { case 0: case 1: __pyx_t_6 = 0; break; default: __pyx_t_6 = 1; break; } if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1193 * * if theLink != 0 and theLink != 1: * raise ValueError( # <<<<<<<<<<<<<< * "gp_SetAdjacentEdge() failed: invalid value for theLink = " * f"{theLink}" */ __pyx_t_7 = NULL; /* "planarity/full/graph.pyx":1195 * raise ValueError( * "gp_SetAdjacentEdge() failed: invalid value for theLink = " * f"{theLink}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_theLink, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* "planarity/full/graph.pyx":1194 * if theLink != 0 and theLink != 1: * raise ValueError( * "gp_SetAdjacentEdge() failed: invalid value for theLink = " # <<<<<<<<<<<<<< * f"{theLink}" * ) */ __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetAdjacentEdge_failed_invali_2, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_2}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1193, __pyx_L1_error) /* "planarity/full/graph.pyx":1192 * ) * * if theLink != 0 and theLink != 1: # <<<<<<<<<<<<<< * raise ValueError( * "gp_SetAdjacentEdge() failed: invalid value for theLink = " */ } /* "planarity/full/graph.pyx":1198 * ) * * if newEdge != NIL and not self.gp_EdgeInUse(newEdge): # <<<<<<<<<<<<<< * raise ValueError( * "gp_SetAdjacentEdge() failed: invalid edge newEdge = " */ __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_newEdge); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_NIL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1198, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1198, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L6_bool_binop_done; } __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_newEdge); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_1}; __pyx_t_7 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1198, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = (!__pyx_t_5); __pyx_t_6 = __pyx_t_8; __pyx_L6_bool_binop_done:; if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1199 * * if newEdge != NIL and not self.gp_EdgeInUse(newEdge): * raise ValueError( # <<<<<<<<<<<<<< * "gp_SetAdjacentEdge() failed: invalid edge newEdge = " * f"{newEdge}" */ __pyx_t_1 = NULL; /* "planarity/full/graph.pyx":1201 * raise ValueError( * "gp_SetAdjacentEdge() failed: invalid edge newEdge = " * f"{newEdge}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_newEdge, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); /* "planarity/full/graph.pyx":1200 * if newEdge != NIL and not self.gp_EdgeInUse(newEdge): * raise ValueError( * "gp_SetAdjacentEdge() failed: invalid edge newEdge = " # <<<<<<<<<<<<<< * f"{newEdge}" * ) */ __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetAdjacentEdge_failed_invali_3, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_3}; __pyx_t_7 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); } __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __PYX_ERR(0, 1199, __pyx_L1_error) /* "planarity/full/graph.pyx":1198 * ) * * if newEdge != NIL and not self.gp_EdgeInUse(newEdge): # <<<<<<<<<<<<<< * raise ValueError( * "gp_SetAdjacentEdge() failed: invalid edge newEdge = " */ } /* "planarity/full/graph.pyx":1204 * ) * * graphLib.gp_SetAdjacentEdge(self._theGraph, e, theLink, newEdge) # <<<<<<<<<<<<<< * * def gp_IsEdge(self, int e) -> int: */ __pyx_f_9planarity_4full_8graphLib_gp_SetAdjacentEdge(__pyx_v_self->_theGraph, __pyx_v_e, __pyx_v_theLink, __pyx_v_newEdge); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1204, __pyx_L1_error) /* "planarity/full/graph.pyx":1173 * graphLib.gp_SetPrevEdge(self._theGraph, e, newPrevEdge) * * def gp_SetAdjacentEdge(self, int e, int theLink, int newEdge) -> None: # <<<<<<<<<<<<<< * """Set the edge adjacent to e in direction indicated by theLink. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetAdjacentEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1206 * graphLib.gp_SetAdjacentEdge(self._theGraph, e, theLink, newEdge) * * def gp_IsEdge(self, int e) -> int: # <<<<<<<<<<<<<< * """Check if e corresponds to an edge location in the edge storage * of the graph. */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_135gp_IsEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_134gp_IsEdge, "Graph.gp_IsEdge(self, int e) -> int\n\nCheck if e corresponds to an edge location in the edge storage\nof the graph.\n\nArgs:\n e: candidate edge to verify is an edge location in the graph\n\nReturns:\n TRUE if e is a valid edge and the value returned by C-layer\n gp_IsEdge() is truthy, FALSE otherwise."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_135gp_IsEdge = {"gp_IsEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_135gp_IsEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_134gp_IsEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_135gp_IsEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_IsEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1206, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1206, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_IsEdge", 0) < (0)) __PYX_ERR(0, 1206, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_IsEdge", 1, 1, 1, i); __PYX_ERR(0, 1206, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1206, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1206, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_IsEdge", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1206, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_134gp_IsEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_134gp_IsEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_IsEdge", 0); /* "planarity/full/graph.pyx":1218 * """ * if ( * (e >= self.gp_LowerBoundEdgeStorage()) and # <<<<<<<<<<<<<< * (e < self.gp_UpperBoundEdgeStorage()) and * graphLib.gp_IsEdge(self._theGraph, e) */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_LowerBoundEdgeStorage, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1218, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1218, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } /* "planarity/full/graph.pyx":1219 * if ( * (e >= self.gp_LowerBoundEdgeStorage()) and * (e < self.gp_UpperBoundEdgeStorage()) and # <<<<<<<<<<<<<< * graphLib.gp_IsEdge(self._theGraph, e) * ): */ __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_UpperBoundEdgeStorage, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1219, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1219, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } /* "planarity/full/graph.pyx":1220 * (e >= self.gp_LowerBoundEdgeStorage()) and * (e < self.gp_UpperBoundEdgeStorage()) and * graphLib.gp_IsEdge(self._theGraph, e) # <<<<<<<<<<<<<< * ): * return TRUE */ __pyx_t_7 = __pyx_f_9planarity_4full_8graphLib_gp_IsEdge(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1220, __pyx_L1_error) __pyx_t_6 = (__pyx_t_7 != 0); __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; /* "planarity/full/graph.pyx":1217 * gp_IsEdge() is truthy, FALSE otherwise. * """ * if ( # <<<<<<<<<<<<<< * (e >= self.gp_LowerBoundEdgeStorage()) and * (e < self.gp_UpperBoundEdgeStorage()) and */ if (__pyx_t_1) { /* "planarity/full/graph.pyx":1222 * graphLib.gp_IsEdge(self._theGraph, e) * ): * return TRUE # <<<<<<<<<<<<<< * * return FALSE */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_TRUE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 1222, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1217 * gp_IsEdge() is truthy, FALSE otherwise. * """ * if ( # <<<<<<<<<<<<<< * (e >= self.gp_LowerBoundEdgeStorage()) and * (e < self.gp_UpperBoundEdgeStorage()) and */ } /* "planarity/full/graph.pyx":1224 * return TRUE * * return FALSE # <<<<<<<<<<<<<< * * def gp_IsNotEdge(self, int e) -> int: */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FALSE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 1224, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1206 * graphLib.gp_SetAdjacentEdge(self._theGraph, e, theLink, newEdge) * * def gp_IsEdge(self, int e) -> int: # <<<<<<<<<<<<<< * """Check if e corresponds to an edge location in the edge storage * of the graph. */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1226 * return FALSE * * def gp_IsNotEdge(self, int e) -> int: # <<<<<<<<<<<<<< * """Check if e does not correspond to an edge location in the * edge storage of the graph. */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_137gp_IsNotEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_136gp_IsNotEdge, "Graph.gp_IsNotEdge(self, int e) -> int\n\nCheck if e does not correspond to an edge location in the \nedge storage of the graph.\n\nArgs:\n e: candidate edge to verify is not an edge location in the graph\n\nReturns:\n TRUE if e is not a valid edge or the value returned by C-layer\n gp_IsNotEdge() is truthy, FALSE otherwise."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_137gp_IsNotEdge = {"gp_IsNotEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_137gp_IsNotEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_136gp_IsNotEdge}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_137gp_IsNotEdge(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_IsNotEdge (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1226, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1226, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_IsNotEdge", 0) < (0)) __PYX_ERR(0, 1226, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_IsNotEdge", 1, 1, 1, i); __PYX_ERR(0, 1226, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1226, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1226, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_IsNotEdge", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1226, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsNotEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_136gp_IsNotEdge(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_136gp_IsNotEdge(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_IsNotEdge", 0); /* "planarity/full/graph.pyx":1238 * """ * if ( * (e < self.gp_LowerBoundEdgeStorage()) or # <<<<<<<<<<<<<< * (e >= self.gp_UpperBoundEdgeStorage()) or * graphLib.gp_IsNotEdge(self._theGraph, e) */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_LowerBoundEdgeStorage, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1238, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1238, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } /* "planarity/full/graph.pyx":1239 * if ( * (e < self.gp_LowerBoundEdgeStorage()) or * (e >= self.gp_UpperBoundEdgeStorage()) or # <<<<<<<<<<<<<< * graphLib.gp_IsNotEdge(self._theGraph, e) * ): */ __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1239, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_UpperBoundEdgeStorage, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1239, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1239, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1239, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } /* "planarity/full/graph.pyx":1240 * (e < self.gp_LowerBoundEdgeStorage()) or * (e >= self.gp_UpperBoundEdgeStorage()) or * graphLib.gp_IsNotEdge(self._theGraph, e) # <<<<<<<<<<<<<< * ): * return TRUE */ __pyx_t_7 = __pyx_f_9planarity_4full_8graphLib_gp_IsNotEdge(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1240, __pyx_L1_error) __pyx_t_6 = (__pyx_t_7 != 0); __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; /* "planarity/full/graph.pyx":1237 * gp_IsNotEdge() is truthy, FALSE otherwise. * """ * if ( # <<<<<<<<<<<<<< * (e < self.gp_LowerBoundEdgeStorage()) or * (e >= self.gp_UpperBoundEdgeStorage()) or */ if (__pyx_t_1) { /* "planarity/full/graph.pyx":1242 * graphLib.gp_IsNotEdge(self._theGraph, e) * ): * return TRUE # <<<<<<<<<<<<<< * * return FALSE */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_TRUE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 1242, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1237 * gp_IsNotEdge() is truthy, FALSE otherwise. * """ * if ( # <<<<<<<<<<<<<< * (e < self.gp_LowerBoundEdgeStorage()) or * (e >= self.gp_UpperBoundEdgeStorage()) or */ } /* "planarity/full/graph.pyx":1244 * return TRUE * * return FALSE # <<<<<<<<<<<<<< * * def gp_GetNeighbor(self, int e) -> int: */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FALSE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1244, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 1244, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1226 * return FALSE * * def gp_IsNotEdge(self, int e) -> int: # <<<<<<<<<<<<<< * """Check if e does not correspond to an edge location in the * edge storage of the graph. */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsNotEdge", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1246 * return FALSE * * def gp_GetNeighbor(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the neighbor vertex indicated by an in-use edge e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_139gp_GetNeighbor(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_138gp_GetNeighbor, "Graph.gp_GetNeighbor(self, int e) -> int\n\nGet the neighbor vertex indicated by an in-use edge e.\n\nArgs:\n e: an in-use edge in the adjacency list of a vertex v\n\nReturns:\n The vertex that e indicates is a neighbor of vertex v\n\nRaises:\n ValueError if e is not a valid in-use edge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_139gp_GetNeighbor = {"gp_GetNeighbor", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_139gp_GetNeighbor, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_138gp_GetNeighbor}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_139gp_GetNeighbor(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetNeighbor (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1246, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1246, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetNeighbor", 0) < (0)) __PYX_ERR(0, 1246, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetNeighbor", 1, 1, 1, i); __PYX_ERR(0, 1246, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1246, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1246, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetNeighbor", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1246, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetNeighbor", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_138gp_GetNeighbor(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_138gp_GetNeighbor(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetNeighbor", 0); /* "planarity/full/graph.pyx":1259 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetNeighbor() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1259, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1260 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetNeighbor() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1261 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_GetNeighbor() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetNeighbor_failed_invalid_ed, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1260, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1260, __pyx_L1_error) /* "planarity/full/graph.pyx":1259 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetNeighbor() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1264 * ) * * return graphLib.gp_GetNeighbor(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_SetNeighbor(self, int e, int v) -> None: */ __Pyx_XDECREF(__pyx_r); __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_GetNeighbor(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1264, __pyx_L1_error) __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1264, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 1264, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1246 * return FALSE * * def gp_GetNeighbor(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the neighbor vertex indicated by an in-use edge e. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetNeighbor", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1266 * return graphLib.gp_GetNeighbor(self._theGraph, e) * * def gp_SetNeighbor(self, int e, int v) -> None: # <<<<<<<<<<<<<< * """Set the neighbor vertex of an in-use edge e to v. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_141gp_SetNeighbor(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_140gp_SetNeighbor, "Graph.gp_SetNeighbor(self, int e, int v) -> None\n\nSet the neighbor vertex of an in-use edge e to v.\n\nArgs:\n e: an in-use edge whose neighbor vertex you wish to set\n v: the vertex you wish to set as the neighbor of edge e\nRaises:\n ValueError if e is not a valid in-use edge, or if v is not a \n non-virtual nor a virtual vertex."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_141gp_SetNeighbor = {"gp_SetNeighbor", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_141gp_SetNeighbor, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_140gp_SetNeighbor}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_141gp_SetNeighbor(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_SetNeighbor (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1266, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1266, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1266, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_SetNeighbor", 0) < (0)) __PYX_ERR(0, 1266, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_SetNeighbor", 1, 2, 2, i); __PYX_ERR(0, 1266, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1266, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1266, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1266, __pyx_L3_error) __pyx_v_v = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1266, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_SetNeighbor", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1266, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetNeighbor", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_140gp_SetNeighbor(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e, __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_140gp_SetNeighbor(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_SetNeighbor", 0); /* "planarity/full/graph.pyx":1277 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetNeighbor() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1277, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1277, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1277, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1278 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetNeighbor() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1279 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_SetNeighbor() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1279, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetNeighbor_failed_invalid_ed, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1279, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1278, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1278, __pyx_L1_error) /* "planarity/full/graph.pyx":1277 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetNeighbor() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1282 * ) * * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetNeighbor() failed: invalid vertex v = {v}" */ __pyx_t_7 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_7); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1282, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1282, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = __pyx_t_5; __pyx_L5_bool_binop_done:; __pyx_t_5 = (!__pyx_t_6); if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":1283 * * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetNeighbor() failed: invalid vertex v = {v}" * ) */ __pyx_t_7 = NULL; /* "planarity/full/graph.pyx":1284 * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( * f"gp_SetNeighbor() failed: invalid vertex v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1284, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetNeighbor_failed_invalid_ve, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1284, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_2}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1283, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1283, __pyx_L1_error) /* "planarity/full/graph.pyx":1282 * ) * * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetNeighbor() failed: invalid vertex v = {v}" */ } /* "planarity/full/graph.pyx":1287 * ) * * graphLib.gp_SetNeighbor(self._theGraph, e, v) # <<<<<<<<<<<<<< * * def gp_InitEdgeFlags(self, int e) -> None: */ __pyx_f_9planarity_4full_8graphLib_gp_SetNeighbor(__pyx_v_self->_theGraph, __pyx_v_e, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1287, __pyx_L1_error) /* "planarity/full/graph.pyx":1266 * return graphLib.gp_GetNeighbor(self._theGraph, e) * * def gp_SetNeighbor(self, int e, int v) -> None: # <<<<<<<<<<<<<< * """Set the neighbor vertex of an in-use edge e to v. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetNeighbor", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1289 * graphLib.gp_SetNeighbor(self._theGraph, e, v) * * def gp_InitEdgeFlags(self, int e) -> None: # <<<<<<<<<<<<<< * """Initialize the edge flags of an in-use edge e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_143gp_InitEdgeFlags(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_142gp_InitEdgeFlags, "Graph.gp_InitEdgeFlags(self, int e) -> None\n\nInitialize the edge flags of an in-use edge e.\n\nArgs:\n e: an in-use edge whose edge flags you wish to initialize\n\nRaises:\n ValueError if e is not a valid in-use edge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_143gp_InitEdgeFlags = {"gp_InitEdgeFlags", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_143gp_InitEdgeFlags, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_142gp_InitEdgeFlags}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_143gp_InitEdgeFlags(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_InitEdgeFlags (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1289, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1289, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_InitEdgeFlags", 0) < (0)) __PYX_ERR(0, 1289, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_InitEdgeFlags", 1, 1, 1, i); __PYX_ERR(0, 1289, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1289, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1289, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_InitEdgeFlags", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1289, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_InitEdgeFlags", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_142gp_InitEdgeFlags(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_142gp_InitEdgeFlags(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_InitEdgeFlags", 0); /* "planarity/full/graph.pyx":1299 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_InitEdgeFlags() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1299, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1300 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_InitEdgeFlags() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1301 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_InitEdgeFlags() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_InitEdgeFlags_failed_invalid, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1300, __pyx_L1_error) /* "planarity/full/graph.pyx":1299 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_InitEdgeFlags() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1304 * ) * * graphLib.gp_InitEdgeFlags(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_GetEdgeVisited(self, int e) -> int: */ __pyx_f_9planarity_4full_8graphLib_gp_InitEdgeFlags(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1304, __pyx_L1_error) /* "planarity/full/graph.pyx":1289 * graphLib.gp_SetNeighbor(self._theGraph, e, v) * * def gp_InitEdgeFlags(self, int e) -> None: # <<<<<<<<<<<<<< * """Initialize the edge flags of an in-use edge e. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_InitEdgeFlags", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1306 * graphLib.gp_InitEdgeFlags(self._theGraph, e) * * def gp_GetEdgeVisited(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the edge visited flag of an in-use edge e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_145gp_GetEdgeVisited(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_144gp_GetEdgeVisited, "Graph.gp_GetEdgeVisited(self, int e) -> int\n\nGet the edge visited flag of an in-use edge e.\n\nArgs:\n e: an in-use edge whose edge visited flag you wish to get\n\nReturns:\n The edge visited flag for e, i.e., 0 (falsy) or EDGE_VISITED_MASK (truthy)\n\nRaises:\n ValueError if e is not a valid in-use edge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_145gp_GetEdgeVisited = {"gp_GetEdgeVisited", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_145gp_GetEdgeVisited, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_144gp_GetEdgeVisited}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_145gp_GetEdgeVisited(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetEdgeVisited (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1306, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1306, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetEdgeVisited", 0) < (0)) __PYX_ERR(0, 1306, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetEdgeVisited", 1, 1, 1, i); __PYX_ERR(0, 1306, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1306, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1306, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetEdgeVisited", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1306, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetEdgeVisited", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_144gp_GetEdgeVisited(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_144gp_GetEdgeVisited(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetEdgeVisited", 0); /* "planarity/full/graph.pyx":1319 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetEdgeVisited() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1319, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1319, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1319, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1320 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetEdgeVisited() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1321 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_GetEdgeVisited() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1321, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetEdgeVisited_failed_invalid, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1321, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1320, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1320, __pyx_L1_error) /* "planarity/full/graph.pyx":1319 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetEdgeVisited() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1324 * ) * * return graphLib.gp_GetEdgeVisited(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_ClearEdgeVisited(self, int e) -> None: */ __Pyx_XDECREF(__pyx_r); __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_GetEdgeVisited(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1324, __pyx_L1_error) __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1324, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 1324, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1306 * graphLib.gp_InitEdgeFlags(self._theGraph, e) * * def gp_GetEdgeVisited(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the edge visited flag of an in-use edge e. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetEdgeVisited", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1326 * return graphLib.gp_GetEdgeVisited(self._theGraph, e) * * def gp_ClearEdgeVisited(self, int e) -> None: # <<<<<<<<<<<<<< * """Clears the edge visited flag of an in-use edge e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_147gp_ClearEdgeVisited(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_146gp_ClearEdgeVisited, "Graph.gp_ClearEdgeVisited(self, int e) -> None\n\nClears the edge visited flag of an in-use edge e.\n\nArgs:\n e: an in-use edge whose edge visited flag you wish to clear\n\nRaises:\n ValueError if e is not a valid in-use edge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_147gp_ClearEdgeVisited = {"gp_ClearEdgeVisited", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_147gp_ClearEdgeVisited, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_146gp_ClearEdgeVisited}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_147gp_ClearEdgeVisited(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ClearEdgeVisited (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1326, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1326, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_ClearEdgeVisited", 0) < (0)) __PYX_ERR(0, 1326, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_ClearEdgeVisited", 1, 1, 1, i); __PYX_ERR(0, 1326, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1326, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1326, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_ClearEdgeVisited", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1326, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ClearEdgeVisited", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_146gp_ClearEdgeVisited(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_146gp_ClearEdgeVisited(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_ClearEdgeVisited", 0); /* "planarity/full/graph.pyx":1336 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_ClearEdgeVisited() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1336, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1336, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1336, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1337 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_ClearEdgeVisited() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1338 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_ClearEdgeVisited() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_ClearEdgeVisited_failed_inval, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1337, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1337, __pyx_L1_error) /* "planarity/full/graph.pyx":1336 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_ClearEdgeVisited() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1341 * ) * * graphLib.gp_ClearEdgeVisited(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_SetEdgeVisited(self, int e) -> None: */ __pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeVisited(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1341, __pyx_L1_error) /* "planarity/full/graph.pyx":1326 * return graphLib.gp_GetEdgeVisited(self._theGraph, e) * * def gp_ClearEdgeVisited(self, int e) -> None: # <<<<<<<<<<<<<< * """Clears the edge visited flag of an in-use edge e. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ClearEdgeVisited", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1343 * graphLib.gp_ClearEdgeVisited(self._theGraph, e) * * def gp_SetEdgeVisited(self, int e) -> None: # <<<<<<<<<<<<<< * """Set the edge visited flag of an in-use edge e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_149gp_SetEdgeVisited(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_148gp_SetEdgeVisited, "Graph.gp_SetEdgeVisited(self, int e) -> None\n\nSet the edge visited flag of an in-use edge e.\n\nArgs:\n e: an in-use edge whose edge visited flag you wish to set\n\nRaises:\n ValueError if e is not a valid in-use edge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_149gp_SetEdgeVisited = {"gp_SetEdgeVisited", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_149gp_SetEdgeVisited, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_148gp_SetEdgeVisited}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_149gp_SetEdgeVisited(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_SetEdgeVisited (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1343, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1343, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_SetEdgeVisited", 0) < (0)) __PYX_ERR(0, 1343, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_SetEdgeVisited", 1, 1, 1, i); __PYX_ERR(0, 1343, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1343, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1343, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_SetEdgeVisited", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1343, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetEdgeVisited", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_148gp_SetEdgeVisited(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_148gp_SetEdgeVisited(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_SetEdgeVisited", 0); /* "planarity/full/graph.pyx":1353 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetEdgeVisited() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1353, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1353, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1353, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1354 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetEdgeVisited() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1355 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_SetEdgeVisited() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1355, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetEdgeVisited_failed_invalid, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1355, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1354, __pyx_L1_error) /* "planarity/full/graph.pyx":1353 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetEdgeVisited() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1358 * ) * * graphLib.gp_SetEdgeVisited(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_GetEdgeMarked(self, int e) -> int: */ __pyx_f_9planarity_4full_8graphLib_gp_SetEdgeVisited(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1358, __pyx_L1_error) /* "planarity/full/graph.pyx":1343 * graphLib.gp_ClearEdgeVisited(self._theGraph, e) * * def gp_SetEdgeVisited(self, int e) -> None: # <<<<<<<<<<<<<< * """Set the edge visited flag of an in-use edge e. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetEdgeVisited", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1360 * graphLib.gp_SetEdgeVisited(self._theGraph, e) * * def gp_GetEdgeMarked(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the edge marked flag of an in-use edge e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_151gp_GetEdgeMarked(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_150gp_GetEdgeMarked, "Graph.gp_GetEdgeMarked(self, int e) -> int\n\nGet the edge marked flag of an in-use edge e.\n\nArgs:\n e: an in-use edge whose edge marked flag you wish to get\n\nReturns:\n The edge visited flag for e, i.e., 0 (falsy) or EDGE_MARKED_MASK (truthy)\n\nRaises:\n ValueError if e is not a valid in-use edge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_151gp_GetEdgeMarked = {"gp_GetEdgeMarked", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_151gp_GetEdgeMarked, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_150gp_GetEdgeMarked}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_151gp_GetEdgeMarked(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetEdgeMarked (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1360, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1360, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetEdgeMarked", 0) < (0)) __PYX_ERR(0, 1360, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetEdgeMarked", 1, 1, 1, i); __PYX_ERR(0, 1360, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1360, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1360, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetEdgeMarked", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1360, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetEdgeMarked", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_150gp_GetEdgeMarked(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_150gp_GetEdgeMarked(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetEdgeMarked", 0); /* "planarity/full/graph.pyx":1373 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetEdgeMarked() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1373, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1374 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetEdgeMarked() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1375 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_GetEdgeMarked() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1375, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetEdgeMarked_failed_invalid, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1375, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1374, __pyx_L1_error) /* "planarity/full/graph.pyx":1373 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetEdgeMarked() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1378 * ) * * return graphLib.gp_GetEdgeMarked(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_ClearEdgeMarked(self, int e) -> None: */ __Pyx_XDECREF(__pyx_r); __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_GetEdgeMarked(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1378, __pyx_L1_error) __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 1378, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1360 * graphLib.gp_SetEdgeVisited(self._theGraph, e) * * def gp_GetEdgeMarked(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the edge marked flag of an in-use edge e. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetEdgeMarked", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1380 * return graphLib.gp_GetEdgeMarked(self._theGraph, e) * * def gp_ClearEdgeMarked(self, int e) -> None: # <<<<<<<<<<<<<< * """Clears the edge marked flag of an in-use edge e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_153gp_ClearEdgeMarked(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_152gp_ClearEdgeMarked, "Graph.gp_ClearEdgeMarked(self, int e) -> None\n\nClears the edge marked flag of an in-use edge e.\n\nArgs:\n e: an in-use edge whose edge marked flag you wish to clear\n\nRaises:\n ValueError if e is not a valid in-use edge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_153gp_ClearEdgeMarked = {"gp_ClearEdgeMarked", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_153gp_ClearEdgeMarked, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_152gp_ClearEdgeMarked}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_153gp_ClearEdgeMarked(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ClearEdgeMarked (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1380, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1380, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_ClearEdgeMarked", 0) < (0)) __PYX_ERR(0, 1380, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_ClearEdgeMarked", 1, 1, 1, i); __PYX_ERR(0, 1380, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1380, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1380, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_ClearEdgeMarked", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1380, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ClearEdgeMarked", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_152gp_ClearEdgeMarked(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_152gp_ClearEdgeMarked(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_ClearEdgeMarked", 0); /* "planarity/full/graph.pyx":1390 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_ClearEdgeMarked() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1390, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1390, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1390, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1391 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_ClearEdgeMarked() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1392 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_ClearEdgeMarked() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1392, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_ClearEdgeMarked_failed_invali, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1392, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1391, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1391, __pyx_L1_error) /* "planarity/full/graph.pyx":1390 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_ClearEdgeMarked() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1395 * ) * * graphLib.gp_ClearEdgeMarked(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_SetEdgeMarked(self, int e) -> None: */ __pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeMarked(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1395, __pyx_L1_error) /* "planarity/full/graph.pyx":1380 * return graphLib.gp_GetEdgeMarked(self._theGraph, e) * * def gp_ClearEdgeMarked(self, int e) -> None: # <<<<<<<<<<<<<< * """Clears the edge marked flag of an in-use edge e. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ClearEdgeMarked", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1397 * graphLib.gp_ClearEdgeMarked(self._theGraph, e) * * def gp_SetEdgeMarked(self, int e) -> None: # <<<<<<<<<<<<<< * """Set the edge marked flag of an in-use edge e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_155gp_SetEdgeMarked(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_154gp_SetEdgeMarked, "Graph.gp_SetEdgeMarked(self, int e) -> None\n\nSet the edge marked flag of an in-use edge e.\n\nArgs:\n e: an in-use edge whose edge marked flag you wish to set\n\nRaises:\n ValueError if e is not a valid in-use edge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_155gp_SetEdgeMarked = {"gp_SetEdgeMarked", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_155gp_SetEdgeMarked, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_154gp_SetEdgeMarked}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_155gp_SetEdgeMarked(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_SetEdgeMarked (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1397, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1397, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_SetEdgeMarked", 0) < (0)) __PYX_ERR(0, 1397, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_SetEdgeMarked", 1, 1, 1, i); __PYX_ERR(0, 1397, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1397, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1397, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_SetEdgeMarked", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1397, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetEdgeMarked", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_154gp_SetEdgeMarked(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_154gp_SetEdgeMarked(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_SetEdgeMarked", 0); /* "planarity/full/graph.pyx":1407 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetEdgeMarked() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1407, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1407, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1407, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1408 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetEdgeMarked() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1409 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_SetEdgeMarked() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetEdgeMarked_failed_invalid, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1408, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1408, __pyx_L1_error) /* "planarity/full/graph.pyx":1407 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetEdgeMarked() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1412 * ) * * graphLib.gp_SetEdgeMarked(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_GetEdgeType(self, int e) -> int: */ __pyx_f_9planarity_4full_8graphLib_gp_SetEdgeMarked(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1412, __pyx_L1_error) /* "planarity/full/graph.pyx":1397 * graphLib.gp_ClearEdgeMarked(self._theGraph, e) * * def gp_SetEdgeMarked(self, int e) -> None: # <<<<<<<<<<<<<< * """Set the edge marked flag of an in-use edge e. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetEdgeMarked", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1414 * graphLib.gp_SetEdgeMarked(self._theGraph, e) * * def gp_GetEdgeType(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the edge type of an in-use edge e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_157gp_GetEdgeType(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_156gp_GetEdgeType, "Graph.gp_GetEdgeType(self, int e) -> int\n\nGet the edge type of an in-use edge e.\n\nArgs:\n e: an in-use edge whose edge type you wish to get\n\nReturns:\n The edge type of e if set, i.e., EDGE_TYPE_NOTDEFINED, \n EDGE_TYPE_CHILD, EDGE_TYPE_FORWARD, EDGE_TYPE_PARENT, \n EDGE_TYPE_BACK, or EDGE_TYPE_TREE\n\nRaises:\n ValueError if e is not a valid in-use edge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_157gp_GetEdgeType = {"gp_GetEdgeType", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_157gp_GetEdgeType, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_156gp_GetEdgeType}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_157gp_GetEdgeType(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetEdgeType (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1414, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1414, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetEdgeType", 0) < (0)) __PYX_ERR(0, 1414, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetEdgeType", 1, 1, 1, i); __PYX_ERR(0, 1414, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1414, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1414, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetEdgeType", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1414, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetEdgeType", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_156gp_GetEdgeType(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_156gp_GetEdgeType(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetEdgeType", 0); /* "planarity/full/graph.pyx":1429 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetEdgeType() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1429, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1429, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1429, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1430 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetEdgeType() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1431 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_GetEdgeType() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1431, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetEdgeType_failed_invalid_ed, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1431, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1430, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1430, __pyx_L1_error) /* "planarity/full/graph.pyx":1429 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetEdgeType() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1434 * ) * * return graphLib.gp_GetEdgeType(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_ClearEdgeType(self, int e) -> None: */ __Pyx_XDECREF(__pyx_r); __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_GetEdgeType(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1434, __pyx_L1_error) __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1434, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 1434, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1414 * graphLib.gp_SetEdgeMarked(self._theGraph, e) * * def gp_GetEdgeType(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the edge type of an in-use edge e. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetEdgeType", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1436 * return graphLib.gp_GetEdgeType(self._theGraph, e) * * def gp_ClearEdgeType(self, int e) -> None: # <<<<<<<<<<<<<< * """Clears the edge type of an in-use edge e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_159gp_ClearEdgeType(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_158gp_ClearEdgeType, "Graph.gp_ClearEdgeType(self, int e) -> None\n\nClears the edge type of an in-use edge e.\n\nArgs:\n e: an in-use edge whose edge type you wish to clear\n\nRaises:\n ValueError if e is not a valid in-use edge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_159gp_ClearEdgeType = {"gp_ClearEdgeType", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_159gp_ClearEdgeType, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_158gp_ClearEdgeType}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_159gp_ClearEdgeType(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ClearEdgeType (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1436, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1436, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_ClearEdgeType", 0) < (0)) __PYX_ERR(0, 1436, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_ClearEdgeType", 1, 1, 1, i); __PYX_ERR(0, 1436, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1436, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1436, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_ClearEdgeType", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1436, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ClearEdgeType", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_158gp_ClearEdgeType(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_158gp_ClearEdgeType(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_ClearEdgeType", 0); /* "planarity/full/graph.pyx":1446 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_ClearEdgeType() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1446, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1447 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_ClearEdgeType() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1448 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_ClearEdgeType() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_ClearEdgeType_failed_invalid, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1447, __pyx_L1_error) /* "planarity/full/graph.pyx":1446 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_ClearEdgeType() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1451 * ) * * graphLib.gp_ClearEdgeType(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_SetEdgeType(self, int e, int type) -> None: */ __pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeType(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1451, __pyx_L1_error) /* "planarity/full/graph.pyx":1436 * return graphLib.gp_GetEdgeType(self._theGraph, e) * * def gp_ClearEdgeType(self, int e) -> None: # <<<<<<<<<<<<<< * """Clears the edge type of an in-use edge e. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ClearEdgeType", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1453 * graphLib.gp_ClearEdgeType(self._theGraph, e) * * def gp_SetEdgeType(self, int e, int type) -> None: # <<<<<<<<<<<<<< * """Sets the edge type of an in-use edge e to type for the first * time. To change the type after setting the first time, use */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_161gp_SetEdgeType(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_160gp_SetEdgeType, "Graph.gp_SetEdgeType(self, int e, int type) -> None\n\nSets the edge type of an in-use edge e to type for the first\ntime. To change the type after setting the first time, use\ngp_ClearEdgeType() first, or use gp_ResetEdgeType().\n\nArgs:\n e: an in-use edge whose edge type you wish to set for the first time\n to the given type\n type: one of EDGE_TYPE_CHILD, EDGE_TYPE_FORWARD, EDGE_TYPE_PARENT,\n EDGE_TYPE_BACK, or EDGE_TYPE_TREE\n\nRaises:\n ValueError if e is not a valid in-use edge or if type is not a valid\n edge type"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_161gp_SetEdgeType = {"gp_SetEdgeType", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_161gp_SetEdgeType, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_160gp_SetEdgeType}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_161gp_SetEdgeType(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; int __pyx_v_type; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_SetEdgeType (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,&__pyx_mstate_global->__pyx_n_u_type,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1453, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1453, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1453, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_SetEdgeType", 0) < (0)) __PYX_ERR(0, 1453, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_SetEdgeType", 1, 2, 2, i); __PYX_ERR(0, 1453, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1453, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1453, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1453, __pyx_L3_error) __pyx_v_type = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_type == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1453, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_SetEdgeType", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1453, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetEdgeType", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_160gp_SetEdgeType(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e, __pyx_v_type); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_160gp_SetEdgeType(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e, int __pyx_v_type) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_SetEdgeType", 0); /* "planarity/full/graph.pyx":1469 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetEdgeType() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1469, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1469, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1469, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1470 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetEdgeType() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1471 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_SetEdgeType() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1471, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetEdgeType_failed_invalid_ed, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1471, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1470, __pyx_L1_error) /* "planarity/full/graph.pyx":1469 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetEdgeType() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1474 * ) * * if type not in (EDGE_TYPE_CHILD, EDGE_TYPE_FORWARD, EDGE_TYPE_PARENT, EDGE_TYPE_BACK, EDGE_TYPE_TREE): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetEdgeType() failed: invalid edge type = {type}" */ __pyx_t_8 = __pyx_v_type; __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_CHILD); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_FORWARD); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_PARENT); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_BACK); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_TREE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1474, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __pyx_t_5; __pyx_L5_bool_binop_done:; __pyx_t_5 = __pyx_t_6; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":1475 * * if type not in (EDGE_TYPE_CHILD, EDGE_TYPE_FORWARD, EDGE_TYPE_PARENT, EDGE_TYPE_BACK, EDGE_TYPE_TREE): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetEdgeType() failed: invalid edge type = {type}" * ) */ __pyx_t_7 = NULL; /* "planarity/full/graph.pyx":1476 * if type not in (EDGE_TYPE_CHILD, EDGE_TYPE_FORWARD, EDGE_TYPE_PARENT, EDGE_TYPE_BACK, EDGE_TYPE_TREE): * raise ValueError( * f"gp_SetEdgeType() failed: invalid edge type = {type}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_1 = __Pyx_PyUnicode_From_int(__pyx_v_type, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1476, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetEdgeType_failed_invalid_ed_2, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1476, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_2}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1475, __pyx_L1_error) /* "planarity/full/graph.pyx":1474 * ) * * if type not in (EDGE_TYPE_CHILD, EDGE_TYPE_FORWARD, EDGE_TYPE_PARENT, EDGE_TYPE_BACK, EDGE_TYPE_TREE): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetEdgeType() failed: invalid edge type = {type}" */ } /* "planarity/full/graph.pyx":1479 * ) * * graphLib.gp_SetEdgeType(self._theGraph, e, type) # <<<<<<<<<<<<<< * * def gp_ResetEdgeType(self, int e, int type) -> None: */ __pyx_f_9planarity_4full_8graphLib_gp_SetEdgeType(__pyx_v_self->_theGraph, __pyx_v_e, __pyx_v_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1479, __pyx_L1_error) /* "planarity/full/graph.pyx":1453 * graphLib.gp_ClearEdgeType(self._theGraph, e) * * def gp_SetEdgeType(self, int e, int type) -> None: # <<<<<<<<<<<<<< * """Sets the edge type of an in-use edge e to type for the first * time. To change the type after setting the first time, use */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetEdgeType", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1481 * graphLib.gp_SetEdgeType(self._theGraph, e, type) * * def gp_ResetEdgeType(self, int e, int type) -> None: # <<<<<<<<<<<<<< * """Reset the edge type of in-use edge e to type, clearing the previous type. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_163gp_ResetEdgeType(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_162gp_ResetEdgeType, "Graph.gp_ResetEdgeType(self, int e, int type) -> None\n\nReset the edge type of in-use edge e to type, clearing the previous type.\n\nArgs:\n e: an in-use edge whose edge type you wish to reset to type\n type: one of EDGE_TYPE_CHILD, EDGE_TYPE_FORWARD, EDGE_TYPE_PARENT,\n EDGE_TYPE_BACK, or EDGE_TYPE_TREE\n\nRaises:\n ValueError if e is not a valid in-use edge or if type is not a valid\n edge type"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_163gp_ResetEdgeType = {"gp_ResetEdgeType", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_163gp_ResetEdgeType, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_162gp_ResetEdgeType}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_163gp_ResetEdgeType(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; int __pyx_v_type; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ResetEdgeType (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,&__pyx_mstate_global->__pyx_n_u_type,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1481, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1481, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1481, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_ResetEdgeType", 0) < (0)) __PYX_ERR(0, 1481, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_ResetEdgeType", 1, 2, 2, i); __PYX_ERR(0, 1481, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1481, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1481, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1481, __pyx_L3_error) __pyx_v_type = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_type == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1481, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_ResetEdgeType", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1481, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ResetEdgeType", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_162gp_ResetEdgeType(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e, __pyx_v_type); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_162gp_ResetEdgeType(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e, int __pyx_v_type) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_ResetEdgeType", 0); /* "planarity/full/graph.pyx":1494 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_ResetEdgeType() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1494, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1494, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1494, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1495 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_ResetEdgeType() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1496 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_ResetEdgeType() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1496, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_ResetEdgeType_failed_invalid, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1496, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1495, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1495, __pyx_L1_error) /* "planarity/full/graph.pyx":1494 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_ResetEdgeType() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1499 * ) * * if type not in (EDGE_TYPE_CHILD, EDGE_TYPE_FORWARD, EDGE_TYPE_PARENT, EDGE_TYPE_BACK, EDGE_TYPE_TREE): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_ResetEdgeType() failed: invalid edge type = {type}" */ __pyx_t_8 = __pyx_v_type; __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_CHILD); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_FORWARD); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_PARENT); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_BACK); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_TREE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1499, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __pyx_t_5; __pyx_L5_bool_binop_done:; __pyx_t_5 = __pyx_t_6; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":1500 * * if type not in (EDGE_TYPE_CHILD, EDGE_TYPE_FORWARD, EDGE_TYPE_PARENT, EDGE_TYPE_BACK, EDGE_TYPE_TREE): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_ResetEdgeType() failed: invalid edge type = {type}" * ) */ __pyx_t_7 = NULL; /* "planarity/full/graph.pyx":1501 * if type not in (EDGE_TYPE_CHILD, EDGE_TYPE_FORWARD, EDGE_TYPE_PARENT, EDGE_TYPE_BACK, EDGE_TYPE_TREE): * raise ValueError( * f"gp_ResetEdgeType() failed: invalid edge type = {type}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_1 = __Pyx_PyUnicode_From_int(__pyx_v_type, 0, ' ', 'd'); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1501, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_ResetEdgeType_failed_invalid_2, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1501, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_2}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1500, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1500, __pyx_L1_error) /* "planarity/full/graph.pyx":1499 * ) * * if type not in (EDGE_TYPE_CHILD, EDGE_TYPE_FORWARD, EDGE_TYPE_PARENT, EDGE_TYPE_BACK, EDGE_TYPE_TREE): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_ResetEdgeType() failed: invalid edge type = {type}" */ } /* "planarity/full/graph.pyx":1504 * ) * * graphLib.gp_ResetEdgeType(self._theGraph, e, type) # <<<<<<<<<<<<<< * * def gp_GetEdgeFlagInverted(self, int e) -> int: */ __pyx_f_9planarity_4full_8graphLib_gp_ResetEdgeType(__pyx_v_self->_theGraph, __pyx_v_e, __pyx_v_type); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1504, __pyx_L1_error) /* "planarity/full/graph.pyx":1481 * graphLib.gp_SetEdgeType(self._theGraph, e, type) * * def gp_ResetEdgeType(self, int e, int type) -> None: # <<<<<<<<<<<<<< * """Reset the edge type of in-use edge e to type, clearing the previous type. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ResetEdgeType", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1506 * graphLib.gp_ResetEdgeType(self._theGraph, e, type) * * def gp_GetEdgeFlagInverted(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the edge inverted flag of an in-use edge e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_165gp_GetEdgeFlagInverted(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_164gp_GetEdgeFlagInverted, "Graph.gp_GetEdgeFlagInverted(self, int e) -> int\n\nGet the edge inverted flag of an in-use edge e.\n\nArgs:\n e: an in-use edge for which you wish to get the edge inverted flag\n\nReturns:\n The edge inverted flag of e\n\nRaises:\n ValueError if e is not a valid in-use edge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_165gp_GetEdgeFlagInverted = {"gp_GetEdgeFlagInverted", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_165gp_GetEdgeFlagInverted, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_164gp_GetEdgeFlagInverted}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_165gp_GetEdgeFlagInverted(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetEdgeFlagInverted (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1506, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1506, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetEdgeFlagInverted", 0) < (0)) __PYX_ERR(0, 1506, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetEdgeFlagInverted", 1, 1, 1, i); __PYX_ERR(0, 1506, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1506, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1506, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetEdgeFlagInverted", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1506, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetEdgeFlagInverted", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_164gp_GetEdgeFlagInverted(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_164gp_GetEdgeFlagInverted(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetEdgeFlagInverted", 0); /* "planarity/full/graph.pyx":1519 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetEdgeFlagInverted() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1519, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1519, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1519, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1520 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetEdgeFlagInverted() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1521 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_GetEdgeFlagInverted() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1521, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetEdgeFlagInverted_failed_in, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1521, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1520, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1520, __pyx_L1_error) /* "planarity/full/graph.pyx":1519 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetEdgeFlagInverted() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1524 * ) * * return graphLib.gp_GetEdgeFlagInverted(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_SetEdgeFlagInverted(self, int e) -> None: */ __Pyx_XDECREF(__pyx_r); __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_GetEdgeFlagInverted(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1524, __pyx_L1_error) __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1524, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 1524, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1506 * graphLib.gp_ResetEdgeType(self._theGraph, e, type) * * def gp_GetEdgeFlagInverted(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the edge inverted flag of an in-use edge e. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetEdgeFlagInverted", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1526 * return graphLib.gp_GetEdgeFlagInverted(self._theGraph, e) * * def gp_SetEdgeFlagInverted(self, int e) -> None: # <<<<<<<<<<<<<< * """Set the edge inverted flag of an in-use edge e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_167gp_SetEdgeFlagInverted(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_166gp_SetEdgeFlagInverted, "Graph.gp_SetEdgeFlagInverted(self, int e) -> None\n\nSet the edge inverted flag of an in-use edge e.\n\nArgs:\n e: an in-use edge for which you wish to set the edge inverted flag\n\nRaises:\n ValueError if e is not a valid in-use edge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_167gp_SetEdgeFlagInverted = {"gp_SetEdgeFlagInverted", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_167gp_SetEdgeFlagInverted, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_166gp_SetEdgeFlagInverted}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_167gp_SetEdgeFlagInverted(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_SetEdgeFlagInverted (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1526, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1526, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_SetEdgeFlagInverted", 0) < (0)) __PYX_ERR(0, 1526, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_SetEdgeFlagInverted", 1, 1, 1, i); __PYX_ERR(0, 1526, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1526, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1526, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_SetEdgeFlagInverted", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1526, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetEdgeFlagInverted", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_166gp_SetEdgeFlagInverted(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_166gp_SetEdgeFlagInverted(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_SetEdgeFlagInverted", 0); /* "planarity/full/graph.pyx":1536 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetEdgeFlagInverted() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1536, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1536, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1536, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1537 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetEdgeFlagInverted() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1538 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_SetEdgeFlagInverted() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetEdgeFlagInverted_failed_in, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1537, __pyx_L1_error) /* "planarity/full/graph.pyx":1536 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetEdgeFlagInverted() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1541 * ) * * graphLib.gp_SetEdgeFlagInverted(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_ClearEdgeFlagInverted(self, int e) -> None: */ __pyx_f_9planarity_4full_8graphLib_gp_SetEdgeFlagInverted(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1541, __pyx_L1_error) /* "planarity/full/graph.pyx":1526 * return graphLib.gp_GetEdgeFlagInverted(self._theGraph, e) * * def gp_SetEdgeFlagInverted(self, int e) -> None: # <<<<<<<<<<<<<< * """Set the edge inverted flag of an in-use edge e. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetEdgeFlagInverted", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1543 * graphLib.gp_SetEdgeFlagInverted(self._theGraph, e) * * def gp_ClearEdgeFlagInverted(self, int e) -> None: # <<<<<<<<<<<<<< * """Clear the edge inverted flag of an in-use edge e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_169gp_ClearEdgeFlagInverted(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_168gp_ClearEdgeFlagInverted, "Graph.gp_ClearEdgeFlagInverted(self, int e) -> None\n\nClear the edge inverted flag of an in-use edge e.\n\nArgs:\n e: an in-use edge for which you wish to clear the edge inverted flag\n\nRaises:\n ValueError if e is not a valid in-use edge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_169gp_ClearEdgeFlagInverted = {"gp_ClearEdgeFlagInverted", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_169gp_ClearEdgeFlagInverted, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_168gp_ClearEdgeFlagInverted}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_169gp_ClearEdgeFlagInverted(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ClearEdgeFlagInverted (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1543, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1543, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_ClearEdgeFlagInverted", 0) < (0)) __PYX_ERR(0, 1543, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_ClearEdgeFlagInverted", 1, 1, 1, i); __PYX_ERR(0, 1543, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1543, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1543, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_ClearEdgeFlagInverted", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1543, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ClearEdgeFlagInverted", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_168gp_ClearEdgeFlagInverted(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_168gp_ClearEdgeFlagInverted(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_ClearEdgeFlagInverted", 0); /* "planarity/full/graph.pyx":1553 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_ClearEdgeFlagInverted() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1553, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1554 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_ClearEdgeFlagInverted() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1555 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_ClearEdgeFlagInverted() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_ClearEdgeFlagInverted_failed, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1554, __pyx_L1_error) /* "planarity/full/graph.pyx":1553 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_ClearEdgeFlagInverted() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1558 * ) * * graphLib.gp_ClearEdgeFlagInverted(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_XorEdgeFlagInverted(self, int e) -> None: */ __pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeFlagInverted(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1558, __pyx_L1_error) /* "planarity/full/graph.pyx":1543 * graphLib.gp_SetEdgeFlagInverted(self._theGraph, e) * * def gp_ClearEdgeFlagInverted(self, int e) -> None: # <<<<<<<<<<<<<< * """Clear the edge inverted flag of an in-use edge e. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ClearEdgeFlagInverted", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1560 * graphLib.gp_ClearEdgeFlagInverted(self._theGraph, e) * * def gp_XorEdgeFlagInverted(self, int e) -> None: # <<<<<<<<<<<<<< * """Toggle the edge inverted flag of an in-use edge e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_171gp_XorEdgeFlagInverted(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_170gp_XorEdgeFlagInverted, "Graph.gp_XorEdgeFlagInverted(self, int e) -> None\n\nToggle the edge inverted flag of an in-use edge e.\n\nArgs:\n e: an in-use edge for which you wish to toggle the edge inverted flag\n\nRaises:\n ValueError if e is not a valid in-use edge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_171gp_XorEdgeFlagInverted = {"gp_XorEdgeFlagInverted", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_171gp_XorEdgeFlagInverted, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_170gp_XorEdgeFlagInverted}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_171gp_XorEdgeFlagInverted(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_XorEdgeFlagInverted (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1560, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1560, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_XorEdgeFlagInverted", 0) < (0)) __PYX_ERR(0, 1560, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_XorEdgeFlagInverted", 1, 1, 1, i); __PYX_ERR(0, 1560, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1560, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1560, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_XorEdgeFlagInverted", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1560, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_XorEdgeFlagInverted", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_170gp_XorEdgeFlagInverted(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_170gp_XorEdgeFlagInverted(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_XorEdgeFlagInverted", 0); /* "planarity/full/graph.pyx":1570 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_XorEdgeFlagInverted() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1570, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1570, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1570, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1571 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_XorEdgeFlagInverted() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1572 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_XorEdgeFlagInverted() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1572, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_XorEdgeFlagInverted_failed_in, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1572, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1571, __pyx_L1_error) /* "planarity/full/graph.pyx":1570 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_XorEdgeFlagInverted() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1575 * ) * * graphLib.gp_XorEdgeFlagInverted(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_GetDirection(self, int e) -> int: */ __pyx_f_9planarity_4full_8graphLib_gp_XorEdgeFlagInverted(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1575, __pyx_L1_error) /* "planarity/full/graph.pyx":1560 * graphLib.gp_ClearEdgeFlagInverted(self._theGraph, e) * * def gp_XorEdgeFlagInverted(self, int e) -> None: # <<<<<<<<<<<<<< * """Toggle the edge inverted flag of an in-use edge e. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_XorEdgeFlagInverted", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1577 * graphLib.gp_XorEdgeFlagInverted(self._theGraph, e) * * def gp_GetDirection(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the direction flag of an in-use edge e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_173gp_GetDirection(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_172gp_GetDirection, "Graph.gp_GetDirection(self, int e) -> int\n\nGet the direction flag of an in-use edge e.\n\nArgs:\n e: an in-use edge for which you wish to determine the direction\n\nReturns:\n The direction of the edge e\n\nRaises:\n ValueError if e is not a valid in-use edge"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_173gp_GetDirection = {"gp_GetDirection", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_173gp_GetDirection, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_172gp_GetDirection}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_173gp_GetDirection(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetDirection (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1577, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1577, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetDirection", 0) < (0)) __PYX_ERR(0, 1577, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetDirection", 1, 1, 1, i); __PYX_ERR(0, 1577, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1577, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1577, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetDirection", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1577, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetDirection", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_172gp_GetDirection(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_172gp_GetDirection(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetDirection", 0); /* "planarity/full/graph.pyx":1590 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetDirection() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1590, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1590, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1590, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1591 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetDirection() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1592 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_GetDirection() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1592, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetDirection_failed_invalid_e, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1592, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1591, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1591, __pyx_L1_error) /* "planarity/full/graph.pyx":1590 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetDirection() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1595 * ) * * return graphLib.gp_GetDirection(self._theGraph, e) # <<<<<<<<<<<<<< * * def gp_SetDirection(self, int e, int direction) -> None: */ __Pyx_XDECREF(__pyx_r); __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_GetDirection(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1595, __pyx_L1_error) __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1595, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 1595, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1577 * graphLib.gp_XorEdgeFlagInverted(self._theGraph, e) * * def gp_GetDirection(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the direction flag of an in-use edge e. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetDirection", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1597 * return graphLib.gp_GetDirection(self._theGraph, e) * * def gp_SetDirection(self, int e, int direction) -> None: # <<<<<<<<<<<<<< * """Set the direction flag of an in-use edge e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_175gp_SetDirection(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_174gp_SetDirection, "Graph.gp_SetDirection(self, int e, int direction) -> None\n\nSet the direction flag of an in-use edge e.\n\nArgs:\n e: an in-use edge for which you wish to set the direction\n direction: either 0 (undirected), EDGEFLAG_DIRECTION_INONLY, or\n EDGEFLAG_DIRECTION_OUTONLY\n\nRaises:\n ValueError if e is not a valid in-use edge, or direction is invalid"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_175gp_SetDirection = {"gp_SetDirection", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_175gp_SetDirection, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_174gp_SetDirection}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_175gp_SetDirection(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; int __pyx_v_direction; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_SetDirection (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,&__pyx_mstate_global->__pyx_n_u_direction,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1597, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1597, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1597, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_SetDirection", 0) < (0)) __PYX_ERR(0, 1597, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_SetDirection", 1, 2, 2, i); __PYX_ERR(0, 1597, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1597, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1597, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1597, __pyx_L3_error) __pyx_v_direction = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_direction == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1597, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_SetDirection", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1597, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetDirection", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_174gp_SetDirection(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e, __pyx_v_direction); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_174gp_SetDirection(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e, int __pyx_v_direction) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_SetDirection", 0); /* "planarity/full/graph.pyx":1609 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetDirection() failed: invalid edge e = {e}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1609, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1610 * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetDirection() failed: invalid edge e = {e}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1611 * if not self.gp_EdgeInUse(e): * raise ValueError( * f"gp_SetDirection() failed: invalid edge e = {e}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_e, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1611, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetDirection_failed_invalid_e, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1611, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1610, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1610, __pyx_L1_error) /* "planarity/full/graph.pyx":1609 * """ * # The Cython-level gp_EdgeInUse() checks gp_IsEdge() * if not self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetDirection() failed: invalid edge e = {e}" */ } /* "planarity/full/graph.pyx":1614 * ) * * if direction not in (0, EDGEFLAG_DIRECTION_INONLY, EDGEFLAG_DIRECTION_OUTONLY): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetDirection() failed: invalid direction = {direction}" */ __pyx_t_8 = __pyx_v_direction; __pyx_t_5 = (__pyx_t_8 != 0); if (__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1614, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_EDGEFLAG_DIRECTION_INONLY); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1614, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1614, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1614, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_5) { } else { __pyx_t_6 = __pyx_t_5; goto __pyx_L5_bool_binop_done; } __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1614, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_EDGEFLAG_DIRECTION_OUTONLY); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1614, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1614, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1614, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = __pyx_t_5; __pyx_L5_bool_binop_done:; __pyx_t_5 = __pyx_t_6; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":1615 * * if direction not in (0, EDGEFLAG_DIRECTION_INONLY, EDGEFLAG_DIRECTION_OUTONLY): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_SetDirection() failed: invalid direction = {direction}" * ) */ __pyx_t_7 = NULL; /* "planarity/full/graph.pyx":1616 * if direction not in (0, EDGEFLAG_DIRECTION_INONLY, EDGEFLAG_DIRECTION_OUTONLY): * raise ValueError( * f"gp_SetDirection() failed: invalid direction = {direction}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_direction, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1616, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_SetDirection_failed_invalid_d, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1616, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_2}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1615, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1615, __pyx_L1_error) /* "planarity/full/graph.pyx":1614 * ) * * if direction not in (0, EDGEFLAG_DIRECTION_INONLY, EDGEFLAG_DIRECTION_OUTONLY): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_SetDirection() failed: invalid direction = {direction}" */ } /* "planarity/full/graph.pyx":1619 * ) * * graphLib.gp_SetDirection(self._theGraph, e, direction) # <<<<<<<<<<<<<< * * def gp_LowerBoundEdges(self) -> int: */ __pyx_f_9planarity_4full_8graphLib_gp_SetDirection(__pyx_v_self->_theGraph, __pyx_v_e, __pyx_v_direction); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1619, __pyx_L1_error) /* "planarity/full/graph.pyx":1597 * return graphLib.gp_GetDirection(self._theGraph, e) * * def gp_SetDirection(self, int e, int direction) -> None: # <<<<<<<<<<<<<< * """Set the direction flag of an in-use edge e. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SetDirection", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1621 * graphLib.gp_SetDirection(self._theGraph, e, direction) * * def gp_LowerBoundEdges(self) -> int: # <<<<<<<<<<<<<< * """Get the lower bound for edges. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_177gp_LowerBoundEdges(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_176gp_LowerBoundEdges, "Graph.gp_LowerBoundEdges(self) -> int\n\nGet the lower bound for edges.\n\nReturns:\n The lower bound for edges"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_177gp_LowerBoundEdges = {"gp_LowerBoundEdges", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_177gp_LowerBoundEdges, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_176gp_LowerBoundEdges}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_177gp_LowerBoundEdges(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_LowerBoundEdges (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_LowerBoundEdges", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_LowerBoundEdges", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_176gp_LowerBoundEdges(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_176gp_LowerBoundEdges(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_LowerBoundEdges", 0); /* "planarity/full/graph.pyx":1627 * The lower bound for edges * """ * return graphLib.gp_LowerBoundEdges(self._theGraph) # <<<<<<<<<<<<<< * * def gp_UpperBoundEdges(self) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_LowerBoundEdges(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1627, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1627, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 1627, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1621 * graphLib.gp_SetDirection(self._theGraph, e, direction) * * def gp_LowerBoundEdges(self) -> int: # <<<<<<<<<<<<<< * """Get the lower bound for edges. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_LowerBoundEdges", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1629 * return graphLib.gp_LowerBoundEdges(self._theGraph) * * def gp_UpperBoundEdges(self) -> int: # <<<<<<<<<<<<<< * """Get the upper bound for edges (the lower bound + M + numEdgeHoles). * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_179gp_UpperBoundEdges(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_178gp_UpperBoundEdges, "Graph.gp_UpperBoundEdges(self) -> int\n\nGet the upper bound for edges (the lower bound + M + numEdgeHoles).\n\nReturns:\n The upper bound for edges"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_179gp_UpperBoundEdges = {"gp_UpperBoundEdges", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_179gp_UpperBoundEdges, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_178gp_UpperBoundEdges}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_179gp_UpperBoundEdges(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_UpperBoundEdges (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_UpperBoundEdges", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_UpperBoundEdges", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_178gp_UpperBoundEdges(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_178gp_UpperBoundEdges(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_UpperBoundEdges", 0); /* "planarity/full/graph.pyx":1635 * The upper bound for edges * """ * return graphLib.gp_UpperBoundEdges(self._theGraph) # <<<<<<<<<<<<<< * * def gp_EdgeInUse(self, int e) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_UpperBoundEdges(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1635, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1635, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 1635, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1629 * return graphLib.gp_LowerBoundEdges(self._theGraph) * * def gp_UpperBoundEdges(self) -> int: # <<<<<<<<<<<<<< * """Get the upper bound for edges (the lower bound + M + numEdgeHoles). * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_UpperBoundEdges", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1637 * return graphLib.gp_UpperBoundEdges(self._theGraph) * * def gp_EdgeInUse(self, int e) -> int: # <<<<<<<<<<<<<< * """Determines if an edge is in-use, i.e., if the neighbor vertex is set. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_181gp_EdgeInUse(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_180gp_EdgeInUse, "Graph.gp_EdgeInUse(self, int e) -> int\n\nDetermines if an edge is in-use, i.e., if the neighbor vertex is set.\n\nArgs:\n e: candidate edge to test\n\nReturns:\n TRUE if the edge is valid and in-use, FALSE otherwise"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_181gp_EdgeInUse = {"gp_EdgeInUse", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_181gp_EdgeInUse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_180gp_EdgeInUse}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_181gp_EdgeInUse(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_EdgeInUse (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1637, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1637, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_EdgeInUse", 0) < (0)) __PYX_ERR(0, 1637, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_EdgeInUse", 1, 1, 1, i); __PYX_ERR(0, 1637, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1637, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1637, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_EdgeInUse", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1637, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_EdgeInUse", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_180gp_EdgeInUse(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_180gp_EdgeInUse(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_EdgeInUse", 0); /* "planarity/full/graph.pyx":1646 * TRUE if the edge is valid and in-use, FALSE otherwise * """ * if self.gp_IsEdge(e) and graphLib.gp_EdgeInUse(self._theGraph, e): # <<<<<<<<<<<<<< * return TRUE * */ __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1646, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsEdge, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1646, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1646, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } __pyx_t_7 = __pyx_f_9planarity_4full_8graphLib_gp_EdgeInUse(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1646, __pyx_L1_error) __pyx_t_6 = (__pyx_t_7 != 0); __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { /* "planarity/full/graph.pyx":1647 * """ * if self.gp_IsEdge(e) and graphLib.gp_EdgeInUse(self._theGraph, e): * return TRUE # <<<<<<<<<<<<<< * * return FALSE */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_TRUE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1647, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 1647, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1646 * TRUE if the edge is valid and in-use, FALSE otherwise * """ * if self.gp_IsEdge(e) and graphLib.gp_EdgeInUse(self._theGraph, e): # <<<<<<<<<<<<<< * return TRUE * */ } /* "planarity/full/graph.pyx":1649 * return TRUE * * return FALSE # <<<<<<<<<<<<<< * * def gp_EdgeNotInUse(self, int e) -> int: */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FALSE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1649, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 1649, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1637 * return graphLib.gp_UpperBoundEdges(self._theGraph) * * def gp_EdgeInUse(self, int e) -> int: # <<<<<<<<<<<<<< * """Determines if an edge is in-use, i.e., if the neighbor vertex is set. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_EdgeInUse", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1651 * return FALSE * * def gp_EdgeNotInUse(self, int e) -> int: # <<<<<<<<<<<<<< * """Determines if an edge is not in-use. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_183gp_EdgeNotInUse(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_182gp_EdgeNotInUse, "Graph.gp_EdgeNotInUse(self, int e) -> int\n\nDetermines if an edge is not in-use.\n\nArgs:\n e: candidate edge to test\n\nReturns:\n TRUE if edge is either invalid or valid but not in-use, FALSE otherwise"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_183gp_EdgeNotInUse = {"gp_EdgeNotInUse", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_183gp_EdgeNotInUse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_182gp_EdgeNotInUse}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_183gp_EdgeNotInUse(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_EdgeNotInUse (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1651, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1651, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_EdgeNotInUse", 0) < (0)) __PYX_ERR(0, 1651, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_EdgeNotInUse", 1, 1, 1, i); __PYX_ERR(0, 1651, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1651, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1651, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_EdgeNotInUse", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1651, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_EdgeNotInUse", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_182gp_EdgeNotInUse(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_182gp_EdgeNotInUse(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_EdgeNotInUse", 0); /* "planarity/full/graph.pyx":1660 * TRUE if edge is either invalid or valid but not in-use, FALSE otherwise * """ * if self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * return FALSE * */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1660, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1660, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1660, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_5) { /* "planarity/full/graph.pyx":1661 * """ * if self.gp_EdgeInUse(e): * return FALSE # <<<<<<<<<<<<<< * * return TRUE */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_FALSE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1661, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 1) < (0)) __PYX_ERR(0, 1661, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1660 * TRUE if edge is either invalid or valid but not in-use, FALSE otherwise * """ * if self.gp_EdgeInUse(e): # <<<<<<<<<<<<<< * return FALSE * */ } /* "planarity/full/graph.pyx":1663 * return FALSE * * return TRUE # <<<<<<<<<<<<<< * * #if not self.gp_IsEdge(e): */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_TRUE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1663, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 1) < (0)) __PYX_ERR(0, 1663, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1651 * return FALSE * * def gp_EdgeNotInUse(self, int e) -> int: # <<<<<<<<<<<<<< * """Determines if an edge is not in-use. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_EdgeNotInUse", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1673 * #return FALSE * * def gp_LowerBoundEdgeStorage(self) -> int: # <<<<<<<<<<<<<< * """Get the lower bound for edge storage; for iterating over all edge storage. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_185gp_LowerBoundEdgeStorage(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_184gp_LowerBoundEdgeStorage, "Graph.gp_LowerBoundEdgeStorage(self) -> int\n\nGet the lower bound for edge storage; for iterating over all edge storage.\n\nReturns:\n The lower bound for edge storage"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_185gp_LowerBoundEdgeStorage = {"gp_LowerBoundEdgeStorage", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_185gp_LowerBoundEdgeStorage, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_184gp_LowerBoundEdgeStorage}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_185gp_LowerBoundEdgeStorage(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_LowerBoundEdgeStorage (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_LowerBoundEdgeStorage", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_LowerBoundEdgeStorage", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_184gp_LowerBoundEdgeStorage(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_184gp_LowerBoundEdgeStorage(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_LowerBoundEdgeStorage", 0); /* "planarity/full/graph.pyx":1679 * The lower bound for edge storage * """ * return graphLib.gp_LowerBoundEdgeStorage(self._theGraph) # <<<<<<<<<<<<<< * * def gp_UpperBoundEdgeStorage(self) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_LowerBoundEdgeStorage(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1679, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1679, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 1679, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1673 * #return FALSE * * def gp_LowerBoundEdgeStorage(self) -> int: # <<<<<<<<<<<<<< * """Get the lower bound for edge storage; for iterating over all edge storage. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_LowerBoundEdgeStorage", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1681 * return graphLib.gp_LowerBoundEdgeStorage(self._theGraph) * * def gp_UpperBoundEdgeStorage(self) -> int: # <<<<<<<<<<<<<< * """Get the upper bound for edge storage; for iterating over all edge storage. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_187gp_UpperBoundEdgeStorage(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_186gp_UpperBoundEdgeStorage, "Graph.gp_UpperBoundEdgeStorage(self) -> int\n\nGet the upper bound for edge storage; for iterating over all edge storage.\n\nNote that this value depends on the edge capacity, and possibly extends\npast the current number of in-use edges.\n\nReturns:\n The upper bound for edge storage"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_187gp_UpperBoundEdgeStorage = {"gp_UpperBoundEdgeStorage", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_187gp_UpperBoundEdgeStorage, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_186gp_UpperBoundEdgeStorage}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_187gp_UpperBoundEdgeStorage(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_UpperBoundEdgeStorage (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_UpperBoundEdgeStorage", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_UpperBoundEdgeStorage", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_186gp_UpperBoundEdgeStorage(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_186gp_UpperBoundEdgeStorage(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_UpperBoundEdgeStorage", 0); /* "planarity/full/graph.pyx":1690 * The upper bound for edge storage * """ * return graphLib.gp_UpperBoundEdgeStorage(self._theGraph) # <<<<<<<<<<<<<< * * def gp_Read(self, str fileName) -> None: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_UpperBoundEdgeStorage(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1690, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1690, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 0) < (0)) __PYX_ERR(0, 1690, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1681 * return graphLib.gp_LowerBoundEdgeStorage(self._theGraph) * * def gp_UpperBoundEdgeStorage(self) -> int: # <<<<<<<<<<<<<< * """Get the upper bound for edge storage; for iterating over all edge storage. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_UpperBoundEdgeStorage", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1692 * return graphLib.gp_UpperBoundEdgeStorage(self._theGraph) * * def gp_Read(self, str fileName) -> None: # <<<<<<<<<<<<<< * """Reads the graph from the file named fileName. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_189gp_Read(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_188gp_Read, "Graph.gp_Read(self, str fileName) -> None\n\nReads the graph from the file named fileName.\n\nArgs:\n fileName: a string containing the name of the file to read from\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_189gp_Read = {"gp_Read", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_189gp_Read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_188gp_Read}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_189gp_Read(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_fileName = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_Read (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_fileName,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1692, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1692, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_Read", 0) < (0)) __PYX_ERR(0, 1692, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_Read", 1, 1, 1, i); __PYX_ERR(0, 1692, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1692, __pyx_L3_error) } __pyx_v_fileName = ((PyObject*)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_Read", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1692, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_Read", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fileName), (&PyUnicode_Type), 1, "fileName", 1))) __PYX_ERR(0, 1692, __pyx_L1_error) __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_188gp_Read(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_fileName); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } goto __pyx_L7_cleaned_up; __pyx_L0:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __pyx_L7_cleaned_up:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_188gp_Read(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, PyObject *__pyx_v_fileName) { PyObject *__pyx_v_encoded = 0; char const *__pyx_v_encodedFileName; int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; char const *__pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; PyObject *__pyx_t_7[3]; PyObject *__pyx_t_8 = NULL; size_t __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_Read", 0); /* "planarity/full/graph.pyx":1703 * """ * # Convert Python str to UTF-8 encoded bytes, and then to const char * * cdef bytes encoded = fileName.encode('utf-8') # <<<<<<<<<<<<<< * cdef const char *encodedFileName = encoded * */ if (unlikely(__pyx_v_fileName == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 1703, __pyx_L1_error) } __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_fileName); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1703, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_encoded = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "planarity/full/graph.pyx":1704 * # Convert Python str to UTF-8 encoded bytes, and then to const char * * cdef bytes encoded = fileName.encode('utf-8') * cdef const char *encodedFileName = encoded # <<<<<<<<<<<<<< * * result = graphLib.gp_Read(self._theGraph, encodedFileName) */ __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_encoded); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 1704, __pyx_L1_error) __pyx_v_encodedFileName = __pyx_t_2; /* "planarity/full/graph.pyx":1706 * cdef const char *encodedFileName = encoded * * result = graphLib.gp_Read(self._theGraph, encodedFileName) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_3 = __pyx_f_9planarity_4full_8graphLib_gp_Read(__pyx_v_self->_theGraph, __pyx_v_encodedFileName); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1706, __pyx_L1_error) __pyx_v_result = __pyx_t_3; /* "planarity/full/graph.pyx":1707 * * result = graphLib.gp_Read(self._theGraph, encodedFileName) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_Read() failed for infile '{fileName}'." */ __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1707, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1707, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1707, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1707, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1708 * result = graphLib.gp_Read(self._theGraph, encodedFileName) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * f"gp_Read() failed for infile '{fileName}'." * ) */ __pyx_t_4 = NULL; /* "planarity/full/graph.pyx":1709 * if result != OK: * raise RuntimeError( * f"gp_Read() failed for infile '{fileName}'." # <<<<<<<<<<<<<< * ) * */ __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_v_fileName); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1709, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_gp_Read_failed_for_infile; __pyx_t_7[1] = __pyx_t_1; __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u__2; __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 29 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 2, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1709, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_9 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_8}; __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1708, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 1708, __pyx_L1_error) /* "planarity/full/graph.pyx":1707 * * result = graphLib.gp_Read(self._theGraph, encodedFileName) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_Read() failed for infile '{fileName}'." */ } /* "planarity/full/graph.pyx":1692 * return graphLib.gp_UpperBoundEdgeStorage(self._theGraph) * * def gp_Read(self, str fileName) -> None: # <<<<<<<<<<<<<< * """Reads the graph from the file named fileName. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_Read", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_encoded); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1712 * ) * * def gp_ReadFromString(self, str inputStr) -> None: # <<<<<<<<<<<<<< * """Reads the graph from the given input string. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_191gp_ReadFromString(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_190gp_ReadFromString, "Graph.gp_ReadFromString(self, str inputStr) -> None\n\nReads the graph from the given input string.\n\nArgs:\n inputStr: a string containing the graph to read.\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_191gp_ReadFromString = {"gp_ReadFromString", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_191gp_ReadFromString, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_190gp_ReadFromString}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_191gp_ReadFromString(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_inputStr = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ReadFromString (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_inputStr,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1712, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1712, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_ReadFromString", 0) < (0)) __PYX_ERR(0, 1712, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_ReadFromString", 1, 1, 1, i); __PYX_ERR(0, 1712, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1712, __pyx_L3_error) } __pyx_v_inputStr = ((PyObject*)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_ReadFromString", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1712, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ReadFromString", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_inputStr), (&PyUnicode_Type), 1, "inputStr", 1))) __PYX_ERR(0, 1712, __pyx_L1_error) __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_190gp_ReadFromString(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_inputStr); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } goto __pyx_L7_cleaned_up; __pyx_L0:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __pyx_L7_cleaned_up:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_190gp_ReadFromString(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, PyObject *__pyx_v_inputStr) { PyObject *__pyx_v_encoded = 0; char const *__pyx_v_encodedInputString; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; char const *__pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; size_t __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_ReadFromString", 0); /* "planarity/full/graph.pyx":1721 * RuntimeError if C graphlib version of this function failed. * """ * cdef bytes encoded = inputStr.encode('utf-8') # <<<<<<<<<<<<<< * cdef const char *encodedInputString = encoded * */ if (unlikely(__pyx_v_inputStr == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 1721, __pyx_L1_error) } __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_inputStr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1721, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_encoded = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "planarity/full/graph.pyx":1722 * """ * cdef bytes encoded = inputStr.encode('utf-8') * cdef const char *encodedInputString = encoded # <<<<<<<<<<<<<< * * if graphLib.gp_ReadFromString(self._theGraph, encodedInputString) != OK: */ __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_encoded); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 1722, __pyx_L1_error) __pyx_v_encodedInputString = __pyx_t_2; /* "planarity/full/graph.pyx":1724 * cdef const char *encodedInputString = encoded * * if graphLib.gp_ReadFromString(self._theGraph, encodedInputString) != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_ReadFromString() failed: unable to read from input string." */ __pyx_t_3 = __pyx_f_9planarity_4full_8graphLib_gp_ReadFromString(__pyx_v_self->_theGraph, __pyx_v_encodedInputString); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1724, __pyx_L1_error) __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1724, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1724, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1725 * * if graphLib.gp_ReadFromString(self._theGraph, encodedInputString) != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "gp_ReadFromString() failed: unable to read from input string." * ) */ __pyx_t_4 = NULL; __pyx_t_7 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_gp_ReadFromString_failed_unable}; __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1725, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 1725, __pyx_L1_error) /* "planarity/full/graph.pyx":1724 * cdef const char *encodedInputString = encoded * * if graphLib.gp_ReadFromString(self._theGraph, encodedInputString) != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_ReadFromString() failed: unable to read from input string." */ } /* "planarity/full/graph.pyx":1712 * ) * * def gp_ReadFromString(self, str inputStr) -> None: # <<<<<<<<<<<<<< * """Reads the graph from the given input string. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ReadFromString", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_encoded); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1729 * ) * * def gp_Write(self, str fileName, int writeMode) -> None: # <<<<<<<<<<<<<< * """Writes the graph to the file named fileName in the writeMode format. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_193gp_Write(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_192gp_Write, "Graph.gp_Write(self, str fileName, int writeMode) -> None\n\nWrites the graph to the file named fileName in the writeMode format.\n\nArgs:\n fileName: a string containing the name of the file to which to write\n writeMode: the desired output format, i.e., WRITE_ADJLIST,\n WRITE_ADJMATRIX, or WRITE_G6\n\nRaises:\n ValueError if writeMode is not WRITE_ADJLIST, WRITE_ADJMATRIX,\n or WRITE_G6\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_193gp_Write = {"gp_Write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_193gp_Write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_192gp_Write}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_193gp_Write(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_fileName = 0; int __pyx_v_writeMode; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_Write (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_fileName,&__pyx_mstate_global->__pyx_n_u_writeMode,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1729, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1729, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1729, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_Write", 0) < (0)) __PYX_ERR(0, 1729, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_Write", 1, 2, 2, i); __PYX_ERR(0, 1729, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1729, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1729, __pyx_L3_error) } __pyx_v_fileName = ((PyObject*)values[0]); __pyx_v_writeMode = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_writeMode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1729, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_Write", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1729, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_Write", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fileName), (&PyUnicode_Type), 1, "fileName", 1))) __PYX_ERR(0, 1729, __pyx_L1_error) __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_192gp_Write(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_fileName, __pyx_v_writeMode); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } goto __pyx_L7_cleaned_up; __pyx_L0:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __pyx_L7_cleaned_up:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_192gp_Write(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, PyObject *__pyx_v_fileName, int __pyx_v_writeMode) { PyObject *__pyx_v_encoded = 0; char const *__pyx_v_encodedFileName; int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; size_t __pyx_t_8; char const *__pyx_t_9; PyObject *__pyx_t_10[3]; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_Write", 0); /* "planarity/full/graph.pyx":1742 * RuntimeError if C graphlib version of this function failed. * """ * if writeMode not in (WRITE_ADJLIST, WRITE_ADJMATRIX, WRITE_G6): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_Write() failed: invalid writeMode = {writeMode}" */ __pyx_t_1 = __pyx_v_writeMode; __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_WRITE_ADJLIST); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1742, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1742, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { } else { __pyx_t_2 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_WRITE_ADJMATRIX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1742, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1742, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { } else { __pyx_t_2 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_WRITE_G6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1742, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1742, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = __pyx_t_6; __pyx_L4_bool_binop_done:; __pyx_t_6 = __pyx_t_2; if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1743 * """ * if writeMode not in (WRITE_ADJLIST, WRITE_ADJMATRIX, WRITE_G6): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_Write() failed: invalid writeMode = {writeMode}" * ) */ __pyx_t_4 = NULL; /* "planarity/full/graph.pyx":1744 * if writeMode not in (WRITE_ADJLIST, WRITE_ADJMATRIX, WRITE_G6): * raise ValueError( * f"gp_Write() failed: invalid writeMode = {writeMode}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_writeMode, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1744, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_Write_failed_invalid_writeMod, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1744, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_8 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7}; __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1743, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 1743, __pyx_L1_error) /* "planarity/full/graph.pyx":1742 * RuntimeError if C graphlib version of this function failed. * """ * if writeMode not in (WRITE_ADJLIST, WRITE_ADJMATRIX, WRITE_G6): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_Write() failed: invalid writeMode = {writeMode}" */ } /* "planarity/full/graph.pyx":1748 * * # Convert Python str to UTF-8 encoded bytes, and then to const char * * cdef bytes encoded = fileName.encode('utf-8') # <<<<<<<<<<<<<< * cdef const char *encodedFileName = encoded * */ if (unlikely(__pyx_v_fileName == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 1748, __pyx_L1_error) } __pyx_t_5 = PyUnicode_AsUTF8String(__pyx_v_fileName); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1748, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_encoded = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0; /* "planarity/full/graph.pyx":1749 * # Convert Python str to UTF-8 encoded bytes, and then to const char * * cdef bytes encoded = fileName.encode('utf-8') * cdef const char *encodedFileName = encoded # <<<<<<<<<<<<<< * * result = graphLib.gp_Write(self._theGraph, encodedFileName, writeMode) */ __pyx_t_9 = __Pyx_PyBytes_AsString(__pyx_v_encoded); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 1749, __pyx_L1_error) __pyx_v_encodedFileName = __pyx_t_9; /* "planarity/full/graph.pyx":1751 * cdef const char *encodedFileName = encoded * * result = graphLib.gp_Write(self._theGraph, encodedFileName, writeMode) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_Write(__pyx_v_self->_theGraph, __pyx_v_encodedFileName, __pyx_v_writeMode); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1751, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":1752 * * result = graphLib.gp_Write(self._theGraph, encodedFileName, writeMode) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_Write() of graph to '{fileName}' failed." */ __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1752, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1752, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1752, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1752, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1753 * result = graphLib.gp_Write(self._theGraph, encodedFileName, writeMode) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * f"gp_Write() of graph to '{fileName}' failed." * ) */ __pyx_t_7 = NULL; /* "planarity/full/graph.pyx":1754 * if result != OK: * raise RuntimeError( * f"gp_Write() of graph to '{fileName}' failed." # <<<<<<<<<<<<<< * ) * */ __pyx_t_5 = __Pyx_PyUnicode_Unicode(__pyx_v_fileName); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1754, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_10[0] = __pyx_mstate_global->__pyx_kp_u_gp_Write_of_graph_to; __pyx_t_10[1] = __pyx_t_5; __pyx_t_10[2] = __pyx_mstate_global->__pyx_kp_u_failed; __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_10, 3, 24 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5) + 9, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_5)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1754, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_8 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_3}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1753, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 1753, __pyx_L1_error) /* "planarity/full/graph.pyx":1752 * * result = graphLib.gp_Write(self._theGraph, encodedFileName, writeMode) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_Write() of graph to '{fileName}' failed." */ } /* "planarity/full/graph.pyx":1729 * ) * * def gp_Write(self, str fileName, int writeMode) -> None: # <<<<<<<<<<<<<< * """Writes the graph to the file named fileName in the writeMode format. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_Write", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_encoded); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1757 * ) * * def gp_WriteToString(self, int writeMode) -> str: # <<<<<<<<<<<<<< * """Writes the graph to a string in the writeMode format. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_195gp_WriteToString(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_194gp_WriteToString, "Graph.gp_WriteToString(self, int writeMode) -> str\n\nWrites the graph to a string in the writeMode format.\n\nArgs:\n writeMode: the desired output format, i.e., WRITE_ADJLIST,\n WRITE_ADJMATRIX, or WRITE_G6\n\nReturns:\n A Python string containing the graph serialized into the chosen format.\n\nRaises:\n ValueError if writeMode is not WRITE_ADJLIST, WRITE_ADJMATRIX,\n or WRITE_G6\n RuntimeError if C graphlib version of this function failed, if the\n outputString is NULL, or if decoding the bytes to produce the\n Python string failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_195gp_WriteToString = {"gp_WriteToString", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_195gp_WriteToString, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_194gp_WriteToString}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_195gp_WriteToString(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_writeMode; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_WriteToString (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_writeMode,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1757, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1757, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_WriteToString", 0) < (0)) __PYX_ERR(0, 1757, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_WriteToString", 1, 1, 1, i); __PYX_ERR(0, 1757, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1757, __pyx_L3_error) } __pyx_v_writeMode = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_writeMode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1757, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_WriteToString", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1757, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_WriteToString", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_194gp_WriteToString(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_writeMode); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_194gp_WriteToString(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_writeMode) { char *__pyx_v_outputString; PyObject *__pyx_v_output_bytes = NULL; PyObject *__pyx_v_string_conversion_error = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; size_t __pyx_t_8; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; int __pyx_t_13; char const *__pyx_t_14; PyObject *__pyx_t_15 = NULL; PyObject *__pyx_t_16 = NULL; PyObject *__pyx_t_17 = NULL; PyObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; PyObject *__pyx_t_20 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_WriteToString", 0); /* "planarity/full/graph.pyx":1774 * Python string failed. * """ * if writeMode not in (WRITE_ADJLIST, WRITE_ADJMATRIX, WRITE_G6): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_WriteToString() failed: invalid writeMode = {writeMode}" */ __pyx_t_1 = __pyx_v_writeMode; __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1774, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_WRITE_ADJLIST); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1774, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1774, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1774, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { } else { __pyx_t_2 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1774, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_WRITE_ADJMATRIX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1774, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1774, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1774, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { } else { __pyx_t_2 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1774, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_WRITE_G6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1774, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1774, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1774, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = __pyx_t_6; __pyx_L4_bool_binop_done:; __pyx_t_6 = __pyx_t_2; if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1775 * """ * if writeMode not in (WRITE_ADJLIST, WRITE_ADJMATRIX, WRITE_G6): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_WriteToString() failed: invalid writeMode = {writeMode}" * ) */ __pyx_t_4 = NULL; /* "planarity/full/graph.pyx":1776 * if writeMode not in (WRITE_ADJLIST, WRITE_ADJMATRIX, WRITE_G6): * raise ValueError( * f"gp_WriteToString() failed: invalid writeMode = {writeMode}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_3 = __Pyx_PyUnicode_From_int(__pyx_v_writeMode, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1776, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_WriteToString_failed_invalid, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1776, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_8 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_7}; __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1775, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 1775, __pyx_L1_error) /* "planarity/full/graph.pyx":1774 * Python string failed. * """ * if writeMode not in (WRITE_ADJLIST, WRITE_ADJMATRIX, WRITE_G6): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_WriteToString() failed: invalid writeMode = {writeMode}" */ } /* "planarity/full/graph.pyx":1779 * ) * * cdef char *outputString = NULL # <<<<<<<<<<<<<< * if graphLib.gp_WriteToString(self._theGraph, &outputString, writeMode) != OK: * if outputString != NULL: */ __pyx_v_outputString = NULL; /* "planarity/full/graph.pyx":1780 * * cdef char *outputString = NULL * if graphLib.gp_WriteToString(self._theGraph, &outputString, writeMode) != OK: # <<<<<<<<<<<<<< * if outputString != NULL: * free(outputString) */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_WriteToString(__pyx_v_self->_theGraph, (&__pyx_v_outputString), __pyx_v_writeMode); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1780, __pyx_L1_error) __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1780, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1780, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_t_7, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1780, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1780, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { /* "planarity/full/graph.pyx":1781 * cdef char *outputString = NULL * if graphLib.gp_WriteToString(self._theGraph, &outputString, writeMode) != OK: * if outputString != NULL: # <<<<<<<<<<<<<< * free(outputString) * outputString = NULL */ __pyx_t_6 = (__pyx_v_outputString != NULL); if (__pyx_t_6) { /* "planarity/full/graph.pyx":1782 * if graphLib.gp_WriteToString(self._theGraph, &outputString, writeMode) != OK: * if outputString != NULL: * free(outputString) # <<<<<<<<<<<<<< * outputString = NULL * */ free(__pyx_v_outputString); /* "planarity/full/graph.pyx":1783 * if outputString != NULL: * free(outputString) * outputString = NULL # <<<<<<<<<<<<<< * * raise RuntimeError( */ __pyx_v_outputString = NULL; /* "planarity/full/graph.pyx":1781 * cdef char *outputString = NULL * if graphLib.gp_WriteToString(self._theGraph, &outputString, writeMode) != OK: * if outputString != NULL: # <<<<<<<<<<<<<< * free(outputString) * outputString = NULL */ } /* "planarity/full/graph.pyx":1785 * outputString = NULL * * raise RuntimeError( # <<<<<<<<<<<<<< * "gp_WriteToString() failed: unable to write graph to string." * ) */ __pyx_t_7 = NULL; __pyx_t_8 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_gp_WriteToString_failed_unable_t}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1785, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 1785, __pyx_L1_error) /* "planarity/full/graph.pyx":1780 * * cdef char *outputString = NULL * if graphLib.gp_WriteToString(self._theGraph, &outputString, writeMode) != OK: # <<<<<<<<<<<<<< * if outputString != NULL: * free(outputString) */ } /* "planarity/full/graph.pyx":1789 * ) * * if outputString == NULL: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_WriteToString() failed: outputString is NULL" */ __pyx_t_6 = (__pyx_v_outputString == NULL); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1790 * * if outputString == NULL: * raise RuntimeError( # <<<<<<<<<<<<<< * "gp_WriteToString() failed: outputString is NULL" * ) */ __pyx_t_7 = NULL; __pyx_t_8 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_gp_WriteToString_failed_outputSt}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1790, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 1790, __pyx_L1_error) /* "planarity/full/graph.pyx":1789 * ) * * if outputString == NULL: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_WriteToString() failed: outputString is NULL" */ } /* "planarity/full/graph.pyx":1794 * ) * * output_bytes = outputString[:] # <<<<<<<<<<<<<< * free(outputString) * outputString = NULL */ __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_outputString + 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1794, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_v_output_bytes = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1795 * * output_bytes = outputString[:] * free(outputString) # <<<<<<<<<<<<<< * outputString = NULL * try: */ free(__pyx_v_outputString); /* "planarity/full/graph.pyx":1796 * output_bytes = outputString[:] * free(outputString) * outputString = NULL # <<<<<<<<<<<<<< * try: * return output_bytes.decode('UTF-8') */ __pyx_v_outputString = NULL; /* "planarity/full/graph.pyx":1797 * free(outputString) * outputString = NULL * try: # <<<<<<<<<<<<<< * return output_bytes.decode('UTF-8') * except Exception as string_conversion_error: */ { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); __Pyx_XGOTREF(__pyx_t_9); __Pyx_XGOTREF(__pyx_t_10); __Pyx_XGOTREF(__pyx_t_11); /*try:*/ { /* "planarity/full/graph.pyx":1798 * outputString = NULL * try: * return output_bytes.decode('UTF-8') # <<<<<<<<<<<<<< * except Exception as string_conversion_error: * raise RuntimeError( */ __Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_decode_bytes(__pyx_v_output_bytes, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1798, __pyx_L10_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L14_try_return; /* "planarity/full/graph.pyx":1797 * free(outputString) * outputString = NULL * try: # <<<<<<<<<<<<<< * return output_bytes.decode('UTF-8') * except Exception as string_conversion_error: */ } __pyx_L10_error:; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; /* "planarity/full/graph.pyx":1799 * try: * return output_bytes.decode('UTF-8') * except Exception as string_conversion_error: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_WriteToString() failed: failed to convert C string to " */ __pyx_t_1 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); if (__pyx_t_1) { __Pyx_AddTraceback("planarity.full.graph.Graph.gp_WriteToString", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_7, &__pyx_t_5) < 0) __PYX_ERR(0, 1799, __pyx_L12_except_error) __Pyx_XGOTREF(__pyx_t_4); __Pyx_XGOTREF(__pyx_t_7); __Pyx_XGOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_v_string_conversion_error = __pyx_t_7; /*try:*/ { /* "planarity/full/graph.pyx":1800 * return output_bytes.decode('UTF-8') * except Exception as string_conversion_error: * raise RuntimeError( # <<<<<<<<<<<<<< * "gp_WriteToString() failed: failed to convert C string to " * "Python string." */ __pyx_t_12 = NULL; __pyx_t_8 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_gp_WriteToString_failed_failed_t}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1800, __pyx_L21_error) __Pyx_GOTREF(__pyx_t_3); } /* "planarity/full/graph.pyx":1803 * "gp_WriteToString() failed: failed to convert C string to " * "Python string." * ) from string_conversion_error # <<<<<<<<<<<<<< * * def gp_ExtendWith_DFSUtils(self) -> None: */ __Pyx_Raise(__pyx_t_3, 0, 0, __pyx_v_string_conversion_error); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1800, __pyx_L21_error) } /* "planarity/full/graph.pyx":1799 * try: * return output_bytes.decode('UTF-8') * except Exception as string_conversion_error: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_WriteToString() failed: failed to convert C string to " */ /*finally:*/ { __pyx_L21_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_ExceptionSwap(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20); if ( unlikely(__Pyx_GetException(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17) < 0)) __Pyx_ErrFetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __Pyx_XGOTREF(__pyx_t_20); __pyx_t_1 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename; { __Pyx_DECREF(__pyx_v_string_conversion_error); __pyx_v_string_conversion_error = 0; } __Pyx_XGIVEREF(__pyx_t_18); __Pyx_XGIVEREF(__pyx_t_19); __Pyx_XGIVEREF(__pyx_t_20); __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_19, __pyx_t_20); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_ErrRestore(__pyx_t_15, __pyx_t_16, __pyx_t_17); __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; __pyx_lineno = __pyx_t_1; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14; goto __pyx_L12_except_error; } } } goto __pyx_L12_except_error; /* "planarity/full/graph.pyx":1797 * free(outputString) * outputString = NULL * try: # <<<<<<<<<<<<<< * return output_bytes.decode('UTF-8') * except Exception as string_conversion_error: */ __pyx_L12_except_error:; __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_11); __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); goto __pyx_L1_error; __pyx_L14_try_return:; __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_11); __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); goto __pyx_L0; } /* "planarity/full/graph.pyx":1757 * ) * * def gp_WriteToString(self, int writeMode) -> str: # <<<<<<<<<<<<<< * """Writes the graph to a string in the writeMode format. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_12); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_WriteToString", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_output_bytes); __Pyx_XDECREF(__pyx_v_string_conversion_error); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1805 * ) from string_conversion_error * * def gp_ExtendWith_DFSUtils(self) -> None: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the DFSUtils extension, which * adds the data structures and methods necessary for performing DFS-related */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_197gp_ExtendWith_DFSUtils(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_196gp_ExtendWith_DFSUtils, "Graph.gp_ExtendWith_DFSUtils(self) -> None\n\nDynamically subclasses the graph with the DFSUtils extension, which\nadds the data structures and methods necessary for performing DFS-related\noperations.\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_197gp_ExtendWith_DFSUtils = {"gp_ExtendWith_DFSUtils", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_197gp_ExtendWith_DFSUtils, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_196gp_ExtendWith_DFSUtils}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_197gp_ExtendWith_DFSUtils(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ExtendWith_DFSUtils (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_ExtendWith_DFSUtils", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_ExtendWith_DFSUtils", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_196gp_ExtendWith_DFSUtils(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_196gp_ExtendWith_DFSUtils(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_ExtendWith_DFSUtils", 0); /* "planarity/full/graph.pyx":1813 * RuntimeError if C graphlib version of this function failed. * """ * if graphLib.gp_ExtendWith_DFSUtils(self._theGraph) != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_ExtendWith_DFSUtils() failed: unable to extend graph with " */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_DFSUtils(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1813, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1813, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1813, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1813, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1813, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":1814 * """ * if graphLib.gp_ExtendWith_DFSUtils(self._theGraph) != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "gp_ExtendWith_DFSUtils() failed: unable to extend graph with " * "DFSUtils structures" */ __pyx_t_3 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_gp_ExtendWith_DFSUtils_failed_un}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1814, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 1814, __pyx_L1_error) /* "planarity/full/graph.pyx":1813 * RuntimeError if C graphlib version of this function failed. * """ * if graphLib.gp_ExtendWith_DFSUtils(self._theGraph) != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_ExtendWith_DFSUtils() failed: unable to extend graph with " */ } /* "planarity/full/graph.pyx":1805 * ) from string_conversion_error * * def gp_ExtendWith_DFSUtils(self) -> None: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the DFSUtils extension, which * adds the data structures and methods necessary for performing DFS-related */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ExtendWith_DFSUtils", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1819 * ) * * def gp_DepthFirstSearch(self) -> None: # <<<<<<<<<<<<<< * """Performs a depth-first search (DFS) to give vertices values for their * depth first indices (DFIs) and DFS parents and give edges value for */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_199gp_DepthFirstSearch(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_198gp_DepthFirstSearch, "Graph.gp_DepthFirstSearch(self) -> None\n\nPerforms a depth-first search (DFS) to give vertices values for their\ndepth first indices (DFIs) and DFS parents and give edges value for\ntheir types. See gp_GetParent(), gp_GetIndex(), and gp_GetEdgeType().\nThis method also sets GRAPHFLAGS_DFSNUMBERED. This method performs\ngp_ExtendWith_DFSUtils() if not already done.\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_199gp_DepthFirstSearch = {"gp_DepthFirstSearch", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_199gp_DepthFirstSearch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_198gp_DepthFirstSearch}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_199gp_DepthFirstSearch(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_DepthFirstSearch (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_DepthFirstSearch", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_DepthFirstSearch", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_198gp_DepthFirstSearch(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_198gp_DepthFirstSearch(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_DepthFirstSearch", 0); /* "planarity/full/graph.pyx":1829 * RuntimeError if C graphlib version of this function failed. * """ * if graphLib.gp_DepthFirstSearch(self._theGraph) != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_DepthFirstSearch() failed: unable to perform DFS on graph." */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_DepthFirstSearch(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1829, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1829, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1829, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1829, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1829, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":1830 * """ * if graphLib.gp_DepthFirstSearch(self._theGraph) != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "gp_DepthFirstSearch() failed: unable to perform DFS on graph." * ) */ __pyx_t_3 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_gp_DepthFirstSearch_failed_unabl}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1830, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 1830, __pyx_L1_error) /* "planarity/full/graph.pyx":1829 * RuntimeError if C graphlib version of this function failed. * """ * if graphLib.gp_DepthFirstSearch(self._theGraph) != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_DepthFirstSearch() failed: unable to perform DFS on graph." */ } /* "planarity/full/graph.pyx":1819 * ) * * def gp_DepthFirstSearch(self) -> None: # <<<<<<<<<<<<<< * """Performs a depth-first search (DFS) to give vertices values for their * depth first indices (DFIs) and DFS parents and give edges value for */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DepthFirstSearch", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1834 * ) * * def gp_SortVertices(self) -> None: # <<<<<<<<<<<<<< * """Sort vertices in ascending order according to their DFIs. * This method invokes gp_DepthFirstSearch(), if it has not already */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_201gp_SortVertices(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_200gp_SortVertices, "Graph.gp_SortVertices(self) -> None\n\nSort vertices in ascending order according to their DFIs.\nThis method invokes gp_DepthFirstSearch(), if it has not already\nbeen done. This method sets GRAPHFLAGS_SORTEDBYDFI. A second\ninvocation of this method restores vertices to their original\norder and clears GRAPHFLAGS_SORTEDBYDFI. When GRAPHFLAGS_SORTEDBYDFI\nis set, the index values of all vertices are changed from their DFIs \nto their original index positions in vertex storage. \n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_201gp_SortVertices = {"gp_SortVertices", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_201gp_SortVertices, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_200gp_SortVertices}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_201gp_SortVertices(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_SortVertices (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_SortVertices", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_SortVertices", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_200gp_SortVertices(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_200gp_SortVertices(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_SortVertices", 0); /* "planarity/full/graph.pyx":1846 * RuntimeError if C graphlib version of this function failed. * """ * if graphLib.gp_SortVertices(self._theGraph) != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_SortVertices() failed." */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_SortVertices(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1846, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1846, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1846, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1846, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1846, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":1847 * """ * if graphLib.gp_SortVertices(self._theGraph) != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "gp_SortVertices() failed." * ) */ __pyx_t_3 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_gp_SortVertices_failed}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1847, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 1847, __pyx_L1_error) /* "planarity/full/graph.pyx":1846 * RuntimeError if C graphlib version of this function failed. * """ * if graphLib.gp_SortVertices(self._theGraph) != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_SortVertices() failed." */ } /* "planarity/full/graph.pyx":1834 * ) * * def gp_SortVertices(self) -> None: # <<<<<<<<<<<<<< * """Sort vertices in ascending order according to their DFIs. * This method invokes gp_DepthFirstSearch(), if it has not already */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_SortVertices", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1851 * ) * * def gp_ComputeLowpoints(self) -> None: # <<<<<<<<<<<<<< * """Computes lowpoints and least ancestors for all vertices. This method * first performs gp_DepthFirstSearch() and gp_SortVertices() if they */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_203gp_ComputeLowpoints(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_202gp_ComputeLowpoints, "Graph.gp_ComputeLowpoints(self) -> None\n\nComputes lowpoints and least ancestors for all vertices. This method\nfirst performs gp_DepthFirstSearch() and gp_SortVertices() if they\nhave not already been done.\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_203gp_ComputeLowpoints = {"gp_ComputeLowpoints", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_203gp_ComputeLowpoints, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_202gp_ComputeLowpoints}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_203gp_ComputeLowpoints(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ComputeLowpoints (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_ComputeLowpoints", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_ComputeLowpoints", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_202gp_ComputeLowpoints(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_202gp_ComputeLowpoints(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_ComputeLowpoints", 0); /* "planarity/full/graph.pyx":1859 * RuntimeError if C graphlib version of this function failed. * """ * if graphLib.gp_ComputeLowpoints(self._theGraph) != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_ComputeLowpoints() failed." */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_ComputeLowpoints(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1859, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1859, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1859, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1859, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1859, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":1860 * """ * if graphLib.gp_ComputeLowpoints(self._theGraph) != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "gp_ComputeLowpoints() failed." * ) */ __pyx_t_3 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_gp_ComputeLowpoints_failed}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1860, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 1860, __pyx_L1_error) /* "planarity/full/graph.pyx":1859 * RuntimeError if C graphlib version of this function failed. * """ * if graphLib.gp_ComputeLowpoints(self._theGraph) != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_ComputeLowpoints() failed." */ } /* "planarity/full/graph.pyx":1851 * ) * * def gp_ComputeLowpoints(self) -> None: # <<<<<<<<<<<<<< * """Computes lowpoints and least ancestors for all vertices. This method * first performs gp_DepthFirstSearch() and gp_SortVertices() if they */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ComputeLowpoints", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1864 * ) * * def gp_ComputeLeastAncestors(self) -> None: # <<<<<<<<<<<<<< * """Computes least ancestor values for all vertices. This method * first performs gp_DepthFirstSearch() and gp_SortVertices() if they */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_205gp_ComputeLeastAncestors(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_204gp_ComputeLeastAncestors, "Graph.gp_ComputeLeastAncestors(self) -> None\n\nComputes least ancestor values for all vertices. This method\nfirst performs gp_DepthFirstSearch() and gp_SortVertices() if they\nhave not already been done.\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_205gp_ComputeLeastAncestors = {"gp_ComputeLeastAncestors", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_205gp_ComputeLeastAncestors, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_204gp_ComputeLeastAncestors}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_205gp_ComputeLeastAncestors(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ComputeLeastAncestors (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_ComputeLeastAncestors", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_ComputeLeastAncestors", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_204gp_ComputeLeastAncestors(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_204gp_ComputeLeastAncestors(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_ComputeLeastAncestors", 0); /* "planarity/full/graph.pyx":1872 * RuntimeError if C graphlib version of this function failed. * """ * if graphLib.gp_ComputeLeastAncestors(self._theGraph) != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_ComputeLeastAncestors() failed." */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_ComputeLeastAncestors(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1872, __pyx_L1_error) __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1872, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1872, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1872, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1872, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":1873 * """ * if graphLib.gp_ComputeLeastAncestors(self._theGraph) != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "gp_ComputeLeastAncestors() failed." * ) */ __pyx_t_3 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_gp_ComputeLeastAncestors_failed}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1873, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 1873, __pyx_L1_error) /* "planarity/full/graph.pyx":1872 * RuntimeError if C graphlib version of this function failed. * """ * if graphLib.gp_ComputeLeastAncestors(self._theGraph) != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_ComputeLeastAncestors() failed." */ } /* "planarity/full/graph.pyx":1864 * ) * * def gp_ComputeLeastAncestors(self) -> None: # <<<<<<<<<<<<<< * """Computes least ancestor values for all vertices. This method * first performs gp_DepthFirstSearch() and gp_SortVertices() if they */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ComputeLeastAncestors", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1877 * ) * * def gp_GetParent(self, int v) -> int: # <<<<<<<<<<<<<< * """Get DFS parent of vertex v, once gp_DepthFirstSearch() has been called. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_207gp_GetParent(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_206gp_GetParent, "Graph.gp_GetParent(self, int v) -> int\n\nGet DFS parent of vertex v, once gp_DepthFirstSearch() has been called.\n\nArgs:\n v: a vertex in the graph whose DFS parent you wish to obtain\n\nReturns:\n The DFS parent of v in the graph, or NIL if v is the root of the\n DFS tree (or if gp_DepthFirstSearch() has not been called).\n\nRaises:\n ValueError if v is not a valid vertex"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_207gp_GetParent = {"gp_GetParent", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_207gp_GetParent, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_206gp_GetParent}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_207gp_GetParent(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetParent (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1877, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1877, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetParent", 0) < (0)) __PYX_ERR(0, 1877, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetParent", 1, 1, 1, i); __PYX_ERR(0, 1877, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1877, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1877, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetParent", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1877, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetParent", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_206gp_GetParent(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_206gp_GetParent(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetParent", 0); /* "planarity/full/graph.pyx":1890 * ValueError if v is not a valid vertex * """ * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetParent() failed: invalid vertex v = {v}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1890, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1891 * """ * if not self.gp_IsVertex(v): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetParent() failed: invalid vertex v = {v}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1892 * if not self.gp_IsVertex(v): * raise ValueError( * f"gp_GetParent() failed: invalid vertex v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1892, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetParent_failed_invalid_vert, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1892, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1891, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1891, __pyx_L1_error) /* "planarity/full/graph.pyx":1890 * ValueError if v is not a valid vertex * """ * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetParent() failed: invalid vertex v = {v}" */ } /* "planarity/full/graph.pyx":1895 * ) * * return graphLib.gp_GetParent(self._theGraph, v) # <<<<<<<<<<<<<< * * def gp_GetLeastAncestor(self, int v) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_GetParent(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1895, __pyx_L1_error) __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1895, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 1895, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1877 * ) * * def gp_GetParent(self, int v) -> int: # <<<<<<<<<<<<<< * """Get DFS parent of vertex v, once gp_DepthFirstSearch() has been called. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetParent", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1897 * return graphLib.gp_GetParent(self._theGraph, v) * * def gp_GetLeastAncestor(self, int v) -> int: # <<<<<<<<<<<<<< * """Get least ancestor of vertex v, after least ancestors are computed. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_209gp_GetLeastAncestor(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_208gp_GetLeastAncestor, "Graph.gp_GetLeastAncestor(self, int v) -> int\n\nGet least ancestor of vertex v, after least ancestors are computed.\n\nArgs:\n v: a vertex in the graph whose least ancestor you wish to obtain\n\nReturns:\n The least ancestor of v, or NIL if least ancestor values have not\n yet been computed.\n\nRaises:\n ValueError if v is not a valid vertex."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_209gp_GetLeastAncestor = {"gp_GetLeastAncestor", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_209gp_GetLeastAncestor, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_208gp_GetLeastAncestor}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_209gp_GetLeastAncestor(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetLeastAncestor (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1897, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1897, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetLeastAncestor", 0) < (0)) __PYX_ERR(0, 1897, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetLeastAncestor", 1, 1, 1, i); __PYX_ERR(0, 1897, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1897, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1897, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetLeastAncestor", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1897, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetLeastAncestor", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_208gp_GetLeastAncestor(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_208gp_GetLeastAncestor(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetLeastAncestor", 0); /* "planarity/full/graph.pyx":1910 * ValueError if v is not a valid vertex. * """ * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetLeastAncestor() failed: invalid vertex v = {v}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1910, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1910, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1910, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1911 * """ * if not self.gp_IsVertex(v): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetLeastAncestor() failed: invalid vertex v = {v}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1912 * if not self.gp_IsVertex(v): * raise ValueError( * f"gp_GetLeastAncestor() failed: invalid vertex v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1912, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetLeastAncestor_failed_inval, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1912, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1911, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1911, __pyx_L1_error) /* "planarity/full/graph.pyx":1910 * ValueError if v is not a valid vertex. * """ * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetLeastAncestor() failed: invalid vertex v = {v}" */ } /* "planarity/full/graph.pyx":1915 * ) * * return graphLib.gp_GetLeastAncestor(self._theGraph, v) # <<<<<<<<<<<<<< * * def gp_GetLowpoint(self, int v) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_GetLeastAncestor(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1915, __pyx_L1_error) __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1915, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 1915, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1897 * return graphLib.gp_GetParent(self._theGraph, v) * * def gp_GetLeastAncestor(self, int v) -> int: # <<<<<<<<<<<<<< * """Get least ancestor of vertex v, after least ancestors are computed. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetLeastAncestor", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1917 * return graphLib.gp_GetLeastAncestor(self._theGraph, v) * * def gp_GetLowpoint(self, int v) -> int: # <<<<<<<<<<<<<< * """Get lowpoint value of vertex v, after lowpoint values are computed. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_211gp_GetLowpoint(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_210gp_GetLowpoint, "Graph.gp_GetLowpoint(self, int v) -> int\n\nGet lowpoint value of vertex v, after lowpoint values are computed.\n\nArgs:\n v: a vertex in the graph whose lowpoint value you wish to obtain\n\nReturns:\n The lowpoint of v, or NIL if lowpoints have not yet been computed.\n\nRaises:\n ValueError if v is not a valid vertex."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_211gp_GetLowpoint = {"gp_GetLowpoint", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_211gp_GetLowpoint, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_210gp_GetLowpoint}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_211gp_GetLowpoint(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetLowpoint (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1917, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1917, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetLowpoint", 0) < (0)) __PYX_ERR(0, 1917, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetLowpoint", 1, 1, 1, i); __PYX_ERR(0, 1917, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1917, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1917, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetLowpoint", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1917, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetLowpoint", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_210gp_GetLowpoint(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_210gp_GetLowpoint(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetLowpoint", 0); /* "planarity/full/graph.pyx":1929 * ValueError if v is not a valid vertex. * """ * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetLowpoint() failed: invalid vertex v = {v}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1929, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1929, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1929, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1930 * """ * if not self.gp_IsVertex(v): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetLowpoint() failed: invalid vertex v = {v}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1931 * if not self.gp_IsVertex(v): * raise ValueError( * f"gp_GetLowpoint() failed: invalid vertex v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1931, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetLowpoint_failed_invalid_ve, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1931, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1930, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1930, __pyx_L1_error) /* "planarity/full/graph.pyx":1929 * ValueError if v is not a valid vertex. * """ * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetLowpoint() failed: invalid vertex v = {v}" */ } /* "planarity/full/graph.pyx":1934 * ) * * return graphLib.gp_GetLowpoint(self._theGraph, v) # <<<<<<<<<<<<<< * * def gp_IsDFSTreeRoot(self, int v) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_GetLowpoint(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1934, __pyx_L1_error) __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1934, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 1934, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1917 * return graphLib.gp_GetLeastAncestor(self._theGraph, v) * * def gp_GetLowpoint(self, int v) -> int: # <<<<<<<<<<<<<< * """Get lowpoint value of vertex v, after lowpoint values are computed. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetLowpoint", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1936 * return graphLib.gp_GetLowpoint(self._theGraph, v) * * def gp_IsDFSTreeRoot(self, int v) -> int: # <<<<<<<<<<<<<< * """Determine if vertex v corresponds to DFS tree root (if DFS parent is NIL). * This method assumes that gp_DepthFirstSearch() has been called. */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_213gp_IsDFSTreeRoot(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_212gp_IsDFSTreeRoot, "Graph.gp_IsDFSTreeRoot(self, int v) -> int\n\nDetermine if vertex v corresponds to DFS tree root (if DFS parent is NIL).\nThis method assumes that gp_DepthFirstSearch() has been called.\n\nArgs:\n v: a vertex in the graph you wish to determine is the DFS tree root\n\nReturns:\n TRUE if v is the DFS tree root, FALSE otherwise\n\nRaises:\n ValueError if v is not a valid vertex"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_213gp_IsDFSTreeRoot = {"gp_IsDFSTreeRoot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_213gp_IsDFSTreeRoot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_212gp_IsDFSTreeRoot}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_213gp_IsDFSTreeRoot(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_IsDFSTreeRoot (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1936, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1936, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_IsDFSTreeRoot", 0) < (0)) __PYX_ERR(0, 1936, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_IsDFSTreeRoot", 1, 1, 1, i); __PYX_ERR(0, 1936, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1936, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1936, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_IsDFSTreeRoot", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1936, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsDFSTreeRoot", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_212gp_IsDFSTreeRoot(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_212gp_IsDFSTreeRoot(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_IsDFSTreeRoot", 0); /* "planarity/full/graph.pyx":1949 * ValueError if v is not a valid vertex * """ * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_IsDFSTreeRoot() failed: invalid vertex v = {v}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1949, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1949, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1949, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1950 * """ * if not self.gp_IsVertex(v): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_IsDFSTreeRoot() failed: invalid vertex v = {v}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1951 * if not self.gp_IsVertex(v): * raise ValueError( * f"gp_IsDFSTreeRoot() failed: invalid vertex v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1951, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_IsDFSTreeRoot_failed_invalid, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1951, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1950, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1950, __pyx_L1_error) /* "planarity/full/graph.pyx":1949 * ValueError if v is not a valid vertex * """ * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_IsDFSTreeRoot() failed: invalid vertex v = {v}" */ } /* "planarity/full/graph.pyx":1962 * # * # return FALSE * if self.gp_IsNotVertex(self.gp_GetParent(v)): # <<<<<<<<<<<<<< * return TRUE * */ __pyx_t_7 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_7); __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1962, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_8}; __pyx_t_3 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_GetParent, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1962, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsNotVertex, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1962, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1962, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_6) { /* "planarity/full/graph.pyx":1963 * # return FALSE * if self.gp_IsNotVertex(self.gp_GetParent(v)): * return TRUE # <<<<<<<<<<<<<< * * return FALSE */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_TRUE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1963, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 1) < (0)) __PYX_ERR(0, 1963, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1962 * # * # return FALSE * if self.gp_IsNotVertex(self.gp_GetParent(v)): # <<<<<<<<<<<<<< * return TRUE * */ } /* "planarity/full/graph.pyx":1965 * return TRUE * * return FALSE # <<<<<<<<<<<<<< * * def gp_IsNotDFSTreeRoot(self, int v) -> int: */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_FALSE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1965, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 1) < (0)) __PYX_ERR(0, 1965, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1936 * return graphLib.gp_GetLowpoint(self._theGraph, v) * * def gp_IsDFSTreeRoot(self, int v) -> int: # <<<<<<<<<<<<<< * """Determine if vertex v corresponds to DFS tree root (if DFS parent is NIL). * This method assumes that gp_DepthFirstSearch() has been called. */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsDFSTreeRoot", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1967 * return FALSE * * def gp_IsNotDFSTreeRoot(self, int v) -> int: # <<<<<<<<<<<<<< * """Determine if vertex v is not the DFS roo (if DFS parent is not NIL). * This method assumes that gp_DepthFirstSearch() has been called. */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_215gp_IsNotDFSTreeRoot(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_214gp_IsNotDFSTreeRoot, "Graph.gp_IsNotDFSTreeRoot(self, int v) -> int\n\nDetermine if vertex v is not the DFS roo (if DFS parent is not NIL).\nThis method assumes that gp_DepthFirstSearch() has been called.\n\nArgs:\n v: a vertex in the graph you wish to determine is not the DFS tree\n root\n\nReturns:\n TRUE if v is not the DFS tree root, FALSE otherwise\n\nRaises:\n ValueError if v is not a valid vertex"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_215gp_IsNotDFSTreeRoot = {"gp_IsNotDFSTreeRoot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_215gp_IsNotDFSTreeRoot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_214gp_IsNotDFSTreeRoot}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_215gp_IsNotDFSTreeRoot(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_IsNotDFSTreeRoot (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1967, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1967, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_IsNotDFSTreeRoot", 0) < (0)) __PYX_ERR(0, 1967, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_IsNotDFSTreeRoot", 1, 1, 1, i); __PYX_ERR(0, 1967, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1967, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1967, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_IsNotDFSTreeRoot", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1967, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsNotDFSTreeRoot", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_214gp_IsNotDFSTreeRoot(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_214gp_IsNotDFSTreeRoot(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_IsNotDFSTreeRoot", 0); /* "planarity/full/graph.pyx":1981 * ValueError if v is not a valid vertex * """ * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_IsNotDFSTreeRoot() failed: invalid vertex v = {v}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1981, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1981, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1981, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":1982 * """ * if not self.gp_IsVertex(v): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_IsNotDFSTreeRoot() failed: invalid vertex v = {v}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":1983 * if not self.gp_IsVertex(v): * raise ValueError( * f"gp_IsNotDFSTreeRoot() failed: invalid vertex v = {v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1983, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_IsNotDFSTreeRoot_failed_inval, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1983, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1982, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1982, __pyx_L1_error) /* "planarity/full/graph.pyx":1981 * ValueError if v is not a valid vertex * """ * if not self.gp_IsVertex(v): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_IsNotDFSTreeRoot() failed: invalid vertex v = {v}" */ } /* "planarity/full/graph.pyx":1994 * # * # return FALSE * if not self.gp_IsDFSTreeRoot(v): # <<<<<<<<<<<<<< * return TRUE * */ __pyx_t_7 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_7); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1994, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsDFSTreeRoot, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1994, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1994, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (!__pyx_t_6); if (__pyx_t_5) { /* "planarity/full/graph.pyx":1995 * # return FALSE * if not self.gp_IsDFSTreeRoot(v): * return TRUE # <<<<<<<<<<<<<< * * return FALSE */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_TRUE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1995, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 1) < (0)) __PYX_ERR(0, 1995, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1994 * # * # return FALSE * if not self.gp_IsDFSTreeRoot(v): # <<<<<<<<<<<<<< * return TRUE * */ } /* "planarity/full/graph.pyx":1997 * return TRUE * * return FALSE # <<<<<<<<<<<<<< * * def gp_GetBicompRootFromDFSChild(self, int c) -> int: */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_FALSE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1997, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 1) < (0)) __PYX_ERR(0, 1997, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1967 * return FALSE * * def gp_IsNotDFSTreeRoot(self, int v) -> int: # <<<<<<<<<<<<<< * """Determine if vertex v is not the DFS roo (if DFS parent is not NIL). * This method assumes that gp_DepthFirstSearch() has been called. */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsNotDFSTreeRoot", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":1999 * return FALSE * * def gp_GetBicompRootFromDFSChild(self, int c) -> int: # <<<<<<<<<<<<<< * """Given a DFS child c of a vertex v, this method returns the biconneced * component (bicomp) root of v associated with c. The bicomp root is a */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_217gp_GetBicompRootFromDFSChild(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_216gp_GetBicompRootFromDFSChild, "Graph.gp_GetBicompRootFromDFSChild(self, int c) -> int\n\nGiven a DFS child c of a vertex v, this method returns the biconneced \ncomponent (bicomp) root of v associated with c. The bicomp root is a \nvirtual vertex.\n\nArgs:\n c: DFS child for which you wish to determine the root of the bicomp\n containing c\n\nReturns:\n The root of the bicomp containing c\n\nRaises:\n ValueError if c is not a valid vertex"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_217gp_GetBicompRootFromDFSChild = {"gp_GetBicompRootFromDFSChild", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_217gp_GetBicompRootFromDFSChild, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_216gp_GetBicompRootFromDFSChild}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_217gp_GetBicompRootFromDFSChild(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_c; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetBicompRootFromDFSChild (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_c,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 1999, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1999, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetBicompRootFromDFSChild", 0) < (0)) __PYX_ERR(0, 1999, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetBicompRootFromDFSChild", 1, 1, 1, i); __PYX_ERR(0, 1999, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1999, __pyx_L3_error) } __pyx_v_c = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_c == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1999, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetBicompRootFromDFSChild", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1999, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetBicompRootFromDFSChild", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_216gp_GetBicompRootFromDFSChild(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_c); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_216gp_GetBicompRootFromDFSChild(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_c) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetBicompRootFromDFSChild", 0); /* "planarity/full/graph.pyx":2014 * ValueError if c is not a valid vertex * """ * if not self.gp_IsVertex(c): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetBicompRootFromDFSChild() failed: invalid vertex c = {c}" */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2014, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2014, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2014, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":2015 * """ * if not self.gp_IsVertex(c): * raise ValueError( # <<<<<<<<<<<<<< * f"gp_GetBicompRootFromDFSChild() failed: invalid vertex c = {c}" * ) */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":2016 * if not self.gp_IsVertex(c): * raise ValueError( * f"gp_GetBicompRootFromDFSChild() failed: invalid vertex c = {c}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_c, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2016, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_GetBicompRootFromDFSChild_fai, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2016, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2015, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 2015, __pyx_L1_error) /* "planarity/full/graph.pyx":2014 * ValueError if c is not a valid vertex * """ * if not self.gp_IsVertex(c): # <<<<<<<<<<<<<< * raise ValueError( * f"gp_GetBicompRootFromDFSChild() failed: invalid vertex c = {c}" */ } /* "planarity/full/graph.pyx":2019 * ) * * return graphLib.gp_GetBicompRootFromDFSChild(self._theGraph, c) # <<<<<<<<<<<<<< * * def gp_GetDFSChildFromBicompRoot(self, int R) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_GetBicompRootFromDFSChild(__pyx_v_self->_theGraph, __pyx_v_c); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2019, __pyx_L1_error) __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2019, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 2019, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":1999 * return FALSE * * def gp_GetBicompRootFromDFSChild(self, int c) -> int: # <<<<<<<<<<<<<< * """Given a DFS child c of a vertex v, this method returns the biconneced * component (bicomp) root of v associated with c. The bicomp root is a */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetBicompRootFromDFSChild", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2021 * return graphLib.gp_GetBicompRootFromDFSChild(self._theGraph, c) * * def gp_GetDFSChildFromBicompRoot(self, int R) -> int: # <<<<<<<<<<<<<< * """Given a biconnected component root R (a virtual vertex), this method * returns the DFS child c of a vertex v that R represents. */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_219gp_GetDFSChildFromBicompRoot(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_218gp_GetDFSChildFromBicompRoot, "Graph.gp_GetDFSChildFromBicompRoot(self, int R) -> int\n\nGiven a biconnected component root R (a virtual vertex), this method\nreturns the DFS child c of a vertex v that R represents. \n\nArgs:\n R: root of a bicomp for which you wish to determine the DFS child\n\nReturns:\n The DFS child of v that is within the bicomp rooted by R\n\nRaises:\n ValueError if R is not a virtual vertex"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_219gp_GetDFSChildFromBicompRoot = {"gp_GetDFSChildFromBicompRoot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_219gp_GetDFSChildFromBicompRoot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_218gp_GetDFSChildFromBicompRoot}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_219gp_GetDFSChildFromBicompRoot(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_R; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetDFSChildFromBicompRoot (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_R,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 2021, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2021, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetDFSChildFromBicompRoot", 0) < (0)) __PYX_ERR(0, 2021, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetDFSChildFromBicompRoot", 1, 1, 1, i); __PYX_ERR(0, 2021, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2021, __pyx_L3_error) } __pyx_v_R = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_R == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2021, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetDFSChildFromBicompRoot", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2021, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetDFSChildFromBicompRoot", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_218gp_GetDFSChildFromBicompRoot(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_R); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_218gp_GetDFSChildFromBicompRoot(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_R) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7[3]; PyObject *__pyx_t_8 = NULL; int __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetDFSChildFromBicompRoot", 0); /* "planarity/full/graph.pyx":2034 * ValueError if R is not a virtual vertex * """ * if not self.gp_IsVirtualVertex(R): # <<<<<<<<<<<<<< * raise ValueError( * "gp_GetDFSChildFromBicompRoot() failed: invalid virtual vertex " */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_R); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2034, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2034, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2034, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":2035 * """ * if not self.gp_IsVirtualVertex(R): * raise ValueError( # <<<<<<<<<<<<<< * "gp_GetDFSChildFromBicompRoot() failed: invalid virtual vertex " * f"R = {R} for bicomp root." */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":2037 * raise ValueError( * "gp_GetDFSChildFromBicompRoot() failed: invalid virtual vertex " * f"R = {R} for bicomp root." # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_R, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2037, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_gp_GetDFSChildFromBicompRoot_fai; __pyx_t_7[1] = __pyx_t_2; __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u_for_bicomp_root; /* "planarity/full/graph.pyx":2036 * if not self.gp_IsVirtualVertex(R): * raise ValueError( * "gp_GetDFSChildFromBicompRoot() failed: invalid virtual vertex " # <<<<<<<<<<<<<< * f"R = {R} for bicomp root." * ) */ __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 66 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 17, 127); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2036, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_8}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2035, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 2035, __pyx_L1_error) /* "planarity/full/graph.pyx":2034 * ValueError if R is not a virtual vertex * """ * if not self.gp_IsVirtualVertex(R): # <<<<<<<<<<<<<< * raise ValueError( * "gp_GetDFSChildFromBicompRoot() failed: invalid virtual vertex " */ } /* "planarity/full/graph.pyx":2040 * ) * * return graphLib.gp_GetDFSChildFromBicompRoot(self._theGraph, R) # <<<<<<<<<<<<<< * * def gp_GetVertexFromBicompRoot(self, int R) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_9 = __pyx_f_9planarity_4full_8graphLib_gp_GetDFSChildFromBicompRoot(__pyx_v_self->_theGraph, __pyx_v_R); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2040, __pyx_L1_error) __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2040, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 2040, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":2021 * return graphLib.gp_GetBicompRootFromDFSChild(self._theGraph, c) * * def gp_GetDFSChildFromBicompRoot(self, int R) -> int: # <<<<<<<<<<<<<< * """Given a biconnected component root R (a virtual vertex), this method * returns the DFS child c of a vertex v that R represents. */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetDFSChildFromBicompRoot", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2042 * return graphLib.gp_GetDFSChildFromBicompRoot(self._theGraph, R) * * def gp_GetVertexFromBicompRoot(self, int R) -> int: # <<<<<<<<<<<<<< * """Given a biconnected component root R (a virtual vertex), this method * returns the vertex v that R represents. */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_221gp_GetVertexFromBicompRoot(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_220gp_GetVertexFromBicompRoot, "Graph.gp_GetVertexFromBicompRoot(self, int R) -> int\n\nGiven a biconnected component root R (a virtual vertex), this method\nreturns the vertex v that R represents.\n\nArgs:\n R: virtual vertex representing the root of a child bicomp of v\n\nReturns:\n The vertex v corresponding to the root R of a child bicomp\n\nRaises:\n ValueError if R is not a valid virtual vertex"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_221gp_GetVertexFromBicompRoot = {"gp_GetVertexFromBicompRoot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_221gp_GetVertexFromBicompRoot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_220gp_GetVertexFromBicompRoot}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_221gp_GetVertexFromBicompRoot(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_R; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetVertexFromBicompRoot (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_R,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 2042, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2042, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_GetVertexFromBicompRoot", 0) < (0)) __PYX_ERR(0, 2042, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_GetVertexFromBicompRoot", 1, 1, 1, i); __PYX_ERR(0, 2042, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2042, __pyx_L3_error) } __pyx_v_R = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_R == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2042, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_GetVertexFromBicompRoot", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2042, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetVertexFromBicompRoot", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_220gp_GetVertexFromBicompRoot(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_R); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_220gp_GetVertexFromBicompRoot(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_R) { PyObject *__pyx_v_c = NULL; PyObject *__pyx_v_bicomp_root = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7[3]; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9[4]; PyObject *__pyx_t_10 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetVertexFromBicompRoot", 0); /* "planarity/full/graph.pyx":2055 * ValueError if R is not a valid virtual vertex * """ * if not self.gp_IsVirtualVertex(R): # <<<<<<<<<<<<<< * raise ValueError( * "gp_GetVertexFromBicompRoot() failed: invalid virtual vertex " */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_R); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2055, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2055, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2055, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":2056 * """ * if not self.gp_IsVirtualVertex(R): * raise ValueError( # <<<<<<<<<<<<<< * "gp_GetVertexFromBicompRoot() failed: invalid virtual vertex " * f"R = {R} for bicomp root." */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":2058 * raise ValueError( * "gp_GetVertexFromBicompRoot() failed: invalid virtual vertex " * f"R = {R} for bicomp root." # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_R, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2058, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_gp_GetVertexFromBicompRoot_faile; __pyx_t_7[1] = __pyx_t_2; __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u_for_bicomp_root; /* "planarity/full/graph.pyx":2057 * if not self.gp_IsVirtualVertex(R): * raise ValueError( * "gp_GetVertexFromBicompRoot() failed: invalid virtual vertex " # <<<<<<<<<<<<<< * f"R = {R} for bicomp root." * ) */ __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 64 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2) + 17, 127); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2057, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_8}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2056, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 2056, __pyx_L1_error) /* "planarity/full/graph.pyx":2055 * ValueError if R is not a valid virtual vertex * """ * if not self.gp_IsVirtualVertex(R): # <<<<<<<<<<<<<< * raise ValueError( * "gp_GetVertexFromBicompRoot() failed: invalid virtual vertex " */ } /* "planarity/full/graph.pyx":2066 * # return graphLib.gp_GetVertexFromBicompRoot(self._theGraph, R) * * c = self.gp_GetDFSChildFromBicompRoot(R) # <<<<<<<<<<<<<< * if not self.gp_IsVertex(c): * raise RuntimeError( */ __pyx_t_8 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_8); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_R); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2066, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_GetDFSChildFromBicompRoot, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2066, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_c = __pyx_t_1; __pyx_t_1 = 0; /* "planarity/full/graph.pyx":2067 * * c = self.gp_GetDFSChildFromBicompRoot(R) * if not self.gp_IsVertex(c): # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_GetVertexFromBicompRoot() failed: invalid DFS child c = " */ __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_c}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2067, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 2067, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (!__pyx_t_6); if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":2068 * c = self.gp_GetDFSChildFromBicompRoot(R) * if not self.gp_IsVertex(c): * raise RuntimeError( # <<<<<<<<<<<<<< * "gp_GetVertexFromBicompRoot() failed: invalid DFS child c = " * f"{c} for bicomp root R = {R}" */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":2070 * raise RuntimeError( * "gp_GetVertexFromBicompRoot() failed: invalid DFS child c = " * f"{c} for bicomp root R = {R}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_v_c, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2070, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_R, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2070, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_9[0] = __pyx_mstate_global->__pyx_kp_u_gp_GetVertexFromBicompRoot_faile_2; __pyx_t_9[1] = __pyx_t_8; __pyx_t_9[2] = __pyx_mstate_global->__pyx_kp_u_for_bicomp_root_R; __pyx_t_9[3] = __pyx_t_2; /* "planarity/full/graph.pyx":2069 * if not self.gp_IsVertex(c): * raise RuntimeError( * "gp_GetVertexFromBicompRoot() failed: invalid DFS child c = " # <<<<<<<<<<<<<< * f"{c} for bicomp root R = {R}" * ) */ __pyx_t_10 = __Pyx_PyUnicode_Join(__pyx_t_9, 4, 59 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8) + 21 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_2), 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2069, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_10}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2068, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 2068, __pyx_L1_error) /* "planarity/full/graph.pyx":2067 * * c = self.gp_GetDFSChildFromBicompRoot(R) * if not self.gp_IsVertex(c): # <<<<<<<<<<<<<< * raise RuntimeError( * "gp_GetVertexFromBicompRoot() failed: invalid DFS child c = " */ } /* "planarity/full/graph.pyx":2073 * ) * * bicomp_root = self.gp_GetParent(c) # <<<<<<<<<<<<<< * if bicomp_root == NIL: * raise RuntimeError( */ __pyx_t_10 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_10); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_c}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_GetParent, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2073, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_v_bicomp_root = __pyx_t_1; __pyx_t_1 = 0; /* "planarity/full/graph.pyx":2074 * * bicomp_root = self.gp_GetParent(c) * if bicomp_root == NIL: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_GetVertexFromBicompRoot() failed: c = {c} should not be " */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_NIL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2074, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_10 = PyObject_RichCompare(__pyx_v_bicomp_root, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2074, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2074, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":2075 * bicomp_root = self.gp_GetParent(c) * if bicomp_root == NIL: * raise RuntimeError( # <<<<<<<<<<<<<< * f"gp_GetVertexFromBicompRoot() failed: c = {c} should not be " * "the root of the DFS tree." */ __pyx_t_1 = NULL; /* "planarity/full/graph.pyx":2076 * if bicomp_root == NIL: * raise RuntimeError( * f"gp_GetVertexFromBicompRoot() failed: c = {c} should not be " # <<<<<<<<<<<<<< * "the root of the DFS tree." * ) */ __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_v_c, __pyx_mstate_global->__pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2076, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_gp_GetVertexFromBicompRoot_faile_3; __pyx_t_7[1] = __pyx_t_3; __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u_should_not_be_the_root_of_the_D; __pyx_t_2 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 41 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3) + 40, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2076, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_2}; __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2075, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); } __Pyx_Raise(__pyx_t_10, 0, 0, 0); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __PYX_ERR(0, 2075, __pyx_L1_error) /* "planarity/full/graph.pyx":2074 * * bicomp_root = self.gp_GetParent(c) * if bicomp_root == NIL: # <<<<<<<<<<<<<< * raise RuntimeError( * f"gp_GetVertexFromBicompRoot() failed: c = {c} should not be " */ } /* "planarity/full/graph.pyx":2080 * ) * * return bicomp_root # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_10 = __pyx_v_bicomp_root; __Pyx_INCREF(__pyx_t_10); if (__Pyx_PyInt_FromNumber(&__pyx_t_10, NULL, 1) < (0)) __PYX_ERR(0, 2080, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":2042 * return graphLib.gp_GetDFSChildFromBicompRoot(self._theGraph, R) * * def gp_GetVertexFromBicompRoot(self, int R) -> int: # <<<<<<<<<<<<<< * """Given a biconnected component root R (a virtual vertex), this method * returns the vertex v that R represents. */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_GetVertexFromBicompRoot", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_c); __Pyx_XDECREF(__pyx_v_bicomp_root); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2083 * * * def gp_IsBicompRoot(self, int v) -> int: # <<<<<<<<<<<<<< * """Determines whether a given non-virtual or virtual vertex is a * biconnected component root. This method essentially just returns */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_223gp_IsBicompRoot(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_222gp_IsBicompRoot, "Graph.gp_IsBicompRoot(self, int v) -> int\n\nDetermines whether a given non-virtual or virtual vertex is a \nbiconnected component root. This method essentially just returns\nwhether v is a virtual vertex; it may not be in use in a separate\nbiconnected component. To test if a bicomp root is in use, please\nsee gp_VirtualVertexInUse().\n\nArgs:\n v: a vertex in the graph which you wish to determine is the root\n of a bicomp\n\nReturns:\n TRUE if v is a bicomp root, FALSE otherwise\n\nRaises:\n ValueError if v is not a valid non-virtual nor virtual vertex"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_223gp_IsBicompRoot = {"gp_IsBicompRoot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_223gp_IsBicompRoot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_222gp_IsBicompRoot}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_223gp_IsBicompRoot(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_IsBicompRoot (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 2083, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2083, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_IsBicompRoot", 0) < (0)) __PYX_ERR(0, 2083, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_IsBicompRoot", 1, 1, 1, i); __PYX_ERR(0, 2083, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2083, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2083, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_IsBicompRoot", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2083, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsBicompRoot", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_222gp_IsBicompRoot(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_222gp_IsBicompRoot(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_IsBicompRoot", 0); /* "planarity/full/graph.pyx":2100 * ValueError if v is not a valid non-virtual nor virtual vertex * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * "gp_IsBicompRoot() failed: invalid candidate bicomp root v = " */ __pyx_t_3 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 2100, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_v); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_2 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 2100, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_1 = __pyx_t_6; __pyx_L4_bool_binop_done:; __pyx_t_6 = (!__pyx_t_1); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":2101 * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( # <<<<<<<<<<<<<< * "gp_IsBicompRoot() failed: invalid candidate bicomp root v = " * f"{v}" */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":2103 * raise ValueError( * "gp_IsBicompRoot() failed: invalid candidate bicomp root v = " * f"{v}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_v, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); /* "planarity/full/graph.pyx":2102 * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): * raise ValueError( * "gp_IsBicompRoot() failed: invalid candidate bicomp root v = " # <<<<<<<<<<<<<< * f"{v}" * ) */ __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_IsBicompRoot_failed_invalid_c, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_2 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 2101, __pyx_L1_error) /* "planarity/full/graph.pyx":2100 * ValueError if v is not a valid non-virtual nor virtual vertex * """ * if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): # <<<<<<<<<<<<<< * raise ValueError( * "gp_IsBicompRoot() failed: invalid candidate bicomp root v = " */ } /* "planarity/full/graph.pyx":2106 * ) * * if graphLib.gp_IsBicompRoot(self._theGraph, v): # <<<<<<<<<<<<<< * return TRUE * */ __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_IsBicompRoot(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2106, __pyx_L1_error) __pyx_t_6 = (__pyx_t_8 != 0); if (__pyx_t_6) { /* "planarity/full/graph.pyx":2107 * * if graphLib.gp_IsBicompRoot(self._theGraph, v): * return TRUE # <<<<<<<<<<<<<< * * return FALSE */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_TRUE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 2107, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":2106 * ) * * if graphLib.gp_IsBicompRoot(self._theGraph, v): # <<<<<<<<<<<<<< * return TRUE * */ } /* "planarity/full/graph.pyx":2109 * return TRUE * * return FALSE # <<<<<<<<<<<<<< * * def gp_IsSeparatedDFSChild(self, int theChild) -> int: */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FALSE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__Pyx_PyInt_FromNumber(&__pyx_t_2, NULL, 1) < (0)) __PYX_ERR(0, 2109, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":2083 * * * def gp_IsBicompRoot(self, int v) -> int: # <<<<<<<<<<<<<< * """Determines whether a given non-virtual or virtual vertex is a * biconnected component root. This method essentially just returns */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsBicompRoot", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2111 * return FALSE * * def gp_IsSeparatedDFSChild(self, int theChild) -> int: # <<<<<<<<<<<<<< * """Determines whether a given vertex (theChild) is in a * separate biconnected component from its DFS parent, v. */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_225gp_IsSeparatedDFSChild(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_224gp_IsSeparatedDFSChild, "Graph.gp_IsSeparatedDFSChild(self, int theChild) -> int\n\nDetermines whether a given vertex (theChild) is in a \nseparate biconnected component from its DFS parent, v.\n\nArgs:\n theChild: a vertex in the graph\n\nReturns:\n TRUE if theChild is in a separate bicomp from its DFS parent, v;\n FALSE otherwise\n\nRaises:\n ValueError if theChild is not a valid vertex"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_225gp_IsSeparatedDFSChild = {"gp_IsSeparatedDFSChild", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_225gp_IsSeparatedDFSChild, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_224gp_IsSeparatedDFSChild}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_225gp_IsSeparatedDFSChild(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_theChild; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_IsSeparatedDFSChild (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_theChild,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 2111, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2111, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_IsSeparatedDFSChild", 0) < (0)) __PYX_ERR(0, 2111, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_IsSeparatedDFSChild", 1, 1, 1, i); __PYX_ERR(0, 2111, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2111, __pyx_L3_error) } __pyx_v_theChild = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_theChild == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2111, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_IsSeparatedDFSChild", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2111, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsSeparatedDFSChild", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_224gp_IsSeparatedDFSChild(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_theChild); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_224gp_IsSeparatedDFSChild(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_theChild) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_IsSeparatedDFSChild", 0); /* "planarity/full/graph.pyx":2125 * ValueError if theChild is not a valid vertex * """ * if not self.gp_IsVertex(theChild): # <<<<<<<<<<<<<< * raise ValueError( * "gp_IsSeparatedDFSChild() failed: invalid vertex theChild = " */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_theChild); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2125, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":2126 * """ * if not self.gp_IsVertex(theChild): * raise ValueError( # <<<<<<<<<<<<<< * "gp_IsSeparatedDFSChild() failed: invalid vertex theChild = " * f"{theChild}" */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":2128 * raise ValueError( * "gp_IsSeparatedDFSChild() failed: invalid vertex theChild = " * f"{theChild}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_theChild, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); /* "planarity/full/graph.pyx":2127 * if not self.gp_IsVertex(theChild): * raise ValueError( * "gp_IsSeparatedDFSChild() failed: invalid vertex theChild = " # <<<<<<<<<<<<<< * f"{theChild}" * ) */ __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_IsSeparatedDFSChild_failed_in, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 2126, __pyx_L1_error) /* "planarity/full/graph.pyx":2125 * ValueError if theChild is not a valid vertex * """ * if not self.gp_IsVertex(theChild): # <<<<<<<<<<<<<< * raise ValueError( * "gp_IsSeparatedDFSChild() failed: invalid vertex theChild = " */ } /* "planarity/full/graph.pyx":2131 * ) * * if graphLib.gp_IsSeparatedDFSChild(self._theGraph, theChild): # <<<<<<<<<<<<<< * return TRUE * */ __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_IsSeparatedDFSChild(__pyx_v_self->_theGraph, __pyx_v_theChild); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2131, __pyx_L1_error) __pyx_t_6 = (__pyx_t_8 != 0); if (__pyx_t_6) { /* "planarity/full/graph.pyx":2132 * * if graphLib.gp_IsSeparatedDFSChild(self._theGraph, theChild): * return TRUE # <<<<<<<<<<<<<< * * return FALSE */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_TRUE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 1) < (0)) __PYX_ERR(0, 2132, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":2131 * ) * * if graphLib.gp_IsSeparatedDFSChild(self._theGraph, theChild): # <<<<<<<<<<<<<< * return TRUE * */ } /* "planarity/full/graph.pyx":2134 * return TRUE * * return FALSE # <<<<<<<<<<<<<< * * def gp_IsNotSeparatedDFSChild(self, int theChild) -> int: */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_FALSE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 1) < (0)) __PYX_ERR(0, 2134, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":2111 * return FALSE * * def gp_IsSeparatedDFSChild(self, int theChild) -> int: # <<<<<<<<<<<<<< * """Determines whether a given vertex (theChild) is in a * separate biconnected component from its DFS parent, v. */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsSeparatedDFSChild", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2136 * return FALSE * * def gp_IsNotSeparatedDFSChild(self, int theChild) -> int: # <<<<<<<<<<<<<< * """Determines whether a given vertex (theChild) is not in a * separate biconnected component from its DFS parent, v. */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_227gp_IsNotSeparatedDFSChild(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_226gp_IsNotSeparatedDFSChild, "Graph.gp_IsNotSeparatedDFSChild(self, int theChild) -> int\n\nDetermines whether a given vertex (theChild) is not in a \nseparate biconnected component from its DFS parent, v.\n\nArgs:\n theChild: a vertex in the graph.\n\nReturns:\n FALSE if theChild is in a separate bicomp from its DFS parent, v;\n TRUE otherwise\n\nRaises:\n ValueError if theChild is not a valid vertex"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_227gp_IsNotSeparatedDFSChild = {"gp_IsNotSeparatedDFSChild", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_227gp_IsNotSeparatedDFSChild, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_226gp_IsNotSeparatedDFSChild}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_227gp_IsNotSeparatedDFSChild(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_theChild; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_IsNotSeparatedDFSChild (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_theChild,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 2136, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2136, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_IsNotSeparatedDFSChild", 0) < (0)) __PYX_ERR(0, 2136, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_IsNotSeparatedDFSChild", 1, 1, 1, i); __PYX_ERR(0, 2136, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2136, __pyx_L3_error) } __pyx_v_theChild = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_theChild == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2136, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_IsNotSeparatedDFSChild", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2136, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsNotSeparatedDFSChild", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_226gp_IsNotSeparatedDFSChild(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_theChild); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_226gp_IsNotSeparatedDFSChild(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_theChild) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_IsNotSeparatedDFSChild", 0); /* "planarity/full/graph.pyx":2150 * ValueError if theChild is not a valid vertex * """ * if not self.gp_IsVertex(theChild): # <<<<<<<<<<<<<< * raise ValueError( * "gp_IsNotSeparatedDFSChild() failed: invalid vertex theChild = " */ __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_theChild); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; { PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3}; __pyx_t_1 = __Pyx_PyObject_FastCallMethod((PyObject*)__pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2150, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = (!__pyx_t_5); if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":2151 * """ * if not self.gp_IsVertex(theChild): * raise ValueError( # <<<<<<<<<<<<<< * "gp_IsNotSeparatedDFSChild() failed: invalid vertex theChild = " * f"{theChild}" */ __pyx_t_3 = NULL; /* "planarity/full/graph.pyx":2153 * raise ValueError( * "gp_IsNotSeparatedDFSChild() failed: invalid vertex theChild = " * f"{theChild}" # <<<<<<<<<<<<<< * ) * */ __pyx_t_2 = __Pyx_PyUnicode_From_int(__pyx_v_theChild, 0, ' ', 'd'); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); /* "planarity/full/graph.pyx":2152 * if not self.gp_IsVertex(theChild): * raise ValueError( * "gp_IsNotSeparatedDFSChild() failed: invalid vertex theChild = " # <<<<<<<<<<<<<< * f"{theChild}" * ) */ __pyx_t_7 = __Pyx_PyUnicode_Concat(__pyx_mstate_global->__pyx_kp_u_gp_IsNotSeparatedDFSChild_failed, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_1 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_ValueError)), __pyx_callargs+__pyx_t_4, (2-__pyx_t_4) | (__pyx_t_4*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 2151, __pyx_L1_error) /* "planarity/full/graph.pyx":2150 * ValueError if theChild is not a valid vertex * """ * if not self.gp_IsVertex(theChild): # <<<<<<<<<<<<<< * raise ValueError( * "gp_IsNotSeparatedDFSChild() failed: invalid vertex theChild = " */ } /* "planarity/full/graph.pyx":2156 * ) * * if graphLib.gp_IsNotSeparatedDFSChild(self._theGraph, theChild): # <<<<<<<<<<<<<< * return TRUE * */ __pyx_t_8 = __pyx_f_9planarity_4full_8graphLib_gp_IsNotSeparatedDFSChild(__pyx_v_self->_theGraph, __pyx_v_theChild); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2156, __pyx_L1_error) __pyx_t_6 = (__pyx_t_8 != 0); if (__pyx_t_6) { /* "planarity/full/graph.pyx":2157 * * if graphLib.gp_IsNotSeparatedDFSChild(self._theGraph, theChild): * return TRUE # <<<<<<<<<<<<<< * * return FALSE */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_TRUE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 1) < (0)) __PYX_ERR(0, 2157, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":2156 * ) * * if graphLib.gp_IsNotSeparatedDFSChild(self._theGraph, theChild): # <<<<<<<<<<<<<< * return TRUE * */ } /* "planarity/full/graph.pyx":2159 * return TRUE * * return FALSE # <<<<<<<<<<<<<< * * def gp_ExtendWith_Planarity(self) -> None: */ __Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_FALSE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 1) < (0)) __PYX_ERR(0, 2159, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":2136 * return FALSE * * def gp_IsNotSeparatedDFSChild(self, int theChild) -> int: # <<<<<<<<<<<<<< * """Determines whether a given vertex (theChild) is not in a * separate biconnected component from its DFS parent, v. */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_IsNotSeparatedDFSChild", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2161 * return FALSE * * def gp_ExtendWith_Planarity(self) -> None: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the Planarity extension, which * adds the data structures and methods necessary for planar graph embedding */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_229gp_ExtendWith_Planarity(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_228gp_ExtendWith_Planarity, "Graph.gp_ExtendWith_Planarity(self) -> None\n\nDynamically subclasses the graph with the Planarity extension, which\nadds the data structures and methods necessary for planar graph embedding \nminimal planarity-obstructing subgraph isolation.\n\nReturns:\n OK if graph successfully extended with the Planarity extension\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_229gp_ExtendWith_Planarity = {"gp_ExtendWith_Planarity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_229gp_ExtendWith_Planarity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_228gp_ExtendWith_Planarity}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_229gp_ExtendWith_Planarity(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ExtendWith_Planarity (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_ExtendWith_Planarity", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_ExtendWith_Planarity", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_228gp_ExtendWith_Planarity(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_228gp_ExtendWith_Planarity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_ExtendWith_Planarity", 0); /* "planarity/full/graph.pyx":2172 * RuntimeError if C graphlib version of this function failed. * """ * result = graphLib.gp_ExtendWith_Planarity(self._theGraph) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_Planarity(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2172, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":2173 * """ * result = graphLib.gp_ExtendWith_Planarity(self._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Failed to extend graph with Planarity structures." */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2173, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2173, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":2174 * result = graphLib.gp_ExtendWith_Planarity(self._theGraph) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "Failed to extend graph with Planarity structures." * ) */ __pyx_t_3 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_extend_graph_with_Plan}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 2174, __pyx_L1_error) /* "planarity/full/graph.pyx":2173 * """ * result = graphLib.gp_ExtendWith_Planarity(self._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Failed to extend graph with Planarity structures." */ } /* "planarity/full/graph.pyx":2161 * return FALSE * * def gp_ExtendWith_Planarity(self) -> None: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the Planarity extension, which * adds the data structures and methods necessary for planar graph embedding */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ExtendWith_Planarity", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2178 * ) * * def gp_Embed(self, int embedFlags) -> int: # <<<<<<<<<<<<<< * """Modifies the graph to be either an embedding of the original * graph or a minimal subgraph obstructing embedding. The type of */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_231gp_Embed(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_230gp_Embed, "Graph.gp_Embed(self, int embedFlags) -> int\n\nModifies the graph to be either an embedding of the original\ngraph or a minimal subgraph obstructing embedding. The type of\nembedding or obstruction depends on the setting of embedFlags.\nWith graphlib.EMBEDFLAGS_PLANAR, the graph is modified to either\ncontain a planar embedding (an adjacency list rotation scheme) \nof the graph or a subgraph homeomorphic to K_{3,3} or K_5. \n\nArgs:\n embedFlags: graphlib.EMBEDFLAGS_* value indicating the \n embedding algorithm to run.\n\nReturns:\n OK if an embedding was created (if a desired homeomorphic\n subgraph was not found).\n NONEMBEDDABE if a minimal obstructing subgraph (or the\n desired homeomorphic subgraph) was found.\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_231gp_Embed = {"gp_Embed", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_231gp_Embed, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_230gp_Embed}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_231gp_Embed(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_embedFlags; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_Embed (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_embedFlags,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 2178, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2178, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_Embed", 0) < (0)) __PYX_ERR(0, 2178, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_Embed", 1, 1, 1, i); __PYX_ERR(0, 2178, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2178, __pyx_L3_error) } __pyx_v_embedFlags = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_embedFlags == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2178, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_Embed", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2178, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_Embed", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_230gp_Embed(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_embedFlags); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_230gp_Embed(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_embedFlags) { int __pyx_v_embed_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; size_t __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_Embed", 0); /* "planarity/full/graph.pyx":2199 * RuntimeError if C graphlib version of this function failed. * """ * embed_result = graphLib.gp_Embed(self._theGraph, embedFlags) # <<<<<<<<<<<<<< * if embed_result != OK and embed_result != NONEMBEDDABLE: * raise RuntimeError("Failed to perform embed operation.") */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_Embed(__pyx_v_self->_theGraph, __pyx_v_embedFlags); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2199, __pyx_L1_error) __pyx_v_embed_result = __pyx_t_1; /* "planarity/full/graph.pyx":2200 * """ * embed_result = graphLib.gp_Embed(self._theGraph, embedFlags) * if embed_result != OK and embed_result != NONEMBEDDABLE: # <<<<<<<<<<<<<< * raise RuntimeError("Failed to perform embed operation.") * */ __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_embed_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2200, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 2200, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { } else { __pyx_t_2 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_embed_result); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_NONEMBEDDABLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2200, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 2200, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = __pyx_t_6; __pyx_L4_bool_binop_done:; if (unlikely(__pyx_t_2)) { /* "planarity/full/graph.pyx":2201 * embed_result = graphLib.gp_Embed(self._theGraph, embedFlags) * if embed_result != OK and embed_result != NONEMBEDDABLE: * raise RuntimeError("Failed to perform embed operation.") # <<<<<<<<<<<<<< * * return embed_result */ __pyx_t_4 = NULL; __pyx_t_7 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Failed_to_perform_embed_operatio}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 2201, __pyx_L1_error) /* "planarity/full/graph.pyx":2200 * """ * embed_result = graphLib.gp_Embed(self._theGraph, embedFlags) * if embed_result != OK and embed_result != NONEMBEDDABLE: # <<<<<<<<<<<<<< * raise RuntimeError("Failed to perform embed operation.") * */ } /* "planarity/full/graph.pyx":2203 * raise RuntimeError("Failed to perform embed operation.") * * return embed_result # <<<<<<<<<<<<<< * * def gp_TestEmbedResultIntegrity(self, Graph origGraph, int embedResult) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_embed_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__Pyx_PyInt_FromNumber(&__pyx_t_3, NULL, 0) < (0)) __PYX_ERR(0, 2203, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":2178 * ) * * def gp_Embed(self, int embedFlags) -> int: # <<<<<<<<<<<<<< * """Modifies the graph to be either an embedding of the original * graph or a minimal subgraph obstructing embedding. The type of */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_Embed", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2205 * return embed_result * * def gp_TestEmbedResultIntegrity(self, Graph origGraph, int embedResult) -> int: # <<<<<<<<<<<<<< * """Tests whether the graph has valid content based on the * embedding algorithm performed by gp_Embed(), a copy of the */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_233gp_TestEmbedResultIntegrity(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_232gp_TestEmbedResultIntegrity, "Graph.gp_TestEmbedResultIntegrity(self, Graph origGraph, int embedResult) -> int\n\nTests whether the graph has valid content based on the\nembedding algorithm performed by gp_Embed(), a copy of the \noriginal graph input to it, and the result it returned.\n\nArgs:\n origGraph: a copy of the graph before gp_Embed()\n embedResult: the result returned by gp_Embed()\n\nReturns:\n OK or NONEMBEDDABLE on success (matching embedResult) \n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_233gp_TestEmbedResultIntegrity = {"gp_TestEmbedResultIntegrity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_233gp_TestEmbedResultIntegrity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_232gp_TestEmbedResultIntegrity}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_233gp_TestEmbedResultIntegrity(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_origGraph = 0; int __pyx_v_embedResult; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_TestEmbedResultIntegrity (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_origGraph,&__pyx_mstate_global->__pyx_n_u_embedResult,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 2205, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 2: values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2205, __pyx_L3_error) CYTHON_FALLTHROUGH; case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2205, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_TestEmbedResultIntegrity", 0) < (0)) __PYX_ERR(0, 2205, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 2; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_TestEmbedResultIntegrity", 1, 2, 2, i); __PYX_ERR(0, 2205, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2205, __pyx_L3_error) values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 2205, __pyx_L3_error) } __pyx_v_origGraph = ((struct __pyx_obj_9planarity_4full_5graph_Graph *)values[0]); __pyx_v_embedResult = __Pyx_PyLong_As_int(values[1]); if (unlikely((__pyx_v_embedResult == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2205, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_TestEmbedResultIntegrity", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 2205, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_TestEmbedResultIntegrity", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_origGraph), __pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, 1, "origGraph", 0))) __PYX_ERR(0, 2205, __pyx_L1_error) __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_232gp_TestEmbedResultIntegrity(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_origGraph, __pyx_v_embedResult); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } goto __pyx_L7_cleaned_up; __pyx_L0:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __pyx_L7_cleaned_up:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_232gp_TestEmbedResultIntegrity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_origGraph, int __pyx_v_embedResult) { int __pyx_v_check_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; size_t __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_TestEmbedResultIntegrity", 0); /* "planarity/full/graph.pyx":2220 * RuntimeError if C graphlib version of this function failed. * """ * check_result = graphLib.gp_TestEmbedResultIntegrity( # <<<<<<<<<<<<<< * self._theGraph, origGraph._theGraph, embedResult * ) */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_TestEmbedResultIntegrity(__pyx_v_self->_theGraph, __pyx_v_origGraph->_theGraph, __pyx_v_embedResult); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2220, __pyx_L1_error) __pyx_v_check_result = __pyx_t_1; /* "planarity/full/graph.pyx":2223 * self._theGraph, origGraph._theGraph, embedResult * ) * if check_result != OK and check_result != NONEMBEDDABLE: # <<<<<<<<<<<<<< * raise RuntimeError("Failed embed result integrity check.") * */ __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_check_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2223, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 2223, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { } else { __pyx_t_2 = __pyx_t_6; goto __pyx_L4_bool_binop_done; } __pyx_t_5 = __Pyx_PyLong_From_int(__pyx_v_check_result); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_NONEMBEDDABLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2223, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 2223, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = __pyx_t_6; __pyx_L4_bool_binop_done:; if (unlikely(__pyx_t_2)) { /* "planarity/full/graph.pyx":2224 * ) * if check_result != OK and check_result != NONEMBEDDABLE: * raise RuntimeError("Failed embed result integrity check.") # <<<<<<<<<<<<<< * * return check_result */ __pyx_t_4 = NULL; __pyx_t_7 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Failed_embed_result_integrity_ch}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 2224, __pyx_L1_error) /* "planarity/full/graph.pyx":2223 * self._theGraph, origGraph._theGraph, embedResult * ) * if check_result != OK and check_result != NONEMBEDDABLE: # <<<<<<<<<<<<<< * raise RuntimeError("Failed embed result integrity check.") * */ } /* "planarity/full/graph.pyx":2226 * raise RuntimeError("Failed embed result integrity check.") * * return check_result # <<<<<<<<<<<<<< * * def gp_ExtendWith_Outerplanarity(self) -> None: */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_check_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__Pyx_PyInt_FromNumber(&__pyx_t_3, NULL, 0) < (0)) __PYX_ERR(0, 2226, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":2205 * return embed_result * * def gp_TestEmbedResultIntegrity(self, Graph origGraph, int embedResult) -> int: # <<<<<<<<<<<<<< * """Tests whether the graph has valid content based on the * embedding algorithm performed by gp_Embed(), a copy of the */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_TestEmbedResultIntegrity", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2228 * return check_result * * def gp_ExtendWith_Outerplanarity(self) -> None: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the Outerplanarity extension, * which adds the data structures and methods necessary for outerplanar */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_235gp_ExtendWith_Outerplanarity(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_234gp_ExtendWith_Outerplanarity, "Graph.gp_ExtendWith_Outerplanarity(self) -> None\n\nDynamically subclasses the graph with the Outerplanarity extension, \nwhich adds the data structures and methods necessary for outerplanar \ngraph embedding minimal outerplanarity-obstructing subgraph isolation.\n\nReturns:\n OK if graph successfully extended with Outerplanarity extension\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_235gp_ExtendWith_Outerplanarity = {"gp_ExtendWith_Outerplanarity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_235gp_ExtendWith_Outerplanarity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_234gp_ExtendWith_Outerplanarity}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_235gp_ExtendWith_Outerplanarity(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ExtendWith_Outerplanarity (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_ExtendWith_Outerplanarity", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_ExtendWith_Outerplanarity", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_234gp_ExtendWith_Outerplanarity(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_234gp_ExtendWith_Outerplanarity(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_ExtendWith_Outerplanarity", 0); /* "planarity/full/graph.pyx":2239 * RuntimeError if C graphlib version of this function failed. * """ * result = graphLib.gp_ExtendWith_Outerplanarity(self._theGraph) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_Outerplanarity(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2239, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":2240 * """ * result = graphLib.gp_ExtendWith_Outerplanarity(self._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Failed to extend graph with Outerplanarity structures." */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2240, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2240, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":2241 * result = graphLib.gp_ExtendWith_Outerplanarity(self._theGraph) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "Failed to extend graph with Outerplanarity structures." * ) */ __pyx_t_3 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_extend_graph_with_Oute}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 2241, __pyx_L1_error) /* "planarity/full/graph.pyx":2240 * """ * result = graphLib.gp_ExtendWith_Outerplanarity(self._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Failed to extend graph with Outerplanarity structures." */ } /* "planarity/full/graph.pyx":2228 * return check_result * * def gp_ExtendWith_Outerplanarity(self) -> None: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the Outerplanarity extension, * which adds the data structures and methods necessary for outerplanar */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ExtendWith_Outerplanarity", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2245 * ) * * def gp_ExtendWith_DrawPlanar(self) -> int: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the DrawPlanar extension, which * adds the data structures and methods necessary for embedding and then */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_237gp_ExtendWith_DrawPlanar(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_236gp_ExtendWith_DrawPlanar, "Graph.gp_ExtendWith_DrawPlanar(self) -> int\n\nDynamically subclasses the graph with the DrawPlanar extension, which\nadds the data structures and methods necessary for embedding and then\ndrawing an ASCII rendition of a planar graph and for generating a \nvisibility representation of the planar graph embedding..\n\nReturns:\n OK if graph successfully extended with DrawPlanar extension\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_237gp_ExtendWith_DrawPlanar = {"gp_ExtendWith_DrawPlanar", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_237gp_ExtendWith_DrawPlanar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_236gp_ExtendWith_DrawPlanar}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_237gp_ExtendWith_DrawPlanar(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ExtendWith_DrawPlanar (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_ExtendWith_DrawPlanar", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_ExtendWith_DrawPlanar", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_236gp_ExtendWith_DrawPlanar(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_236gp_ExtendWith_DrawPlanar(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_ExtendWith_DrawPlanar", 0); /* "planarity/full/graph.pyx":2257 * RuntimeError if C graphlib version of this function failed. * """ * result = graphLib.gp_ExtendWith_DrawPlanar(self._theGraph) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_DrawPlanar(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2257, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":2258 * """ * result = graphLib.gp_ExtendWith_DrawPlanar(self._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Failed to extend graph with DrawPlanar structures." */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2258, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2258, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":2259 * result = graphLib.gp_ExtendWith_DrawPlanar(self._theGraph) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "Failed to extend graph with DrawPlanar structures." * ) */ __pyx_t_3 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_extend_graph_with_Draw}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 2259, __pyx_L1_error) /* "planarity/full/graph.pyx":2258 * """ * result = graphLib.gp_ExtendWith_DrawPlanar(self._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Failed to extend graph with DrawPlanar structures." */ } /* "planarity/full/graph.pyx":2263 * ) * * return result # <<<<<<<<<<<<<< * * def gp_DrawPlanar_RenderToFile(self, str theFileName) -> None: */ __Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_PyInt_FromNumber(&__pyx_t_4, NULL, 0) < (0)) __PYX_ERR(0, 2263, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":2245 * ) * * def gp_ExtendWith_DrawPlanar(self) -> int: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the DrawPlanar extension, which * adds the data structures and methods necessary for embedding and then */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ExtendWith_DrawPlanar", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2265 * return result * * def gp_DrawPlanar_RenderToFile(self, str theFileName) -> None: # <<<<<<<<<<<<<< * """Draws into a file an ASCII rendition of a planar graph * embedding created by gp_Embed(). */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_239gp_DrawPlanar_RenderToFile(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_238gp_DrawPlanar_RenderToFile, "Graph.gp_DrawPlanar_RenderToFile(self, str theFileName) -> None\n\nDraws into a file an ASCII rendition of a planar graph \nembedding created by gp_Embed().\n\nArgs:\n theFileName: the name of the file in which to place the \n ASCII rendition of the planar graph embedding\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_239gp_DrawPlanar_RenderToFile = {"gp_DrawPlanar_RenderToFile", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_239gp_DrawPlanar_RenderToFile, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_238gp_DrawPlanar_RenderToFile}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_239gp_DrawPlanar_RenderToFile(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { PyObject *__pyx_v_theFileName = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_DrawPlanar_RenderToFile (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_theFileName,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 2265, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2265, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_DrawPlanar_RenderToFile", 0) < (0)) __PYX_ERR(0, 2265, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_DrawPlanar_RenderToFile", 1, 1, 1, i); __PYX_ERR(0, 2265, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2265, __pyx_L3_error) } __pyx_v_theFileName = ((PyObject*)values[0]); } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_DrawPlanar_RenderToFile", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2265, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DrawPlanar_RenderToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_theFileName), (&PyUnicode_Type), 1, "theFileName", 1))) __PYX_ERR(0, 2265, __pyx_L1_error) __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_238gp_DrawPlanar_RenderToFile(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_theFileName); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } goto __pyx_L7_cleaned_up; __pyx_L0:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __pyx_L7_cleaned_up:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_238gp_DrawPlanar_RenderToFile(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, PyObject *__pyx_v_theFileName) { PyObject *__pyx_v_encoded = 0; char const *__pyx_v_encodedFileName; int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; char const *__pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; PyObject *__pyx_t_7[3]; PyObject *__pyx_t_8 = NULL; size_t __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_DrawPlanar_RenderToFile", 0); /* "planarity/full/graph.pyx":2277 * """ * # Convert Python str to UTF-8 encoded bytes, and then to const char * * cdef bytes encoded = theFileName.encode('utf-8') # <<<<<<<<<<<<<< * cdef const char *encodedFileName = encoded * */ if (unlikely(__pyx_v_theFileName == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 2277, __pyx_L1_error) } __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_theFileName); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2277, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_encoded = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "planarity/full/graph.pyx":2278 * # Convert Python str to UTF-8 encoded bytes, and then to const char * * cdef bytes encoded = theFileName.encode('utf-8') * cdef const char *encodedFileName = encoded # <<<<<<<<<<<<<< * * result = graphLib.gp_DrawPlanar_RenderToFile(self._theGraph, encodedFileName) */ __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_encoded); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 2278, __pyx_L1_error) __pyx_v_encodedFileName = __pyx_t_2; /* "planarity/full/graph.pyx":2280 * cdef const char *encodedFileName = encoded * * result = graphLib.gp_DrawPlanar_RenderToFile(self._theGraph, encodedFileName) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_3 = __pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_RenderToFile(__pyx_v_self->_theGraph, __pyx_v_encodedFileName); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2280, __pyx_L1_error) __pyx_v_result = __pyx_t_3; /* "planarity/full/graph.pyx":2281 * * result = graphLib.gp_DrawPlanar_RenderToFile(self._theGraph, encodedFileName) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"Failed to render embedding to file '{theFileName}'." */ __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2281, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2281, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2281, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 2281, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(__pyx_t_6)) { /* "planarity/full/graph.pyx":2282 * result = graphLib.gp_DrawPlanar_RenderToFile(self._theGraph, encodedFileName) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * f"Failed to render embedding to file '{theFileName}'." * ) */ __pyx_t_4 = NULL; /* "planarity/full/graph.pyx":2283 * if result != OK: * raise RuntimeError( * f"Failed to render embedding to file '{theFileName}'." # <<<<<<<<<<<<<< * ) * */ __pyx_t_1 = __Pyx_PyUnicode_Unicode(__pyx_v_theFileName); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2283, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7[0] = __pyx_mstate_global->__pyx_kp_u_Failed_to_render_embedding_to_fi; __pyx_t_7[1] = __pyx_t_1; __pyx_t_7[2] = __pyx_mstate_global->__pyx_kp_u__2; __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, 36 + __Pyx_PyUnicode_GET_LENGTH(__pyx_t_1) + 2, 127 | __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_1)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2283, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_9 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_8}; __pyx_t_5 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 2282, __pyx_L1_error) /* "planarity/full/graph.pyx":2281 * * result = graphLib.gp_DrawPlanar_RenderToFile(self._theGraph, encodedFileName) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * f"Failed to render embedding to file '{theFileName}'." */ } /* "planarity/full/graph.pyx":2265 * return result * * def gp_DrawPlanar_RenderToFile(self, str theFileName) -> None: # <<<<<<<<<<<<<< * """Draws into a file an ASCII rendition of a planar graph * embedding created by gp_Embed(). */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DrawPlanar_RenderToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_encoded); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2286 * ) * * def gp_DrawPlanar_RenderToString(self) -> str: # <<<<<<<<<<<<<< * """Draws into a string an ASCII rendition of a planar graph * embedding created by gp_Embed(). */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_241gp_DrawPlanar_RenderToString(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_240gp_DrawPlanar_RenderToString, "Graph.gp_DrawPlanar_RenderToString(self) -> str\n\nDraws into a string an ASCII rendition of a planar graph \nembedding created by gp_Embed().\n\nReturns:\n The string containing the ASCII rendition\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_241gp_DrawPlanar_RenderToString = {"gp_DrawPlanar_RenderToString", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_241gp_DrawPlanar_RenderToString, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_240gp_DrawPlanar_RenderToString}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_241gp_DrawPlanar_RenderToString(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_DrawPlanar_RenderToString (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_DrawPlanar_RenderToString", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_DrawPlanar_RenderToString", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_240gp_DrawPlanar_RenderToString(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_240gp_DrawPlanar_RenderToString(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { char *__pyx_v_renditionString; int __pyx_v_result; PyObject *__pyx_v_rendition_bytes = NULL; PyObject *__pyx_v_string_conversion_error = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; int __pyx_t_12; char const *__pyx_t_13; PyObject *__pyx_t_14 = NULL; PyObject *__pyx_t_15 = NULL; PyObject *__pyx_t_16 = NULL; PyObject *__pyx_t_17 = NULL; PyObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_DrawPlanar_RenderToString", 0); /* "planarity/full/graph.pyx":2296 * RuntimeError if C graphlib version of this function failed. * """ * cdef char* renditionString = NULL # <<<<<<<<<<<<<< * * result = graphLib.gp_DrawPlanar_RenderToString(self._theGraph, &renditionString) */ __pyx_v_renditionString = NULL; /* "planarity/full/graph.pyx":2298 * cdef char* renditionString = NULL * * result = graphLib.gp_DrawPlanar_RenderToString(self._theGraph, &renditionString) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError(f"Failed to render embedding to C string.") */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_RenderToString(__pyx_v_self->_theGraph, (&__pyx_v_renditionString)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2298, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":2299 * * result = graphLib.gp_DrawPlanar_RenderToString(self._theGraph, &renditionString) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError(f"Failed to render embedding to C string.") * */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2299, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2299, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":2300 * result = graphLib.gp_DrawPlanar_RenderToString(self._theGraph, &renditionString) * if result != OK: * raise RuntimeError(f"Failed to render embedding to C string.") # <<<<<<<<<<<<<< * * rendition_bytes = renditionString[:] */ __pyx_t_3 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_render_embedding_to_C}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 2300, __pyx_L1_error) /* "planarity/full/graph.pyx":2299 * * result = graphLib.gp_DrawPlanar_RenderToString(self._theGraph, &renditionString) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError(f"Failed to render embedding to C string.") * */ } /* "planarity/full/graph.pyx":2302 * raise RuntimeError(f"Failed to render embedding to C string.") * * rendition_bytes = renditionString[:] # <<<<<<<<<<<<<< * free(renditionString) * try: */ __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_renditionString + 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_v_rendition_bytes = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":2303 * * rendition_bytes = renditionString[:] * free(renditionString) # <<<<<<<<<<<<<< * try: * return rendition_bytes.decode('ascii') */ free(__pyx_v_renditionString); /* "planarity/full/graph.pyx":2304 * rendition_bytes = renditionString[:] * free(renditionString) * try: # <<<<<<<<<<<<<< * return rendition_bytes.decode('ascii') * except Exception as string_conversion_error: */ { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); __Pyx_XGOTREF(__pyx_t_7); __Pyx_XGOTREF(__pyx_t_8); __Pyx_XGOTREF(__pyx_t_9); /*try:*/ { /* "planarity/full/graph.pyx":2305 * free(renditionString) * try: * return rendition_bytes.decode('ascii') # <<<<<<<<<<<<<< * except Exception as string_conversion_error: * raise RuntimeError( */ __Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_decode_bytes(__pyx_v_rendition_bytes, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2305, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L8_try_return; /* "planarity/full/graph.pyx":2304 * rendition_bytes = renditionString[:] * free(renditionString) * try: # <<<<<<<<<<<<<< * return rendition_bytes.decode('ascii') * except Exception as string_conversion_error: */ } __pyx_L4_error:; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":2306 * try: * return rendition_bytes.decode('ascii') * except Exception as string_conversion_error: # <<<<<<<<<<<<<< * raise RuntimeError( * "Failed to convert C string to Python string." */ __pyx_t_1 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_Exception)))); if (__pyx_t_1) { __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DrawPlanar_RenderToString", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0) __PYX_ERR(0, 2306, __pyx_L6_except_error) __Pyx_XGOTREF(__pyx_t_4); __Pyx_XGOTREF(__pyx_t_3); __Pyx_XGOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_v_string_conversion_error = __pyx_t_3; /*try:*/ { /* "planarity/full/graph.pyx":2307 * return rendition_bytes.decode('ascii') * except Exception as string_conversion_error: * raise RuntimeError( # <<<<<<<<<<<<<< * "Failed to convert C string to Python string." * ) from string_conversion_error */ __pyx_t_11 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_kp_u_Failed_to_convert_C_string_to_Py}; __pyx_t_10 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2307, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_10); } /* "planarity/full/graph.pyx":2309 * raise RuntimeError( * "Failed to convert C string to Python string." * ) from string_conversion_error # <<<<<<<<<<<<<< * * def gp_DrawPlanar_GetVertexPosition(self, int v) -> int: */ __Pyx_Raise(__pyx_t_10, 0, 0, __pyx_v_string_conversion_error); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __PYX_ERR(0, 2307, __pyx_L15_error) } /* "planarity/full/graph.pyx":2306 * try: * return rendition_bytes.decode('ascii') * except Exception as string_conversion_error: # <<<<<<<<<<<<<< * raise RuntimeError( * "Failed to convert C string to Python string." */ /*finally:*/ { __pyx_L15_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19); if ( unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); __Pyx_XGOTREF(__pyx_t_19); __pyx_t_1 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_13 = __pyx_filename; { __Pyx_DECREF(__pyx_v_string_conversion_error); __pyx_v_string_conversion_error = 0; } __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_XGIVEREF(__pyx_t_19); __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_ErrRestore(__pyx_t_14, __pyx_t_15, __pyx_t_16); __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_lineno = __pyx_t_1; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_13; goto __pyx_L6_except_error; } } } goto __pyx_L6_except_error; /* "planarity/full/graph.pyx":2304 * rendition_bytes = renditionString[:] * free(renditionString) * try: # <<<<<<<<<<<<<< * return rendition_bytes.decode('ascii') * except Exception as string_conversion_error: */ __pyx_L6_except_error:; __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); goto __pyx_L1_error; __pyx_L8_try_return:; __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); goto __pyx_L0; } /* "planarity/full/graph.pyx":2286 * ) * * def gp_DrawPlanar_RenderToString(self) -> str: # <<<<<<<<<<<<<< * """Draws into a string an ASCII rendition of a planar graph * embedding created by gp_Embed(). */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DrawPlanar_RenderToString", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_rendition_bytes); __Pyx_XDECREF(__pyx_v_string_conversion_error); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2311 * ) from string_conversion_error * * def gp_DrawPlanar_GetVertexPosition(self, int v) -> int: # <<<<<<<<<<<<<< * """Get the vertical position of a vertex v. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_243gp_DrawPlanar_GetVertexPosition(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_242gp_DrawPlanar_GetVertexPosition, "Graph.gp_DrawPlanar_GetVertexPosition(self, int v) -> int\n\nGet the vertical position of a vertex v.\n\nArgs:\n v: a vertex for which you wish to get the vertical position\n\nReturns:\n The vertical position value for v\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_243gp_DrawPlanar_GetVertexPosition = {"gp_DrawPlanar_GetVertexPosition", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_243gp_DrawPlanar_GetVertexPosition, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_242gp_DrawPlanar_GetVertexPosition}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_243gp_DrawPlanar_GetVertexPosition(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_DrawPlanar_GetVertexPosition (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 2311, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2311, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_DrawPlanar_GetVertexPosition", 0) < (0)) __PYX_ERR(0, 2311, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_DrawPlanar_GetVertexPosition", 1, 1, 1, i); __PYX_ERR(0, 2311, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2311, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2311, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_DrawPlanar_GetVertexPosition", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2311, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DrawPlanar_GetVertexPosition", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_242gp_DrawPlanar_GetVertexPosition(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_242gp_DrawPlanar_GetVertexPosition(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_DrawPlanar_GetVertexPosition", 0); /* "planarity/full/graph.pyx":2324 * """ * # Parameter validation is done by the C layer function * result = graphLib.gp_DrawPlanar_GetVertexPosition(self._theGraph, v) # <<<<<<<<<<<<<< * if result < 0: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetVertexPosition(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2324, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":2325 * # Parameter validation is done by the C layer function * result = graphLib.gp_DrawPlanar_GetVertexPosition(self._theGraph, v) * if result < 0: # <<<<<<<<<<<<<< * raise RuntimeError( * "Underlying gp_DrawPlanar_GetVertexPosition() reported failure." */ __pyx_t_2 = (__pyx_v_result < 0); if (unlikely(__pyx_t_2)) { /* "planarity/full/graph.pyx":2326 * result = graphLib.gp_DrawPlanar_GetVertexPosition(self._theGraph, v) * if result < 0: * raise RuntimeError( # <<<<<<<<<<<<<< * "Underlying gp_DrawPlanar_GetVertexPosition() reported failure." * ) */ __pyx_t_4 = NULL; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Underlying_gp_DrawPlanar_GetVert}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2326, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 2326, __pyx_L1_error) /* "planarity/full/graph.pyx":2325 * # Parameter validation is done by the C layer function * result = graphLib.gp_DrawPlanar_GetVertexPosition(self._theGraph, v) * if result < 0: # <<<<<<<<<<<<<< * raise RuntimeError( * "Underlying gp_DrawPlanar_GetVertexPosition() reported failure." */ } /* "planarity/full/graph.pyx":2330 * ) * * return result # <<<<<<<<<<<<<< * * def gp_DrawPlanar_GetVertexStart(self, int v) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2330, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__Pyx_PyInt_FromNumber(&__pyx_t_3, NULL, 0) < (0)) __PYX_ERR(0, 2330, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":2311 * ) from string_conversion_error * * def gp_DrawPlanar_GetVertexPosition(self, int v) -> int: # <<<<<<<<<<<<<< * """Get the vertical position of a vertex v. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DrawPlanar_GetVertexPosition", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2332 * return result * * def gp_DrawPlanar_GetVertexStart(self, int v) -> int: # <<<<<<<<<<<<<< * """Get the horizontal start position of a vertex v. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_245gp_DrawPlanar_GetVertexStart(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_244gp_DrawPlanar_GetVertexStart, "Graph.gp_DrawPlanar_GetVertexStart(self, int v) -> int\n\nGet the horizontal start position of a vertex v.\n\nArgs:\n v: a vertex for which you wish to get the horizontal start position\n\nReturns:\n The horizontal start position value for v\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_245gp_DrawPlanar_GetVertexStart = {"gp_DrawPlanar_GetVertexStart", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_245gp_DrawPlanar_GetVertexStart, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_244gp_DrawPlanar_GetVertexStart}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_245gp_DrawPlanar_GetVertexStart(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_DrawPlanar_GetVertexStart (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 2332, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2332, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_DrawPlanar_GetVertexStart", 0) < (0)) __PYX_ERR(0, 2332, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_DrawPlanar_GetVertexStart", 1, 1, 1, i); __PYX_ERR(0, 2332, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2332, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2332, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_DrawPlanar_GetVertexStart", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2332, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DrawPlanar_GetVertexStart", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_244gp_DrawPlanar_GetVertexStart(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_244gp_DrawPlanar_GetVertexStart(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_DrawPlanar_GetVertexStart", 0); /* "planarity/full/graph.pyx":2345 * """ * # Parameter validation is done by the C layer function * result = graphLib.gp_DrawPlanar_GetVertexStart(self._theGraph, v) # <<<<<<<<<<<<<< * if result < 0: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetVertexStart(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2345, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":2346 * # Parameter validation is done by the C layer function * result = graphLib.gp_DrawPlanar_GetVertexStart(self._theGraph, v) * if result < 0: # <<<<<<<<<<<<<< * raise RuntimeError( * "Underlying gp_DrawPlanar_GetVertexStart() reported failure." */ __pyx_t_2 = (__pyx_v_result < 0); if (unlikely(__pyx_t_2)) { /* "planarity/full/graph.pyx":2347 * result = graphLib.gp_DrawPlanar_GetVertexStart(self._theGraph, v) * if result < 0: * raise RuntimeError( # <<<<<<<<<<<<<< * "Underlying gp_DrawPlanar_GetVertexStart() reported failure." * ) */ __pyx_t_4 = NULL; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Underlying_gp_DrawPlanar_GetVert_2}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2347, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 2347, __pyx_L1_error) /* "planarity/full/graph.pyx":2346 * # Parameter validation is done by the C layer function * result = graphLib.gp_DrawPlanar_GetVertexStart(self._theGraph, v) * if result < 0: # <<<<<<<<<<<<<< * raise RuntimeError( * "Underlying gp_DrawPlanar_GetVertexStart() reported failure." */ } /* "planarity/full/graph.pyx":2351 * ) * * return result # <<<<<<<<<<<<<< * * def gp_DrawPlanar_GetVertexEnd(self, int v) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2351, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__Pyx_PyInt_FromNumber(&__pyx_t_3, NULL, 0) < (0)) __PYX_ERR(0, 2351, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":2332 * return result * * def gp_DrawPlanar_GetVertexStart(self, int v) -> int: # <<<<<<<<<<<<<< * """Get the horizontal start position of a vertex v. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DrawPlanar_GetVertexStart", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2353 * return result * * def gp_DrawPlanar_GetVertexEnd(self, int v) -> int: # <<<<<<<<<<<<<< * """Get the horizontal end position of a vertex v. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_247gp_DrawPlanar_GetVertexEnd(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_246gp_DrawPlanar_GetVertexEnd, "Graph.gp_DrawPlanar_GetVertexEnd(self, int v) -> int\n\nGet the horizontal end position of a vertex v.\n\nArgs:\n v: a vertex for which you wish to get the horizontal end position\n\nReturns:\n The horizontal end position value for v\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_247gp_DrawPlanar_GetVertexEnd = {"gp_DrawPlanar_GetVertexEnd", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_247gp_DrawPlanar_GetVertexEnd, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_246gp_DrawPlanar_GetVertexEnd}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_247gp_DrawPlanar_GetVertexEnd(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_v; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_DrawPlanar_GetVertexEnd (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_v,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 2353, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2353, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_DrawPlanar_GetVertexEnd", 0) < (0)) __PYX_ERR(0, 2353, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_DrawPlanar_GetVertexEnd", 1, 1, 1, i); __PYX_ERR(0, 2353, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2353, __pyx_L3_error) } __pyx_v_v = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_v == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2353, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_DrawPlanar_GetVertexEnd", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2353, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DrawPlanar_GetVertexEnd", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_246gp_DrawPlanar_GetVertexEnd(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_v); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_246gp_DrawPlanar_GetVertexEnd(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_v) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_DrawPlanar_GetVertexEnd", 0); /* "planarity/full/graph.pyx":2366 * """ * # Parameter validation is done by the C layer function * result = graphLib.gp_DrawPlanar_GetVertexEnd(self._theGraph, v) # <<<<<<<<<<<<<< * if result < 0: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetVertexEnd(__pyx_v_self->_theGraph, __pyx_v_v); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2366, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":2367 * # Parameter validation is done by the C layer function * result = graphLib.gp_DrawPlanar_GetVertexEnd(self._theGraph, v) * if result < 0: # <<<<<<<<<<<<<< * raise RuntimeError( * "Underlying gp_DrawPlanar_GetVertexEnd() reported failure." */ __pyx_t_2 = (__pyx_v_result < 0); if (unlikely(__pyx_t_2)) { /* "planarity/full/graph.pyx":2368 * result = graphLib.gp_DrawPlanar_GetVertexEnd(self._theGraph, v) * if result < 0: * raise RuntimeError( # <<<<<<<<<<<<<< * "Underlying gp_DrawPlanar_GetVertexEnd() reported failure." * ) */ __pyx_t_4 = NULL; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Underlying_gp_DrawPlanar_GetVert_3}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 2368, __pyx_L1_error) /* "planarity/full/graph.pyx":2367 * # Parameter validation is done by the C layer function * result = graphLib.gp_DrawPlanar_GetVertexEnd(self._theGraph, v) * if result < 0: # <<<<<<<<<<<<<< * raise RuntimeError( * "Underlying gp_DrawPlanar_GetVertexEnd() reported failure." */ } /* "planarity/full/graph.pyx":2372 * ) * * return result # <<<<<<<<<<<<<< * * def gp_DrawPlanar_GetEdgePosition(self, int e) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__Pyx_PyInt_FromNumber(&__pyx_t_3, NULL, 0) < (0)) __PYX_ERR(0, 2372, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":2353 * return result * * def gp_DrawPlanar_GetVertexEnd(self, int v) -> int: # <<<<<<<<<<<<<< * """Get the horizontal end position of a vertex v. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DrawPlanar_GetVertexEnd", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2374 * return result * * def gp_DrawPlanar_GetEdgePosition(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the horizontal position of an edge e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_249gp_DrawPlanar_GetEdgePosition(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_248gp_DrawPlanar_GetEdgePosition, "Graph.gp_DrawPlanar_GetEdgePosition(self, int e) -> int\n\nGet the horizontal position of an edge e.\n\nArgs:\n e: an edge for which you wish to get the horizontal position\n\nReturns:\n The horizontal position value for e\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_249gp_DrawPlanar_GetEdgePosition = {"gp_DrawPlanar_GetEdgePosition", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_249gp_DrawPlanar_GetEdgePosition, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_248gp_DrawPlanar_GetEdgePosition}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_249gp_DrawPlanar_GetEdgePosition(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_DrawPlanar_GetEdgePosition (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 2374, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2374, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_DrawPlanar_GetEdgePosition", 0) < (0)) __PYX_ERR(0, 2374, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_DrawPlanar_GetEdgePosition", 1, 1, 1, i); __PYX_ERR(0, 2374, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2374, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2374, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_DrawPlanar_GetEdgePosition", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2374, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DrawPlanar_GetEdgePosition", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_248gp_DrawPlanar_GetEdgePosition(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_248gp_DrawPlanar_GetEdgePosition(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_DrawPlanar_GetEdgePosition", 0); /* "planarity/full/graph.pyx":2387 * """ * # Parameter validation is done by the C layer function * result = graphLib.gp_DrawPlanar_GetEdgePosition(self._theGraph, e) # <<<<<<<<<<<<<< * if result < 0: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetEdgePosition(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2387, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":2388 * # Parameter validation is done by the C layer function * result = graphLib.gp_DrawPlanar_GetEdgePosition(self._theGraph, e) * if result < 0: # <<<<<<<<<<<<<< * raise RuntimeError( * "Underlying gp_DrawPlanar_GetEdgePosition() reported failure." */ __pyx_t_2 = (__pyx_v_result < 0); if (unlikely(__pyx_t_2)) { /* "planarity/full/graph.pyx":2389 * result = graphLib.gp_DrawPlanar_GetEdgePosition(self._theGraph, e) * if result < 0: * raise RuntimeError( # <<<<<<<<<<<<<< * "Underlying gp_DrawPlanar_GetEdgePosition() reported failure." * ) */ __pyx_t_4 = NULL; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Underlying_gp_DrawPlanar_GetEdge}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2389, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 2389, __pyx_L1_error) /* "planarity/full/graph.pyx":2388 * # Parameter validation is done by the C layer function * result = graphLib.gp_DrawPlanar_GetEdgePosition(self._theGraph, e) * if result < 0: # <<<<<<<<<<<<<< * raise RuntimeError( * "Underlying gp_DrawPlanar_GetEdgePosition() reported failure." */ } /* "planarity/full/graph.pyx":2393 * ) * * return result # <<<<<<<<<<<<<< * * def gp_DrawPlanar_GetEdgeStart(self, int e) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2393, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__Pyx_PyInt_FromNumber(&__pyx_t_3, NULL, 0) < (0)) __PYX_ERR(0, 2393, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":2374 * return result * * def gp_DrawPlanar_GetEdgePosition(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the horizontal position of an edge e. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DrawPlanar_GetEdgePosition", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2395 * return result * * def gp_DrawPlanar_GetEdgeStart(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the vertical start position of an edge e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_251gp_DrawPlanar_GetEdgeStart(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_250gp_DrawPlanar_GetEdgeStart, "Graph.gp_DrawPlanar_GetEdgeStart(self, int e) -> int\n\nGet the vertical start position of an edge e.\n\nArgs:\n e: an edge for which you wish to get the vertical start position\n\nReturns:\n The vertical start position value for e\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_251gp_DrawPlanar_GetEdgeStart = {"gp_DrawPlanar_GetEdgeStart", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_251gp_DrawPlanar_GetEdgeStart, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_250gp_DrawPlanar_GetEdgeStart}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_251gp_DrawPlanar_GetEdgeStart(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_DrawPlanar_GetEdgeStart (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 2395, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2395, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_DrawPlanar_GetEdgeStart", 0) < (0)) __PYX_ERR(0, 2395, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_DrawPlanar_GetEdgeStart", 1, 1, 1, i); __PYX_ERR(0, 2395, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2395, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2395, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_DrawPlanar_GetEdgeStart", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2395, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DrawPlanar_GetEdgeStart", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_250gp_DrawPlanar_GetEdgeStart(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_250gp_DrawPlanar_GetEdgeStart(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_DrawPlanar_GetEdgeStart", 0); /* "planarity/full/graph.pyx":2408 * """ * # Parameter validation is done by the C layer function * result = graphLib.gp_DrawPlanar_GetEdgeStart(self._theGraph, e) # <<<<<<<<<<<<<< * if result < 0: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetEdgeStart(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2408, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":2409 * # Parameter validation is done by the C layer function * result = graphLib.gp_DrawPlanar_GetEdgeStart(self._theGraph, e) * if result < 0: # <<<<<<<<<<<<<< * raise RuntimeError( * "Underlying gp_DrawPlanar_GetEdgeStart() reported failure." */ __pyx_t_2 = (__pyx_v_result < 0); if (unlikely(__pyx_t_2)) { /* "planarity/full/graph.pyx":2410 * result = graphLib.gp_DrawPlanar_GetEdgeStart(self._theGraph, e) * if result < 0: * raise RuntimeError( # <<<<<<<<<<<<<< * "Underlying gp_DrawPlanar_GetEdgeStart() reported failure." * ) */ __pyx_t_4 = NULL; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Underlying_gp_DrawPlanar_GetEdge_2}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2410, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 2410, __pyx_L1_error) /* "planarity/full/graph.pyx":2409 * # Parameter validation is done by the C layer function * result = graphLib.gp_DrawPlanar_GetEdgeStart(self._theGraph, e) * if result < 0: # <<<<<<<<<<<<<< * raise RuntimeError( * "Underlying gp_DrawPlanar_GetEdgeStart() reported failure." */ } /* "planarity/full/graph.pyx":2414 * ) * * return result # <<<<<<<<<<<<<< * * def gp_DrawPlanar_GetEdgeEnd(self, int e) -> int: */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__Pyx_PyInt_FromNumber(&__pyx_t_3, NULL, 0) < (0)) __PYX_ERR(0, 2414, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":2395 * return result * * def gp_DrawPlanar_GetEdgeStart(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the vertical start position of an edge e. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DrawPlanar_GetEdgeStart", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2416 * return result * * def gp_DrawPlanar_GetEdgeEnd(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the vertical end position of an edge e. * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_253gp_DrawPlanar_GetEdgeEnd(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_252gp_DrawPlanar_GetEdgeEnd, "Graph.gp_DrawPlanar_GetEdgeEnd(self, int e) -> int\n\nGet the vertical end position of an edge e.\n\nArgs:\n e: an edge for which you wish to get the vertical end position\n\nReturns:\n The vertical end position value for e\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_253gp_DrawPlanar_GetEdgeEnd = {"gp_DrawPlanar_GetEdgeEnd", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_253gp_DrawPlanar_GetEdgeEnd, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_252gp_DrawPlanar_GetEdgeEnd}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_253gp_DrawPlanar_GetEdgeEnd(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_e; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_DrawPlanar_GetEdgeEnd (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_e,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 2416, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2416, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_DrawPlanar_GetEdgeEnd", 0) < (0)) __PYX_ERR(0, 2416, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_DrawPlanar_GetEdgeEnd", 1, 1, 1, i); __PYX_ERR(0, 2416, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 2416, __pyx_L3_error) } __pyx_v_e = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_e == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2416, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_DrawPlanar_GetEdgeEnd", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2416, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DrawPlanar_GetEdgeEnd", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_252gp_DrawPlanar_GetEdgeEnd(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v_e); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_252gp_DrawPlanar_GetEdgeEnd(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, int __pyx_v_e) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; size_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_DrawPlanar_GetEdgeEnd", 0); /* "planarity/full/graph.pyx":2429 * """ * # Parameter validation is done by the C layer function * result = graphLib.gp_DrawPlanar_GetEdgeEnd(self._theGraph, e) # <<<<<<<<<<<<<< * if result < 0: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetEdgeEnd(__pyx_v_self->_theGraph, __pyx_v_e); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2429, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":2430 * # Parameter validation is done by the C layer function * result = graphLib.gp_DrawPlanar_GetEdgeEnd(self._theGraph, e) * if result < 0: # <<<<<<<<<<<<<< * raise RuntimeError( * "Underlying gp_DrawPlanar_GetEdgeEnd() reported failure." */ __pyx_t_2 = (__pyx_v_result < 0); if (unlikely(__pyx_t_2)) { /* "planarity/full/graph.pyx":2431 * result = graphLib.gp_DrawPlanar_GetEdgeEnd(self._theGraph, e) * if result < 0: * raise RuntimeError( # <<<<<<<<<<<<<< * "Underlying gp_DrawPlanar_GetEdgeEnd() reported failure." * ) */ __pyx_t_4 = NULL; __pyx_t_5 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Underlying_gp_DrawPlanar_GetEdge_3}; __pyx_t_3 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2431, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 2431, __pyx_L1_error) /* "planarity/full/graph.pyx":2430 * # Parameter validation is done by the C layer function * result = graphLib.gp_DrawPlanar_GetEdgeEnd(self._theGraph, e) * if result < 0: # <<<<<<<<<<<<<< * raise RuntimeError( * "Underlying gp_DrawPlanar_GetEdgeEnd() reported failure." */ } /* "planarity/full/graph.pyx":2435 * ) * * return result # <<<<<<<<<<<<<< * * def gp_ExtendWith_K23Search(self) -> None: */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2435, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__Pyx_PyInt_FromNumber(&__pyx_t_3, NULL, 0) < (0)) __PYX_ERR(0, 2435, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; /* "planarity/full/graph.pyx":2416 * return result * * def gp_DrawPlanar_GetEdgeEnd(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the vertical end position of an edge e. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_DrawPlanar_GetEdgeEnd", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2437 * return result * * def gp_ExtendWith_K23Search(self) -> None: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the K23Search extension, which * adds the data structures and methods necessary to search for a subgraph */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_255gp_ExtendWith_K23Search(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_254gp_ExtendWith_K23Search, "Graph.gp_ExtendWith_K23Search(self) -> None\n\nDynamically subclasses the graph with the K23Search extension, which\nadds the data structures and methods necessary to search for a subgraph\nhomeomorphic to K_{2, 3}.\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_255gp_ExtendWith_K23Search = {"gp_ExtendWith_K23Search", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_255gp_ExtendWith_K23Search, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_254gp_ExtendWith_K23Search}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_255gp_ExtendWith_K23Search(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ExtendWith_K23Search (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_ExtendWith_K23Search", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_ExtendWith_K23Search", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_254gp_ExtendWith_K23Search(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_254gp_ExtendWith_K23Search(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_ExtendWith_K23Search", 0); /* "planarity/full/graph.pyx":2445 * RuntimeError if C graphlib version of this function failed. * """ * result = graphLib.gp_ExtendWith_K23Search(self._theGraph) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_K23Search(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2445, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":2446 * """ * result = graphLib.gp_ExtendWith_K23Search(self._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Failed to extend graph with K23Search structures." */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2446, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2446, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":2447 * result = graphLib.gp_ExtendWith_K23Search(self._theGraph) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "Failed to extend graph with K23Search structures." * ) */ __pyx_t_3 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_extend_graph_with_K23S}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 2447, __pyx_L1_error) /* "planarity/full/graph.pyx":2446 * """ * result = graphLib.gp_ExtendWith_K23Search(self._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Failed to extend graph with K23Search structures." */ } /* "planarity/full/graph.pyx":2437 * return result * * def gp_ExtendWith_K23Search(self) -> None: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the K23Search extension, which * adds the data structures and methods necessary to search for a subgraph */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ExtendWith_K23Search", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2451 * ) * * def gp_ExtendWith_K33Search(self) -> None: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the K33Search extension, which * adds the data structures and methods necessary to search for a subgraph */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_257gp_ExtendWith_K33Search(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_256gp_ExtendWith_K33Search, "Graph.gp_ExtendWith_K33Search(self) -> None\n\nDynamically subclasses the graph with the K33Search extension, which\nadds the data structures and methods necessary to search for a subgraph\nhomeomorphic to K_{3, 3}.\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_257gp_ExtendWith_K33Search = {"gp_ExtendWith_K33Search", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_257gp_ExtendWith_K33Search, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_256gp_ExtendWith_K33Search}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_257gp_ExtendWith_K33Search(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ExtendWith_K33Search (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_ExtendWith_K33Search", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_ExtendWith_K33Search", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_256gp_ExtendWith_K33Search(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_256gp_ExtendWith_K33Search(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_ExtendWith_K33Search", 0); /* "planarity/full/graph.pyx":2459 * RuntimeError if C graphlib version of this function failed. * """ * result = graphLib.gp_ExtendWith_K33Search(self._theGraph) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_K33Search(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2459, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":2460 * """ * result = graphLib.gp_ExtendWith_K33Search(self._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Failed to extend graph with K33Search structures." */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2460, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2460, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2460, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2460, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":2461 * result = graphLib.gp_ExtendWith_K33Search(self._theGraph) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "Failed to extend graph with K33Search structures." * ) */ __pyx_t_3 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_extend_graph_with_K33S}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2461, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 2461, __pyx_L1_error) /* "planarity/full/graph.pyx":2460 * """ * result = graphLib.gp_ExtendWith_K33Search(self._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Failed to extend graph with K33Search structures." */ } /* "planarity/full/graph.pyx":2451 * ) * * def gp_ExtendWith_K33Search(self) -> None: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the K33Search extension, which * adds the data structures and methods necessary to search for a subgraph */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ExtendWith_K33Search", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graph.pyx":2465 * ) * * def gp_ExtendWith_K4Search(self) -> None: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the K4Search extension, which * adds the data structures and methods necessary to search for a subgraph */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_259gp_ExtendWith_K4Search(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_258gp_ExtendWith_K4Search, "Graph.gp_ExtendWith_K4Search(self) -> None\n\nDynamically subclasses the graph with the K4Search extension, which\nadds the data structures and methods necessary to search for a subgraph\nhomeomorphic to K_4.\n\nRaises:\n RuntimeError if C graphlib version of this function failed."); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_259gp_ExtendWith_K4Search = {"gp_ExtendWith_K4Search", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_259gp_ExtendWith_K4Search, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_258gp_ExtendWith_K4Search}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_259gp_ExtendWith_K4Search(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_ExtendWith_K4Search (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("gp_ExtendWith_K4Search", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("gp_ExtendWith_K4Search", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_258gp_ExtendWith_K4Search(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_258gp_ExtendWith_K4Search(struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { int __pyx_v_result; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; size_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_ExtendWith_K4Search", 0); /* "planarity/full/graph.pyx":2473 * RuntimeError if C graphlib version of this function failed. * """ * result = graphLib.gp_ExtendWith_K4Search(self._theGraph) # <<<<<<<<<<<<<< * if result != OK: * raise RuntimeError( */ __pyx_t_1 = __pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_K4Search(__pyx_v_self->_theGraph); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 2473, __pyx_L1_error) __pyx_v_result = __pyx_t_1; /* "planarity/full/graph.pyx":2474 * """ * result = graphLib.gp_ExtendWith_K4Search(self._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Failed to extend graph with K4Search structures." */ __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_v_result); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2474, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2474, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 2474, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_t_5)) { /* "planarity/full/graph.pyx":2475 * result = graphLib.gp_ExtendWith_K4Search(self._theGraph) * if result != OK: * raise RuntimeError( # <<<<<<<<<<<<<< * "Failed to extend graph with K4Search structures." * ) */ __pyx_t_3 = NULL; __pyx_t_6 = 1; { PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Failed_to_extend_graph_with_K4Se}; __pyx_t_4 = __Pyx_PyObject_FastCall((PyObject*)(((PyTypeObject*)PyExc_RuntimeError)), __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 2475, __pyx_L1_error) /* "planarity/full/graph.pyx":2474 * """ * result = graphLib.gp_ExtendWith_K4Search(self._theGraph) * if result != OK: # <<<<<<<<<<<<<< * raise RuntimeError( * "Failed to extend graph with K4Search structures." */ } /* "planarity/full/graph.pyx":2465 * ) * * def gp_ExtendWith_K4Search(self) -> None: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the K4Search extension, which * adds the data structures and methods necessary to search for a subgraph */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("planarity.full.graph.Graph.gp_ExtendWith_K4Search", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_261__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_260__reduce_cython__, "Graph.__reduce_cython__(self)"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_261__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_261__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_260__reduce_cython__}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_261__reduce_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); if (unlikely(__pyx_nargs > 0)) { __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL; } const Py_ssize_t __pyx_kwds_len = unlikely(__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) return NULL; if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("__reduce_cython__", __pyx_kwds); return NULL;} __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_260__reduce_cython__(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_260__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 * def __reduce_cython__(self): * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0); __PYX_ERR(1, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("planarity.full.graph.Graph.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_263__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_5graph_5Graph_262__setstate_cython__, "Graph.__setstate_cython__(self, __pyx_state)"); static PyMethodDef __pyx_mdef_9planarity_4full_5graph_5Graph_263__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_263__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_262__setstate_cython__}; static PyObject *__pyx_pw_9planarity_4full_5graph_5Graph_263__setstate_cython__(PyObject *__pyx_v_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_pyx_state,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(1, 3, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "__setstate_cython__", 0) < (0)) __PYX_ERR(1, 3, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, i); __PYX_ERR(1, 3, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(1, 3, __pyx_L3_error) } __pyx_v___pyx_state = values[0]; } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graph.Graph.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_5graph_5Graph_262__setstate_cython__(((struct __pyx_obj_9planarity_4full_5graph_Graph *)__pyx_v_self), __pyx_v___pyx_state); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_5graph_5Graph_262__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9planarity_4full_5graph_Graph *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ __Pyx_Raise(((PyObject *)(((PyTypeObject*)PyExc_TypeError))), __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0); __PYX_ERR(1, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("planarity.full.graph.Graph.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* #### Code section: module_exttypes ### */ static PyObject *__pyx_tp_new_9planarity_4full_5graph_Graph(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; o = __Pyx_AllocateExtensionType(t, 0); if (unlikely(!o)) return 0; if (unlikely(__pyx_pw_9planarity_4full_5graph_5Graph_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad; return o; bad: Py_DECREF(o); o = 0; return NULL; } static void __pyx_tp_dealloc_9planarity_4full_5graph_Graph(PyObject *o) { #if CYTHON_USE_TP_FINALIZE if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9planarity_4full_5graph_Graph) { if (PyObject_CallFinalizerFromDealloc(o)) return; } } #endif { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); __pyx_pw_9planarity_4full_5graph_5Graph_3__dealloc__(o); __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } PyTypeObject *tp = Py_TYPE(o); #if CYTHON_USE_TYPE_SLOTS (*tp->tp_free)(o); #else { freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free); if (tp_free) tp_free(o); } #endif #if CYTHON_USE_TYPE_SPECS Py_DECREF(tp); #endif } static PyMethodDef __pyx_methods_9planarity_4full_5graph_Graph[] = { {"gp_EnsureVertexCapacity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_5gp_EnsureVertexCapacity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_4gp_EnsureVertexCapacity}, {"gp_EnsureEdgeCapacity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_7gp_EnsureEdgeCapacity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_6gp_EnsureEdgeCapacity}, {"gp_ResetGraphStorage", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_9gp_ResetGraphStorage, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_8gp_ResetGraphStorage}, {"gp_GetN", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_11gp_GetN, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_10gp_GetN}, {"gp_GetNV", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_13gp_GetNV, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_12gp_GetNV}, {"gp_GetM", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_15gp_GetM, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_14gp_GetM}, {"gp_GetEdgeCapacity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_17gp_GetEdgeCapacity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_16gp_GetEdgeCapacity}, {"gp_CopyGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_19gp_CopyGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_18gp_CopyGraph}, {"gp_DupGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_21gp_DupGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_20gp_DupGraph}, {"gp_CopyAdjacencyLists", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_23gp_CopyAdjacencyLists, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_22gp_CopyAdjacencyLists}, {"gp_CreateRandomGraph", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_25gp_CreateRandomGraph, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_24gp_CreateRandomGraph}, {"gp_CreateRandomGraphEx", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_27gp_CreateRandomGraphEx, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_26gp_CreateRandomGraphEx}, {"gp_IsNeighbor", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_29gp_IsNeighbor, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_28gp_IsNeighbor}, {"gp_FindEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_31gp_FindEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_30gp_FindEdge}, {"gp_GetVertexDegree", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_33gp_GetVertexDegree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_32gp_GetVertexDegree}, {"gp_IsNeighborDirected", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_35gp_IsNeighborDirected, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_34gp_IsNeighborDirected}, {"gp_FindDirectedEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_37gp_FindDirectedEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_36gp_FindDirectedEdge}, {"gp_GetVertexInDegree", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_39gp_GetVertexInDegree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_38gp_GetVertexInDegree}, {"gp_GetVertexOutDegree", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_41gp_GetVertexOutDegree, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_40gp_GetVertexOutDegree}, {"gp_AddEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_43gp_AddEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_42gp_AddEdge}, {"gp_DynamicAddEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_45gp_DynamicAddEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_44gp_DynamicAddEdge}, {"gp_InsertEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_47gp_InsertEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_46gp_InsertEdge}, {"gp_DeleteEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_49gp_DeleteEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_48gp_DeleteEdge}, {"gp_HideEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_51gp_HideEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_50gp_HideEdge}, {"gp_RestoreEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_53gp_RestoreEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_52gp_RestoreEdge}, {"gp_HideVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_55gp_HideVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_54gp_HideVertex}, {"gp_RestoreVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_57gp_RestoreVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_56gp_RestoreVertex}, {"gp_ContractEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_59gp_ContractEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_58gp_ContractEdge}, {"gp_IdentifyVertices", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_61gp_IdentifyVertices, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_60gp_IdentifyVertices}, {"gp_RestoreVertices", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_63gp_RestoreVertices, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_62gp_RestoreVertices}, {"gp_GetGraphFlags", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_65gp_GetGraphFlags, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_64gp_GetGraphFlags}, {"gp_GetFirstEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_67gp_GetFirstEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_66gp_GetFirstEdge}, {"gp_GetLastEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_69gp_GetLastEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_68gp_GetLastEdge}, {"gp_GetEdgeByLink", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_71gp_GetEdgeByLink, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_70gp_GetEdgeByLink}, {"gp_SetFirstEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_73gp_SetFirstEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_72gp_SetFirstEdge}, {"gp_SetLastEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_75gp_SetLastEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_74gp_SetLastEdge}, {"gp_SetEdgeByLink", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_77gp_SetEdgeByLink, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_76gp_SetEdgeByLink}, {"gp_LowerBoundVertices", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_79gp_LowerBoundVertices, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_78gp_LowerBoundVertices}, {"gp_UpperBoundVertices", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_81gp_UpperBoundVertices, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_80gp_UpperBoundVertices}, {"gp_LowerBoundVirtualVertices", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_83gp_LowerBoundVirtualVertices, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_82gp_LowerBoundVirtualVertices}, {"gp_UpperBoundVirtualVertices", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_85gp_UpperBoundVirtualVertices, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_84gp_UpperBoundVirtualVertices}, {"gp_LowerBoundVertexStorage", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_87gp_LowerBoundVertexStorage, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_86gp_LowerBoundVertexStorage}, {"gp_UpperBoundVertexStorage", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_89gp_UpperBoundVertexStorage, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_88gp_UpperBoundVertexStorage}, {"gp_IsVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_91gp_IsVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_90gp_IsVertex}, {"gp_IsVirtualVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_93gp_IsVirtualVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_92gp_IsVirtualVertex}, {"gp_IsNotVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_95gp_IsNotVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_94gp_IsNotVertex}, {"gp_IsNotVirtualVertex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_97gp_IsNotVirtualVertex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_96gp_IsNotVirtualVertex}, {"gp_VirtualVertexInUse", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_99gp_VirtualVertexInUse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_98gp_VirtualVertexInUse}, {"gp_VirtualVertexNotInUse", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_101gp_VirtualVertexNotInUse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_100gp_VirtualVertexNotInUse}, {"gp_GetIndex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_103gp_GetIndex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_102gp_GetIndex}, {"gp_SetIndex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_105gp_SetIndex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_104gp_SetIndex}, {"gp_InitFlags", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_107gp_InitFlags, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_106gp_InitFlags}, {"gp_GetVisited", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_109gp_GetVisited, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_108gp_GetVisited}, {"gp_ClearVisited", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_111gp_ClearVisited, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_110gp_ClearVisited}, {"gp_SetVisited", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_113gp_SetVisited, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_112gp_SetVisited}, {"gp_GetMarked", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_115gp_GetMarked, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_114gp_GetMarked}, {"gp_ClearMarked", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_117gp_ClearMarked, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_116gp_ClearMarked}, {"gp_SetMarked", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_119gp_SetMarked, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_118gp_SetMarked}, {"gp_GetTwin", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_121gp_GetTwin, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_120gp_GetTwin}, {"gp_GetNextEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_123gp_GetNextEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_122gp_GetNextEdge}, {"gp_GetPrevEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_125gp_GetPrevEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_124gp_GetPrevEdge}, {"gp_GetAdjacentEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_127gp_GetAdjacentEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_126gp_GetAdjacentEdge}, {"gp_SetNextEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_129gp_SetNextEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_128gp_SetNextEdge}, {"gp_SetPrevEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_131gp_SetPrevEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_130gp_SetPrevEdge}, {"gp_SetAdjacentEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_133gp_SetAdjacentEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_132gp_SetAdjacentEdge}, {"gp_IsEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_135gp_IsEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_134gp_IsEdge}, {"gp_IsNotEdge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_137gp_IsNotEdge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_136gp_IsNotEdge}, {"gp_GetNeighbor", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_139gp_GetNeighbor, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_138gp_GetNeighbor}, {"gp_SetNeighbor", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_141gp_SetNeighbor, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_140gp_SetNeighbor}, {"gp_InitEdgeFlags", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_143gp_InitEdgeFlags, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_142gp_InitEdgeFlags}, {"gp_GetEdgeVisited", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_145gp_GetEdgeVisited, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_144gp_GetEdgeVisited}, {"gp_ClearEdgeVisited", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_147gp_ClearEdgeVisited, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_146gp_ClearEdgeVisited}, {"gp_SetEdgeVisited", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_149gp_SetEdgeVisited, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_148gp_SetEdgeVisited}, {"gp_GetEdgeMarked", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_151gp_GetEdgeMarked, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_150gp_GetEdgeMarked}, {"gp_ClearEdgeMarked", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_153gp_ClearEdgeMarked, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_152gp_ClearEdgeMarked}, {"gp_SetEdgeMarked", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_155gp_SetEdgeMarked, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_154gp_SetEdgeMarked}, {"gp_GetEdgeType", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_157gp_GetEdgeType, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_156gp_GetEdgeType}, {"gp_ClearEdgeType", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_159gp_ClearEdgeType, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_158gp_ClearEdgeType}, {"gp_SetEdgeType", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_161gp_SetEdgeType, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_160gp_SetEdgeType}, {"gp_ResetEdgeType", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_163gp_ResetEdgeType, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_162gp_ResetEdgeType}, {"gp_GetEdgeFlagInverted", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_165gp_GetEdgeFlagInverted, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_164gp_GetEdgeFlagInverted}, {"gp_SetEdgeFlagInverted", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_167gp_SetEdgeFlagInverted, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_166gp_SetEdgeFlagInverted}, {"gp_ClearEdgeFlagInverted", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_169gp_ClearEdgeFlagInverted, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_168gp_ClearEdgeFlagInverted}, {"gp_XorEdgeFlagInverted", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_171gp_XorEdgeFlagInverted, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_170gp_XorEdgeFlagInverted}, {"gp_GetDirection", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_173gp_GetDirection, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_172gp_GetDirection}, {"gp_SetDirection", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_175gp_SetDirection, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_174gp_SetDirection}, {"gp_LowerBoundEdges", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_177gp_LowerBoundEdges, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_176gp_LowerBoundEdges}, {"gp_UpperBoundEdges", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_179gp_UpperBoundEdges, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_178gp_UpperBoundEdges}, {"gp_EdgeInUse", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_181gp_EdgeInUse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_180gp_EdgeInUse}, {"gp_EdgeNotInUse", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_183gp_EdgeNotInUse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_182gp_EdgeNotInUse}, {"gp_LowerBoundEdgeStorage", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_185gp_LowerBoundEdgeStorage, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_184gp_LowerBoundEdgeStorage}, {"gp_UpperBoundEdgeStorage", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_187gp_UpperBoundEdgeStorage, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_186gp_UpperBoundEdgeStorage}, {"gp_Read", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_189gp_Read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_188gp_Read}, {"gp_ReadFromString", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_191gp_ReadFromString, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_190gp_ReadFromString}, {"gp_Write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_193gp_Write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_192gp_Write}, {"gp_WriteToString", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_195gp_WriteToString, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_194gp_WriteToString}, {"gp_ExtendWith_DFSUtils", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_197gp_ExtendWith_DFSUtils, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_196gp_ExtendWith_DFSUtils}, {"gp_DepthFirstSearch", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_199gp_DepthFirstSearch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_198gp_DepthFirstSearch}, {"gp_SortVertices", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_201gp_SortVertices, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_200gp_SortVertices}, {"gp_ComputeLowpoints", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_203gp_ComputeLowpoints, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_202gp_ComputeLowpoints}, {"gp_ComputeLeastAncestors", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_205gp_ComputeLeastAncestors, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_204gp_ComputeLeastAncestors}, {"gp_GetParent", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_207gp_GetParent, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_206gp_GetParent}, {"gp_GetLeastAncestor", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_209gp_GetLeastAncestor, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_208gp_GetLeastAncestor}, {"gp_GetLowpoint", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_211gp_GetLowpoint, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_210gp_GetLowpoint}, {"gp_IsDFSTreeRoot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_213gp_IsDFSTreeRoot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_212gp_IsDFSTreeRoot}, {"gp_IsNotDFSTreeRoot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_215gp_IsNotDFSTreeRoot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_214gp_IsNotDFSTreeRoot}, {"gp_GetBicompRootFromDFSChild", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_217gp_GetBicompRootFromDFSChild, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_216gp_GetBicompRootFromDFSChild}, {"gp_GetDFSChildFromBicompRoot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_219gp_GetDFSChildFromBicompRoot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_218gp_GetDFSChildFromBicompRoot}, {"gp_GetVertexFromBicompRoot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_221gp_GetVertexFromBicompRoot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_220gp_GetVertexFromBicompRoot}, {"gp_IsBicompRoot", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_223gp_IsBicompRoot, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_222gp_IsBicompRoot}, {"gp_IsSeparatedDFSChild", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_225gp_IsSeparatedDFSChild, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_224gp_IsSeparatedDFSChild}, {"gp_IsNotSeparatedDFSChild", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_227gp_IsNotSeparatedDFSChild, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_226gp_IsNotSeparatedDFSChild}, {"gp_ExtendWith_Planarity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_229gp_ExtendWith_Planarity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_228gp_ExtendWith_Planarity}, {"gp_Embed", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_231gp_Embed, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_230gp_Embed}, {"gp_TestEmbedResultIntegrity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_233gp_TestEmbedResultIntegrity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_232gp_TestEmbedResultIntegrity}, {"gp_ExtendWith_Outerplanarity", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_235gp_ExtendWith_Outerplanarity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_234gp_ExtendWith_Outerplanarity}, {"gp_ExtendWith_DrawPlanar", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_237gp_ExtendWith_DrawPlanar, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_236gp_ExtendWith_DrawPlanar}, {"gp_DrawPlanar_RenderToFile", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_239gp_DrawPlanar_RenderToFile, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_238gp_DrawPlanar_RenderToFile}, {"gp_DrawPlanar_RenderToString", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_241gp_DrawPlanar_RenderToString, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_240gp_DrawPlanar_RenderToString}, {"gp_DrawPlanar_GetVertexPosition", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_243gp_DrawPlanar_GetVertexPosition, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_242gp_DrawPlanar_GetVertexPosition}, {"gp_DrawPlanar_GetVertexStart", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_245gp_DrawPlanar_GetVertexStart, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_244gp_DrawPlanar_GetVertexStart}, {"gp_DrawPlanar_GetVertexEnd", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_247gp_DrawPlanar_GetVertexEnd, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_246gp_DrawPlanar_GetVertexEnd}, {"gp_DrawPlanar_GetEdgePosition", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_249gp_DrawPlanar_GetEdgePosition, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_248gp_DrawPlanar_GetEdgePosition}, {"gp_DrawPlanar_GetEdgeStart", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_251gp_DrawPlanar_GetEdgeStart, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_250gp_DrawPlanar_GetEdgeStart}, {"gp_DrawPlanar_GetEdgeEnd", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_253gp_DrawPlanar_GetEdgeEnd, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_252gp_DrawPlanar_GetEdgeEnd}, {"gp_ExtendWith_K23Search", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_255gp_ExtendWith_K23Search, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_254gp_ExtendWith_K23Search}, {"gp_ExtendWith_K33Search", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_257gp_ExtendWith_K33Search, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_256gp_ExtendWith_K33Search}, {"gp_ExtendWith_K4Search", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_259gp_ExtendWith_K4Search, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_258gp_ExtendWith_K4Search}, {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_261__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_260__reduce_cython__}, {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_5graph_5Graph_263__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_5graph_5Graph_262__setstate_cython__}, {0, 0, 0, 0} }; #if CYTHON_USE_TYPE_SPECS static PyType_Slot __pyx_type_9planarity_4full_5graph_Graph_slots[] = { {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9planarity_4full_5graph_Graph}, {Py_tp_methods, (void *)__pyx_methods_9planarity_4full_5graph_Graph}, {Py_tp_new, (void *)__pyx_tp_new_9planarity_4full_5graph_Graph}, {0, 0}, }; static PyType_Spec __pyx_type_9planarity_4full_5graph_Graph_spec = { "planarity.full.graph.Graph", sizeof(struct __pyx_obj_9planarity_4full_5graph_Graph), 0, Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, __pyx_type_9planarity_4full_5graph_Graph_slots, }; #else static PyTypeObject __pyx_type_9planarity_4full_5graph_Graph = { PyVarObject_HEAD_INIT(0, 0) "planarity.full.graph.""Graph", /*tp_name*/ sizeof(struct __pyx_obj_9planarity_4full_5graph_Graph), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_9planarity_4full_5graph_Graph, /*tp_dealloc*/ 0, /*tp_vectorcall_offset*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_as_async*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_9planarity_4full_5graph_Graph, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_9planarity_4full_5graph_Graph, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if CYTHON_USE_TP_FINALIZE 0, /*tp_finalize*/ #else NULL, /*tp_finalize*/ #endif #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800 0, /*tp_vectorcall*/ #endif #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif #if PY_VERSION_HEX >= 0x030C0000 0, /*tp_watched*/ #endif #if PY_VERSION_HEX >= 0x030d00A4 0, /*tp_versions_used*/ #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; #endif static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; /* #### Code section: initfunc_declarations ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/ /* #### Code section: init_module ### */ static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); /*--- Global init code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); /*--- Variable export code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); /*--- Function export code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ #if CYTHON_USE_TYPE_SPECS __pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9planarity_4full_5graph_Graph_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph)) __PYX_ERR(0, 49, __pyx_L1_error) if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9planarity_4full_5graph_Graph_spec, __pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph) < (0)) __PYX_ERR(0, 49, __pyx_L1_error) #else __pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph = &__pyx_type_9planarity_4full_5graph_Graph; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph) < (0)) __PYX_ERR(0, 49, __pyx_L1_error) #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph); #endif #if !CYTHON_COMPILING_IN_LIMITED_API if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph->tp_dictoffset && __pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph->tp_getattro == PyObject_GenericGetAttr)) { __pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph->tp_getattro = PyObject_GenericGetAttr; } #endif if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_Graph, (PyObject *) __pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph) < (0)) __PYX_ERR(0, 49, __pyx_L1_error) if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_9planarity_4full_5graph_Graph) < (0)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); /*--- Variable import code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); /*--- Function import code ---*/ { __pyx_t_1 = PyImport_ImportModule("planarity.full.graphLib"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); const char * __pyx_import_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_graphP_graphP_graphP_void_int_gr); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely(!__pyx_import_signature)) __PYX_ERR(0, 1, __pyx_L1_error) #endif const char * __pyx_import_name = __pyx_import_signature + 602; void (**const __pyx_import_pointers[])(void) = {(void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DupGraph, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_New, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ComputeLeastAncestors, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ComputeLowpoints, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_CreateRandomGraph, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DepthFirstSearch, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_DFSUtils, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_DrawPlanar, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_K23Search, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_K33Search, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_K4Search, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_Outerplanarity, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_Planarity, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetEdgeCapacity, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetGraphFlags, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetM, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetN, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetNV, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_LowerBoundEdgeStorage, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_LowerBoundEdges, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_LowerBoundVertexStorage, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_LowerBoundVertices, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_LowerBoundVirtualVertices, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_RestoreVertex, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_RestoreVertices, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SortVertices, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_UpperBoundEdgeStorage, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_UpperBoundEdges, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_UpperBoundVertexStorage, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_UpperBoundVertices, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_UpperBoundVirtualVertices, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_RenderToFile, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_Read, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ReadFromString, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_RenderToString, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_WriteToString, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_Write, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_CopyAdjacencyLists, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_CopyGraph, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_TestEmbedResultIntegrity, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ContractEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_CreateRandomGraphEx, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DeleteEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetEdgeEnd, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetEdgePosition, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetEdgeStart, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetVertexEnd, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetVertexPosition, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetVertexStart, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_EdgeInUse, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_EnsureEdgeCapacity, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_EnsureVertexCapacity, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetBicompRootFromDFSChild, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetDFSChildFromBicompRoot, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetDirection, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetEdgeFlagInverted, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetEdgeMarked, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetEdgeType, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetEdgeVisited, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetFirstEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetIndex, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetLastEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetLeastAncestor, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetLowpoint, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetMarked, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetNeighbor, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetNextEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetParent, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetPrevEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetTwin, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetVertexDegree, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetVertexInDegree, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetVertexOutDegree, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetVisited, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_HideVertex, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsBicompRoot, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsNotEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsNotSeparatedDFSChild, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsNotVertex, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsNotVirtualVertex, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsSeparatedDFSChild, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsVertex, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsVirtualVertex, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_VirtualVertexInUse, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_VirtualVertexNotInUse, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_FindEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetAdjacentEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetEdgeByLink, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsNeighbor, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IdentifyVertices, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_AddEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DynamicAddEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_InsertEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_FindDirectedEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsNeighborDirected, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_Embed, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_Free, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ResetGraphStorage, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeFlagInverted, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeMarked, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeType, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeVisited, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ClearMarked, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ClearVisited, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_HideEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_InitEdgeFlags, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_InitFlags, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_RestoreEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetEdgeFlagInverted, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetEdgeMarked, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetEdgeVisited, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetMarked, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetVisited, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_XorEdgeFlagInverted, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ResetEdgeType, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetDirection, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetEdgeType, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetFirstEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetIndex, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetLastEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetNeighbor, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetNextEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetPrevEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetAdjacentEdge, (void (**)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetEdgeByLink, (void (**)(void)) NULL}; void (**const *__pyx_import_pointer)(void) = __pyx_import_pointers; const char *__pyx_import_current_signature = __pyx_import_signature; while (*__pyx_import_pointer) { if (__Pyx_ImportFunction_3_2_6(__pyx_t_1, __pyx_import_name, *__pyx_import_pointer, __pyx_import_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) ++__pyx_import_pointer; __pyx_import_name = strchr(__pyx_import_name, '\0') + 1; __pyx_import_signature = strchr(__pyx_import_signature, '\0') + 1; if (*__pyx_import_signature != '\0') __pyx_import_current_signature = __pyx_import_signature; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_RefNannyFinishContext(); return -1; } #if CYTHON_PEP489_MULTI_PHASE_INIT static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ static int __pyx_pymod_exec_graph(PyObject* module); /*proto*/ static PyModuleDef_Slot __pyx_moduledef_slots[] = { {Py_mod_create, (void*)__pyx_pymod_create}, {Py_mod_exec, (void*)__pyx_pymod_exec_graph}, #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING {Py_mod_gil, __Pyx_FREETHREADING_COMPATIBLE}, #endif #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, #endif {0, NULL} }; #endif #ifdef __cplusplus namespace { struct PyModuleDef __pyx_moduledef = #else static struct PyModuleDef __pyx_moduledef = #endif { PyModuleDef_HEAD_INIT, "graph", __pyx_k_Cython_wrapper_for_the_Edge_Add, /* m_doc */ #if CYTHON_USE_MODULE_STATE sizeof(__pyx_mstatetype), /* m_size */ #else (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */ #endif __pyx_methods /* m_methods */, #if CYTHON_PEP489_MULTI_PHASE_INIT __pyx_moduledef_slots, /* m_slots */ #else NULL, /* m_reload */ #endif #if CYTHON_USE_MODULE_STATE __pyx_m_traverse, /* m_traverse */ __pyx_m_clear, /* m_clear */ NULL /* m_free */ #else NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ #endif }; #ifdef __cplusplus } /* anonymous namespace */ #endif /* PyModInitFuncType */ #ifndef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #else #ifdef __cplusplus #define __Pyx_PyMODINIT_FUNC extern "C" PyObject * #else #define __Pyx_PyMODINIT_FUNC PyObject * #endif #endif __Pyx_PyMODINIT_FUNC PyInit_graph(void) CYTHON_SMALL_CODE; /*proto*/ __Pyx_PyMODINIT_FUNC PyInit_graph(void) #if CYTHON_PEP489_MULTI_PHASE_INIT { return PyModuleDef_Init(&__pyx_moduledef); } /* ModuleCreationPEP489 */ #if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) { { PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think if (!module) { PyErr_Clear(); // just try the 3.8-3.12 version module = PyImport_ImportModule("_xxsubinterpreters"); if (!module) goto bad; } PyObject *current = PyObject_CallMethod(module, "get_current", NULL); Py_DECREF(module); if (!current) goto bad; if (PyTuple_Check(current)) { PyObject *new_current = PySequence_GetItem(current, 0); Py_DECREF(current); current = new_current; if (!new_current) goto bad; } long long as_c_int = PyLong_AsLongLong(current); Py_DECREF(current); return as_c_int; } bad: PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n"); return -1; } #endif #if !CYTHON_USE_MODULE_STATE static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { static PY_INT64_T main_interpreter_id = -1; #if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); #elif CYTHON_COMPILING_IN_GRAAL PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); #elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId(); #elif CYTHON_COMPILING_IN_LIMITED_API PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get()); #else PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); #endif if (unlikely(current_id == -1)) { return -1; } if (main_interpreter_id == -1) { main_interpreter_id = current_id; return 0; } else if (unlikely(main_interpreter_id != current_id)) { PyErr_SetString( PyExc_ImportError, "Interpreter change detected - this module can only be loaded into one interpreter per process."); return -1; } return 0; } #endif static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { if (allow_none || value != Py_None) { result = PyDict_SetItemString(moddict, to_name, value); } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Clear(); } else { result = -1; } return result; } static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; CYTHON_UNUSED_VAR(def); #if !CYTHON_USE_MODULE_STATE if (__Pyx_check_single_interpreter()) return NULL; #endif if (__pyx_m) return __Pyx_NewRef(__pyx_m); modname = PyObject_GetAttrString(spec, "name"); if (unlikely(!modname)) goto bad; module = PyModule_NewObject(modname); Py_DECREF(modname); if (unlikely(!module)) goto bad; moddict = PyModule_GetDict(module); if (unlikely(!moddict)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; return module; bad: Py_XDECREF(module); return NULL; } static CYTHON_SMALL_CODE int __pyx_pymod_exec_graph(PyObject *__pyx_pyinit_module) #endif { int stringtab_initialized = 0; #if CYTHON_USE_MODULE_STATE int pystate_addmodule_run = 0; #endif __pyx_mstatetype *__pyx_mstate = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; Py_ssize_t __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannyDeclarations #if CYTHON_PEP489_MULTI_PHASE_INIT if (__pyx_m) { if (__pyx_m == __pyx_pyinit_module) return 0; PyErr_SetString(PyExc_RuntimeError, "Module 'graph' has already been imported. Re-initialisation is not supported."); return -1; } #else if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif /*--- Module creation code ---*/ #if CYTHON_PEP489_MULTI_PHASE_INIT __pyx_t_1 = __pyx_pyinit_module; Py_INCREF(__pyx_t_1); #else __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) #endif #if CYTHON_USE_MODULE_STATE { int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef); __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "graph" pseudovariable */ if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) pystate_addmodule_run = 1; } #else __pyx_m = __pyx_t_1; #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED); #endif __pyx_mstate = __pyx_mstate_global; CYTHON_UNUSED_VAR(__pyx_t_1); __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_mstate->__pyx_d); __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) /* ImportRefnannyAPI */ #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("PyInit_graph", 0); __Pyx_init_runtime_version(); if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Library function declarations ---*/ /*--- Initialize various global constants etc. ---*/ if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) stringtab_initialized = 1; if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error) if (__pyx_module_is_main_planarity__full__graph) { if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) } { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "planarity.full.graph")) { if (unlikely((PyDict_SetItemString(modules, "planarity.full.graph", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) } } /*--- Builtin init code ---*/ if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Global type/function init code ---*/ (void)__Pyx_modinit_global_init_code(__pyx_mstate); (void)__Pyx_modinit_variable_export_code(__pyx_mstate); (void)__Pyx_modinit_function_export_code(__pyx_mstate); if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) (void)__Pyx_modinit_type_import_code(__pyx_mstate); (void)__Pyx_modinit_variable_import_code(__pyx_mstate); if (unlikely((__Pyx_modinit_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Execution code ---*/ /* "planarity/full/graph.pyx":13 * from planarity.full cimport graphLib * * from planarity.full import graphLib # <<<<<<<<<<<<<< * * */ { PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_graphLib}; __pyx_t_1 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_planarity_full, __pyx_imported_names, 1, NULL, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) } __pyx_t_2 = __pyx_t_1; __Pyx_GOTREF(__pyx_t_2); { PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_graphLib}; __pyx_t_3 = 0; { __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_2, __pyx_imported_names[__pyx_t_3]); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_imported_names[__pyx_t_3], __pyx_t_4) < (0)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":16 * * * OK = graphLib.OK # <<<<<<<<<<<<<< * NONEMBEDDABLE = graphLib.NONEMBEDDABLE * NOTOK = graphLib.NOTOK */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_OK); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_OK, __pyx_t_4) < (0)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":17 * * OK = graphLib.OK * NONEMBEDDABLE = graphLib.NONEMBEDDABLE # <<<<<<<<<<<<<< * NOTOK = graphLib.NOTOK * */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_NONEMBEDDABLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_NONEMBEDDABLE, __pyx_t_2) < (0)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":18 * OK = graphLib.OK * NONEMBEDDABLE = graphLib.NONEMBEDDABLE * NOTOK = graphLib.NOTOK # <<<<<<<<<<<<<< * * TRUE = graphLib.TRUE */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_NOTOK); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_NOTOK, __pyx_t_4) < (0)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":20 * NOTOK = graphLib.NOTOK * * TRUE = graphLib.TRUE # <<<<<<<<<<<<<< * FALSE = graphLib.FALSE * NIL = graphLib.NIL */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_TRUE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_TRUE, __pyx_t_2) < (0)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":21 * * TRUE = graphLib.TRUE * FALSE = graphLib.FALSE # <<<<<<<<<<<<<< * NIL = graphLib.NIL * */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_FALSE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_FALSE, __pyx_t_4) < (0)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":22 * TRUE = graphLib.TRUE * FALSE = graphLib.FALSE * NIL = graphLib.NIL # <<<<<<<<<<<<<< * * EDGE_TYPE_CHILD = graphLib.EDGE_TYPE_CHILD */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_NIL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_NIL, __pyx_t_2) < (0)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":24 * NIL = graphLib.NIL * * EDGE_TYPE_CHILD = graphLib.EDGE_TYPE_CHILD # <<<<<<<<<<<<<< * EDGE_TYPE_FORWARD = graphLib.EDGE_TYPE_FORWARD * EDGE_TYPE_PARENT = graphLib.EDGE_TYPE_PARENT */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_CHILD); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_CHILD, __pyx_t_4) < (0)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":25 * * EDGE_TYPE_CHILD = graphLib.EDGE_TYPE_CHILD * EDGE_TYPE_FORWARD = graphLib.EDGE_TYPE_FORWARD # <<<<<<<<<<<<<< * EDGE_TYPE_PARENT = graphLib.EDGE_TYPE_PARENT * EDGE_TYPE_BACK = graphLib.EDGE_TYPE_BACK */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_FORWARD); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_FORWARD, __pyx_t_2) < (0)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":26 * EDGE_TYPE_CHILD = graphLib.EDGE_TYPE_CHILD * EDGE_TYPE_FORWARD = graphLib.EDGE_TYPE_FORWARD * EDGE_TYPE_PARENT = graphLib.EDGE_TYPE_PARENT # <<<<<<<<<<<<<< * EDGE_TYPE_BACK = graphLib.EDGE_TYPE_BACK * EDGE_TYPE_TREE = graphLib.EDGE_TYPE_TREE */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_PARENT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_PARENT, __pyx_t_4) < (0)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":27 * EDGE_TYPE_FORWARD = graphLib.EDGE_TYPE_FORWARD * EDGE_TYPE_PARENT = graphLib.EDGE_TYPE_PARENT * EDGE_TYPE_BACK = graphLib.EDGE_TYPE_BACK # <<<<<<<<<<<<<< * EDGE_TYPE_TREE = graphLib.EDGE_TYPE_TREE * EDGE_TYPE_NOTDEFINED = graphLib.EDGE_TYPE_NOTDEFINED */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_BACK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_BACK, __pyx_t_2) < (0)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":28 * EDGE_TYPE_PARENT = graphLib.EDGE_TYPE_PARENT * EDGE_TYPE_BACK = graphLib.EDGE_TYPE_BACK * EDGE_TYPE_TREE = graphLib.EDGE_TYPE_TREE # <<<<<<<<<<<<<< * EDGE_TYPE_NOTDEFINED = graphLib.EDGE_TYPE_NOTDEFINED * */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_TREE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_TREE, __pyx_t_4) < (0)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":29 * EDGE_TYPE_BACK = graphLib.EDGE_TYPE_BACK * EDGE_TYPE_TREE = graphLib.EDGE_TYPE_TREE * EDGE_TYPE_NOTDEFINED = graphLib.EDGE_TYPE_NOTDEFINED # <<<<<<<<<<<<<< * * EDGEFLAG_DIRECTION_INONLY = graphLib.EDGEFLAG_DIRECTION_INONLY */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_NOTDEFINED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_NOTDEFINED, __pyx_t_2) < (0)) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":31 * EDGE_TYPE_NOTDEFINED = graphLib.EDGE_TYPE_NOTDEFINED * * EDGEFLAG_DIRECTION_INONLY = graphLib.EDGEFLAG_DIRECTION_INONLY # <<<<<<<<<<<<<< * EDGEFLAG_DIRECTION_OUTONLY = graphLib.EDGEFLAG_DIRECTION_OUTONLY * */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_EDGEFLAG_DIRECTION_INONLY); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGEFLAG_DIRECTION_INONLY, __pyx_t_4) < (0)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":32 * * EDGEFLAG_DIRECTION_INONLY = graphLib.EDGEFLAG_DIRECTION_INONLY * EDGEFLAG_DIRECTION_OUTONLY = graphLib.EDGEFLAG_DIRECTION_OUTONLY # <<<<<<<<<<<<<< * * AT_EDGE_CAPACITY_LIMIT = graphLib.AT_EDGE_CAPACITY_LIMIT */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_EDGEFLAG_DIRECTION_OUTONLY); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGEFLAG_DIRECTION_OUTONLY, __pyx_t_2) < (0)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":34 * EDGEFLAG_DIRECTION_OUTONLY = graphLib.EDGEFLAG_DIRECTION_OUTONLY * * AT_EDGE_CAPACITY_LIMIT = graphLib.AT_EDGE_CAPACITY_LIMIT # <<<<<<<<<<<<<< * * WRITE_ADJLIST = graphLib.WRITE_ADJLIST */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_AT_EDGE_CAPACITY_LIMIT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_AT_EDGE_CAPACITY_LIMIT, __pyx_t_4) < (0)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":36 * AT_EDGE_CAPACITY_LIMIT = graphLib.AT_EDGE_CAPACITY_LIMIT * * WRITE_ADJLIST = graphLib.WRITE_ADJLIST # <<<<<<<<<<<<<< * WRITE_ADJMATRIX = graphLib.WRITE_ADJMATRIX * WRITE_G6 = graphLib.WRITE_G6 */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_WRITE_ADJLIST); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_WRITE_ADJLIST, __pyx_t_2) < (0)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":37 * * WRITE_ADJLIST = graphLib.WRITE_ADJLIST * WRITE_ADJMATRIX = graphLib.WRITE_ADJMATRIX # <<<<<<<<<<<<<< * WRITE_G6 = graphLib.WRITE_G6 * */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_WRITE_ADJMATRIX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_WRITE_ADJMATRIX, __pyx_t_4) < (0)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":38 * WRITE_ADJLIST = graphLib.WRITE_ADJLIST * WRITE_ADJMATRIX = graphLib.WRITE_ADJMATRIX * WRITE_G6 = graphLib.WRITE_G6 # <<<<<<<<<<<<<< * * */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_WRITE_G6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_WRITE_G6, __pyx_t_2) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":41 * * * EMBEDFLAGS_PLANAR = graphLib.EMBEDFLAGS_PLANAR # <<<<<<<<<<<<<< * EMBEDFLAGS_DRAWPLANAR = graphLib.EMBEDFLAGS_DRAWPLANAR * EMBEDFLAGS_OUTERPLANAR = graphLib.EMBEDFLAGS_OUTERPLANAR */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_PLANAR); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_PLANAR, __pyx_t_4) < (0)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":42 * * EMBEDFLAGS_PLANAR = graphLib.EMBEDFLAGS_PLANAR * EMBEDFLAGS_DRAWPLANAR = graphLib.EMBEDFLAGS_DRAWPLANAR # <<<<<<<<<<<<<< * EMBEDFLAGS_OUTERPLANAR = graphLib.EMBEDFLAGS_OUTERPLANAR * EMBEDFLAGS_SEARCHFORK23 = graphLib.EMBEDFLAGS_SEARCHFORK23 */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_DRAWPLANAR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_DRAWPLANAR, __pyx_t_2) < (0)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":43 * EMBEDFLAGS_PLANAR = graphLib.EMBEDFLAGS_PLANAR * EMBEDFLAGS_DRAWPLANAR = graphLib.EMBEDFLAGS_DRAWPLANAR * EMBEDFLAGS_OUTERPLANAR = graphLib.EMBEDFLAGS_OUTERPLANAR # <<<<<<<<<<<<<< * EMBEDFLAGS_SEARCHFORK23 = graphLib.EMBEDFLAGS_SEARCHFORK23 * EMBEDFLAGS_SEARCHFORK33 = graphLib.EMBEDFLAGS_SEARCHFORK33 */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_OUTERPLANAR); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_OUTERPLANAR, __pyx_t_4) < (0)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":44 * EMBEDFLAGS_DRAWPLANAR = graphLib.EMBEDFLAGS_DRAWPLANAR * EMBEDFLAGS_OUTERPLANAR = graphLib.EMBEDFLAGS_OUTERPLANAR * EMBEDFLAGS_SEARCHFORK23 = graphLib.EMBEDFLAGS_SEARCHFORK23 # <<<<<<<<<<<<<< * EMBEDFLAGS_SEARCHFORK33 = graphLib.EMBEDFLAGS_SEARCHFORK33 * EMBEDFLAGS_SEARCHFORK4 = graphLib.EMBEDFLAGS_SEARCHFORK4 */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_SEARCHFORK23); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_SEARCHFORK23, __pyx_t_2) < (0)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":45 * EMBEDFLAGS_OUTERPLANAR = graphLib.EMBEDFLAGS_OUTERPLANAR * EMBEDFLAGS_SEARCHFORK23 = graphLib.EMBEDFLAGS_SEARCHFORK23 * EMBEDFLAGS_SEARCHFORK33 = graphLib.EMBEDFLAGS_SEARCHFORK33 # <<<<<<<<<<<<<< * EMBEDFLAGS_SEARCHFORK4 = graphLib.EMBEDFLAGS_SEARCHFORK4 * */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_SEARCHFORK33); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_SEARCHFORK33, __pyx_t_4) < (0)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":46 * EMBEDFLAGS_SEARCHFORK23 = graphLib.EMBEDFLAGS_SEARCHFORK23 * EMBEDFLAGS_SEARCHFORK33 = graphLib.EMBEDFLAGS_SEARCHFORK33 * EMBEDFLAGS_SEARCHFORK4 = graphLib.EMBEDFLAGS_SEARCHFORK4 # <<<<<<<<<<<<<< * * */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_graphLib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_SEARCHFORK4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_SEARCHFORK4, __pyx_t_2) < (0)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":66 * graphLib.gp_Free(&self._theGraph) * * def gp_EnsureVertexCapacity(self, int N) -> None: # <<<<<<<<<<<<<< * """Allocates memory needed for storage of graph data, especially * N vertices, N virtual vertices, and space for either 3N edges */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 66, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_5gp_EnsureVertexCapacity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_EnsureVertexCapacity, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_EnsureVertexCapacity, __pyx_t_4) < (0)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":86 * ) * * def gp_EnsureEdgeCapacity(self, int requiredEdgeCapacity) -> None: # <<<<<<<<<<<<<< * """Ensures that the graph has or will have space for at least * requiredEdgeCapacity edges. This method can be called multiple */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 86, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_7gp_EnsureEdgeCapacity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_EnsureEdgeCapacity, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_EnsureEdgeCapacity, __pyx_t_2) < (0)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":106 * f"{requiredEdgeCapacity}.") * * def gp_ResetGraphStorage(self) -> None: # <<<<<<<<<<<<<< * """Resets graph storage (including 'subclass' extension data).""" * graphLib.gp_ResetGraphStorage(self._theGraph) */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 106, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_9gp_ResetGraphStorage, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ResetGraphStorage, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ResetGraphStorage, __pyx_t_4) < (0)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":110 * graphLib.gp_ResetGraphStorage(self._theGraph) * * def gp_GetN(self) -> int: # <<<<<<<<<<<<<< * """Getter for the number of vertices in the graph. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 110, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_11gp_GetN, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetN, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetN, __pyx_t_2) < (0)) __PYX_ERR(0, 110, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":118 * return graphLib.gp_GetN(self._theGraph) * * def gp_GetNV(self) -> int: # <<<<<<<<<<<<<< * """Getter for the number of virtual vertices available in the graph. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 118, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_13gp_GetNV, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetNV, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetNV, __pyx_t_4) < (0)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":126 * return graphLib.gp_GetNV(self._theGraph) * * def gp_GetM(self) -> int: # <<<<<<<<<<<<<< * """Getter for number of edges in the graph, M. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 126, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_15gp_GetM, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetM, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetM, __pyx_t_2) < (0)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":134 * return graphLib.gp_GetM(self._theGraph) * * def gp_GetEdgeCapacity(self) -> int: # <<<<<<<<<<<<<< * """Getter for the edge capacity of the graph. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 134, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_17gp_GetEdgeCapacity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetEdgeCapacity, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetEdgeCapacity, __pyx_t_4) < (0)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":142 * return graphLib.gp_GetEdgeCapacity(self._theGraph) * * def gp_CopyGraph(self, Graph srcGraph) -> None: # <<<<<<<<<<<<<< * """Copies src_graph into the destination Graph referred to by self. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 142, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_19gp_CopyGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_CopyGraph, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_CopyGraph, __pyx_t_2) < (0)) __PYX_ERR(0, 142, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":157 * raise RuntimeError(f"gp_CopyGraph() failed.") * * def gp_DupGraph(self) -> Graph: # <<<<<<<<<<<<<< * """Creates a Graph wrapping a copy of the current Graph's graphP. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_Graph) < (0)) __PYX_ERR(0, 157, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_21gp_DupGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_DupGraph, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_DupGraph, __pyx_t_4) < (0)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":176 * return new_graph * * def gp_CopyAdjacencyLists(self, Graph srcGraph) -> None: # <<<<<<<<<<<<<< * """Copies adjacency lists of src_graph into current Graph's graphP. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 176, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_23gp_CopyAdjacencyLists, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_CopyAdjacencyLists, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_CopyAdjacencyLists, __pyx_t_2) < (0)) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":192 * ) * * def gp_CreateRandomGraph(self) -> None: # <<<<<<<<<<<<<< * """Creates a simple connected graph with a random number of edges, * up to the limit of the graph's edge capacity. */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 192, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_25gp_CreateRandomGraph, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_CreateRandomGraph, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_CreateRandomGraph, __pyx_t_4) < (0)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":203 * raise RuntimeError("Unable to create random graph.") * * def gp_CreateRandomGraphEx(self, int numEdges) -> None: # <<<<<<<<<<<<<< * """Creates a simple connected graph with numEdges edges. If numEdges * does not exceed 3N-6, then the generated graph will be planar. */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 203, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_27gp_CreateRandomGraphEx, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_CreateRandomGraphEx, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_CreateRandomGraphEx, __pyx_t_2) < (0)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":220 * ) * * def gp_IsNeighbor(self, int u, int v) -> int: # <<<<<<<<<<<<<< * """Checks if a vertex or virtual vertex is a neighbor of another vertex * or virtual vertex in the graph. */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 220, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_29gp_IsNeighbor, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_IsNeighbor, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_IsNeighbor, __pyx_t_4) < (0)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":234 * return graphLib.gp_IsNeighbor(self._theGraph, u, v) * * def gp_FindEdge(self, int u, int v) -> int: # <<<<<<<<<<<<<< * """Find index of edge between u and v if it exists in graph. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 234, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_31gp_FindEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_FindEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_FindEdge, __pyx_t_2) < (0)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":247 * return graphLib.gp_FindEdge(self._theGraph, u, v) * * def gp_GetVertexDegree(self, int v) -> int: # <<<<<<<<<<<<<< * """Gets the number of incident edges of the vertex with given index. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 247, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_33gp_GetVertexDegree, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetVertexDegree, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetVertexDegree, __pyx_t_4) < (0)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":259 * return graphLib.gp_GetVertexDegree(self._theGraph, v) * * def gp_IsNeighborDirected(self, int u, int v, unsigned direction) -> int: # <<<<<<<<<<<<<< * """Checks if edge exists in a given direction between two vertices. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 259, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_35gp_IsNeighborDirected, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_IsNeighborDirected, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_IsNeighborDirected, __pyx_t_2) < (0)) __PYX_ERR(0, 259, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":274 * return graphLib.gp_IsNeighborDirected(self._theGraph, u, v, direction) * * def gp_FindDirectedEdge(self, int u, int v, unsigned direction) -> int: # <<<<<<<<<<<<<< * """Find directed index of edge between u and v if it exists in graph. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 274, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_37gp_FindDirectedEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_FindDirectedEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_FindDirectedEdge, __pyx_t_4) < (0)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":289 * return graphLib.gp_FindDirectedEdge(self._theGraph, u, v, direction) * * def gp_GetVertexInDegree(self, int v) -> int: # <<<<<<<<<<<<<< * """Gets in-degree of v, including undirected edges * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 289, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 289, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_39gp_GetVertexInDegree, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetVertexInDegree, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 289, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetVertexInDegree, __pyx_t_2) < (0)) __PYX_ERR(0, 289, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":301 * return graphLib.gp_GetVertexInDegree(self._theGraph, v) * * def gp_GetVertexOutDegree(self, int v) -> int: # <<<<<<<<<<<<<< * """Gets out-degree of v, including undirected edges. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 301, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_41gp_GetVertexOutDegree, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetVertexOutDegree, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[18])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetVertexOutDegree, __pyx_t_4) < (0)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":313 * return graphLib.gp_GetVertexOutDegree(self._theGraph, v) * * def gp_AddEdge(self, int u, int ulink, int v, int vlink) -> int: # <<<<<<<<<<<<<< * """Adds edge between two vertices (if sufficient edge capacity). * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 313, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_43gp_AddEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_AddEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[19])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_AddEdge, __pyx_t_2) < (0)) __PYX_ERR(0, 313, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":355 * return result * * def gp_DynamicAddEdge(self, int u, int ulink, int v, int vlink) -> None: # <<<<<<<<<<<<<< * """Adds edge between two vertices, resizing structures if necessessary. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 355, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_45gp_DynamicAddEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_DynamicAddEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[20])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 355, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_DynamicAddEdge, __pyx_t_4) < (0)) __PYX_ERR(0, 355, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":389 * ) * * def gp_InsertEdge(self, int u, int e_u, int e_ulink, int v, int e_v, int e_vlink) -> int: # <<<<<<<<<<<<<< * """Insert edge between u and v in specific positions of adjacency lists. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 389, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 389, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_47gp_InsertEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_InsertEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[21])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 389, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_InsertEdge, __pyx_t_2) < (0)) __PYX_ERR(0, 389, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":423 * return result * * def gp_DeleteEdge(self, int e) -> None: # <<<<<<<<<<<<<< * """Deletes edge with index e from the graph. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 423, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 423, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_49gp_DeleteEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_DeleteEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[22])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 423, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_DeleteEdge, __pyx_t_4) < (0)) __PYX_ERR(0, 423, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":439 * ) * * def gp_HideEdge(self, int e) -> None: # <<<<<<<<<<<<<< * """Hides edge with index e within the graph. The edge still exists * in edge storage but has been unhooked from the adjacency lists of */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 439, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_51gp_HideEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_HideEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[23])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_HideEdge, __pyx_t_2) < (0)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":450 * graphLib.gp_HideEdge(self._theGraph, e) * * def gp_RestoreEdge(self, int e) -> None: # <<<<<<<<<<<<<< * """Restore edge to adjacency lists from which it was previously hidden. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 450, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 450, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_53gp_RestoreEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_RestoreEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[24])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 450, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_RestoreEdge, __pyx_t_4) < (0)) __PYX_ERR(0, 450, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":459 * graphLib.gp_RestoreEdge(self._theGraph, e) * * def gp_HideVertex(self, int vertex) -> None: # <<<<<<<<<<<<<< * """Hides vertex within the graph by hiding its edges and storing * additional internal information that enables the vertex to be */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 459, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 459, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_55gp_HideVertex, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_HideVertex, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[25])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 459, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_HideVertex, __pyx_t_2) < (0)) __PYX_ERR(0, 459, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":478 * ) * * def gp_RestoreVertex(self) -> None: # <<<<<<<<<<<<<< * """Restore the last vertex hidden by gp_HideVertex(). If the vertex was * hidden as part of an edge contraction or vertex identification, then its */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 478, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_57gp_RestoreVertex, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_RestoreVertex, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[26])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_RestoreVertex, __pyx_t_4) < (0)) __PYX_ERR(0, 478, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":493 * ) * * def gp_ContractEdge(self, int e) -> None: # <<<<<<<<<<<<<< * """Contracts the edge e = (u, v) by hiding e and identifying v with u. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 493, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_59gp_ContractEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ContractEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[27])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ContractEdge, __pyx_t_2) < (0)) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":509 * ) * * def gp_IdentifyVertices(self, int u, int v, int eBefore) -> None: # <<<<<<<<<<<<<< * """Identify vertex v with u by transferring all adjacencies from v to u. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 509, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_61gp_IdentifyVertices, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_IdentifyVertices, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[28])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_IdentifyVertices, __pyx_t_4) < (0)) __PYX_ERR(0, 509, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":529 * ) * * def gp_RestoreVertices(self) -> None: # <<<<<<<<<<<<<< * """Restores all vertices hidden during a series of hide vertex, * edge contraction or vertex identification operations. */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 529, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_63gp_RestoreVertices, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_RestoreVertices, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[29])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_RestoreVertices, __pyx_t_2) < (0)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":544 * ) * * def gp_GetGraphFlags(self) -> int: # <<<<<<<<<<<<<< * """Returns flags set on the Graph's graphP * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 544, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_65gp_GetGraphFlags, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetGraphFlags, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[30])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetGraphFlags, __pyx_t_4) < (0)) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":552 * return graphLib.gp_GetGraphFlags(self._theGraph) * * def gp_GetFirstEdge(self, int v) -> int: # <<<<<<<<<<<<<< * """Get index of first edge incident to vertex v. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 552, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_67gp_GetFirstEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetFirstEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[31])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetFirstEdge, __pyx_t_2) < (0)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":571 * return graphLib.gp_GetFirstEdge(self._theGraph, v) * * def gp_GetLastEdge(self, int v) -> int: # <<<<<<<<<<<<<< * """Get index of last edge incident to vertex v. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 571, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_69gp_GetLastEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetLastEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[32])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 571, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetLastEdge, __pyx_t_4) < (0)) __PYX_ERR(0, 571, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":590 * return graphLib.gp_GetLastEdge(self._theGraph, v) * * def gp_GetEdgeByLink(self, int v, int theLink) -> int: # <<<<<<<<<<<<<< * """Get the first or last edge in the adjacency list of v, indicated by theLink * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 590, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 590, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_71gp_GetEdgeByLink, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetEdgeByLink, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[33])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 590, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetEdgeByLink, __pyx_t_2) < (0)) __PYX_ERR(0, 590, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":618 * return graphLib.gp_GetEdgeByLink(self._theGraph, v, theLink) * * def gp_SetFirstEdge(self, int v, int newFirstEdge) -> None: # <<<<<<<<<<<<<< * """Sets the first edge in v's adjacency list to newFirstEdge * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 618, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_73gp_SetFirstEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_SetFirstEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[34])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_SetFirstEdge, __pyx_t_4) < (0)) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":642 * graphLib.gp_SetFirstEdge(self._theGraph, v, newFirstEdge) * * def gp_SetLastEdge(self, int v, int newLastEdge) -> None: # <<<<<<<<<<<<<< * """Sets the last edge in v's adjacency list to newLastEdge. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 642, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 642, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_75gp_SetLastEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_SetLastEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 642, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_SetLastEdge, __pyx_t_2) < (0)) __PYX_ERR(0, 642, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":667 * graphLib.gp_SetLastEdge(self._theGraph, v, newLastEdge) * * def gp_SetEdgeByLink(self, int v, int theLink, int newEdge) -> None: # <<<<<<<<<<<<<< * """Set the first or last edge in v's adjacency list, indicated by theLink. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 667, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 667, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_77gp_SetEdgeByLink, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_SetEdgeByLink, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[36])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 667, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_SetEdgeByLink, __pyx_t_4) < (0)) __PYX_ERR(0, 667, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":700 * graphLib.gp_SetEdgeByLink(self._theGraph, v, theLink, newEdge) * * def gp_LowerBoundVertices(self) -> int: # <<<<<<<<<<<<<< * """Get the lower bound of the graph's vertex indices. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 700, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 700, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_79gp_LowerBoundVertices, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_LowerBoundVertices, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[37])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 700, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_LowerBoundVertices, __pyx_t_2) < (0)) __PYX_ERR(0, 700, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":708 * return graphLib.gp_LowerBoundVertices(self._theGraph) * * def gp_UpperBoundVertices(self) -> int: # <<<<<<<<<<<<<< * """Get the upper bound of the graph's vertex indices. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 708, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 708, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_81gp_UpperBoundVertices, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_UpperBoundVertices, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[38])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 708, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_UpperBoundVertices, __pyx_t_4) < (0)) __PYX_ERR(0, 708, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":716 * return graphLib.gp_UpperBoundVertices(self._theGraph) * * def gp_LowerBoundVirtualVertices(self) -> int: # <<<<<<<<<<<<<< * """Get the lower bound of the graph's virtual vertex indices. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 716, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 716, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_83gp_LowerBoundVirtualVertices, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_LowerBoundVirtualVertic, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 716, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_LowerBoundVirtualVertices, __pyx_t_2) < (0)) __PYX_ERR(0, 716, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":724 * return graphLib.gp_LowerBoundVirtualVertices(self._theGraph) * * def gp_UpperBoundVirtualVertices(self) -> int: # <<<<<<<<<<<<<< * """Get the upper bound of the graph's virtual vertex indices. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 724, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_85gp_UpperBoundVirtualVertices, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_UpperBoundVirtualVertic, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[40])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_UpperBoundVirtualVertices, __pyx_t_4) < (0)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":732 * return graphLib.gp_UpperBoundVirtualVertices(self._theGraph) * * def gp_LowerBoundVertexStorage(self) -> int: # <<<<<<<<<<<<<< * """Get lower bound of graph's storage for non-virtual and virtual vertices. * Use gp_LowerBoundVertices() unless you know why you're using this. */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 732, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 732, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_87gp_LowerBoundVertexStorage, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_LowerBoundVertexStorage, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[41])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 732, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_LowerBoundVertexStorage, __pyx_t_2) < (0)) __PYX_ERR(0, 732, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":742 * return graphLib.gp_LowerBoundVertexStorage(self._theGraph) * * def gp_UpperBoundVertexStorage(self) -> int: # <<<<<<<<<<<<<< * """Get upper bound of graph's storage for non-virtual and virtual vertices. * Use gp_UpperBoundVertices() unless you know why you're using this. */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 742, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_89gp_UpperBoundVertexStorage, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_UpperBoundVertexStorage, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[42])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_UpperBoundVertexStorage, __pyx_t_4) < (0)) __PYX_ERR(0, 742, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":752 * return graphLib.gp_UpperBoundVertexStorage(self._theGraph) * * def gp_IsVertex(self, int v) -> int: # <<<<<<<<<<<<<< * """Determine if index v corresponds to a non-virtual vertex. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 752, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 752, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_91gp_IsVertex, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_IsVertex, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[43])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 752, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_IsVertex, __pyx_t_2) < (0)) __PYX_ERR(0, 752, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":772 * return FALSE * * def gp_IsVirtualVertex(self, int v) -> int: # <<<<<<<<<<<<<< * """Determine if index v corresponds to a virtual vertex * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 772, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_93gp_IsVirtualVertex, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_IsVirtualVertex, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[44])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_IsVirtualVertex, __pyx_t_4) < (0)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":792 * return FALSE * * def gp_IsNotVertex(self, int v) -> int: # <<<<<<<<<<<<<< * """Determine if index v does not correspond to a non-virtual vertex * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 792, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 792, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_95gp_IsNotVertex, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_IsNotVertex, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[45])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 792, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_IsNotVertex, __pyx_t_2) < (0)) __PYX_ERR(0, 792, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":812 * return FALSE * * def gp_IsNotVirtualVertex(self, int v) -> int: # <<<<<<<<<<<<<< * """Determine if index v does not correspond to a virtual vertex * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 812, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 812, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_97gp_IsNotVirtualVertex, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_IsNotVirtualVertex, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[46])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 812, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_IsNotVirtualVertex, __pyx_t_4) < (0)) __PYX_ERR(0, 812, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":832 * return FALSE * * def gp_VirtualVertexInUse(self, int virtualVertex) -> int: # <<<<<<<<<<<<<< * """Determines if virtualVertex corresponds to a virtual vertex in use. * A virtual vertex is in use if it has any incident edges. */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 832, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 832, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_99gp_VirtualVertexInUse, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_VirtualVertexInUse, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[47])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 832, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_VirtualVertexInUse, __pyx_t_2) < (0)) __PYX_ERR(0, 832, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":851 * return FALSE * * def gp_VirtualVertexNotInUse(self, int virtualVertex) -> int: # <<<<<<<<<<<<<< * """Determines if virtualVertex corresponds to a virtual vertex not in use. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 851, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 851, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_101gp_VirtualVertexNotInUse, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_VirtualVertexNotInUse, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[48])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 851, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_VirtualVertexNotInUse, __pyx_t_4) < (0)) __PYX_ERR(0, 851, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":870 * return FALSE * * def gp_GetIndex(self, int v) -> int: # <<<<<<<<<<<<<< * """Get the index data member value of vertex v * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 870, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 870, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_103gp_GetIndex, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetIndex, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[49])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 870, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetIndex, __pyx_t_2) < (0)) __PYX_ERR(0, 870, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":890 * return graphLib.gp_GetIndex(self._theGraph, v) * * def gp_SetIndex(self, int v, int theIndex) -> None: # <<<<<<<<<<<<<< * """Set the index data member of vertex v to theIndex * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 890, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_105gp_SetIndex, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_SetIndex, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[50])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_SetIndex, __pyx_t_4) < (0)) __PYX_ERR(0, 890, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":914 * graphLib.gp_SetIndex(self._theGraph, v, theIndex) * * def gp_InitFlags(self, int v) -> None: # <<<<<<<<<<<<<< * """Resets (clears) all flags for a given vertex. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 914, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 914, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_107gp_InitFlags, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_InitFlags, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[51])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 914, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_InitFlags, __pyx_t_2) < (0)) __PYX_ERR(0, 914, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":930 * graphLib.gp_InitFlags(self._theGraph, v) * * def gp_GetVisited(self, int v) -> int: # <<<<<<<<<<<<<< * """Gets the visited flag of vertex v. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 930, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 930, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_109gp_GetVisited, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetVisited, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[52])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 930, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetVisited, __pyx_t_4) < (0)) __PYX_ERR(0, 930, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":949 * return graphLib.gp_GetVisited(self._theGraph, v) * * def gp_ClearVisited(self, int v) -> None: # <<<<<<<<<<<<<< * """Clears the visited flag of vertex v. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 949, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 949, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_111gp_ClearVisited, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ClearVisited, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[53])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 949, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ClearVisited, __pyx_t_2) < (0)) __PYX_ERR(0, 949, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":965 * graphLib.gp_ClearVisited(self._theGraph, v) * * def gp_SetVisited(self, int v) -> None: # <<<<<<<<<<<<<< * """Sets the visited flag of vertex v. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 965, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 965, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_113gp_SetVisited, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_SetVisited, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[54])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 965, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_SetVisited, __pyx_t_4) < (0)) __PYX_ERR(0, 965, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":981 * graphLib.gp_SetVisited(self._theGraph, v) * * def gp_GetMarked(self, int v) -> int: # <<<<<<<<<<<<<< * """Gets the marked flag of vertex v. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 981, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 981, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_115gp_GetMarked, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetMarked, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[55])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 981, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetMarked, __pyx_t_2) < (0)) __PYX_ERR(0, 981, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1000 * return graphLib.gp_GetMarked(self._theGraph, v) * * def gp_ClearMarked(self, int v) -> None: # <<<<<<<<<<<<<< * """Clears the marked flag of vertex v. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1000, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1000, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_117gp_ClearMarked, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ClearMarked, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[56])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1000, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ClearMarked, __pyx_t_4) < (0)) __PYX_ERR(0, 1000, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1016 * graphLib.gp_ClearMarked(self._theGraph, v) * * def gp_SetMarked(self, int v) -> None: # <<<<<<<<<<<<<< * """Sets the marked flag of vertex v. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1016, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1016, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_119gp_SetMarked, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_SetMarked, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[57])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1016, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_SetMarked, __pyx_t_2) < (0)) __PYX_ERR(0, 1016, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1032 * graphLib.gp_SetMarked(self._theGraph, v) * * def gp_GetTwin(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the twin edge record of the edge record indicated by e, * enabling constant-time navigation between the two halves of */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1032, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_121gp_GetTwin, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetTwin, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[58])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1032, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetTwin, __pyx_t_4) < (0)) __PYX_ERR(0, 1032, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1054 * return graphLib.gp_GetTwin(self._theGraph, e) * * def gp_GetNextEdge(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the next edge after e in the adjacency list containing e. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1054, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1054, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_123gp_GetNextEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetNextEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[59])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1054, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetNextEdge, __pyx_t_2) < (0)) __PYX_ERR(0, 1054, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1074 * return graphLib.gp_GetNextEdge(self._theGraph, e) * * def gp_GetPrevEdge(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the previous edge before e in the adjacency list containing e. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1074, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1074, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_125gp_GetPrevEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetPrevEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[60])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1074, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetPrevEdge, __pyx_t_4) < (0)) __PYX_ERR(0, 1074, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1094 * return graphLib.gp_GetPrevEdge(self._theGraph, e) * * def gp_GetAdjacentEdge(self, int e, int theLink) -> int: # <<<<<<<<<<<<<< * """Get the edge adjacent to e in direction indicated by theLink. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1094, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1094, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_127gp_GetAdjacentEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetAdjacentEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[61])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1094, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetAdjacentEdge, __pyx_t_2) < (0)) __PYX_ERR(0, 1094, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1123 * return graphLib.gp_GetAdjacentEdge(self._theGraph, e, theLink) * * def gp_SetNextEdge(self, int e, int newNextEdge) -> None: # <<<<<<<<<<<<<< * """Set the next edge after e to newNextEdge. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1123, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_129gp_SetNextEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_SetNextEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[62])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_SetNextEdge, __pyx_t_4) < (0)) __PYX_ERR(0, 1123, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1148 * graphLib.gp_SetNextEdge(self._theGraph, e, newNextEdge) * * def gp_SetPrevEdge(self, int e, int newPrevEdge) -> None: # <<<<<<<<<<<<<< * """Set the previous edge before e to newPrevEdge. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1148, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_131gp_SetPrevEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_SetPrevEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[63])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_SetPrevEdge, __pyx_t_2) < (0)) __PYX_ERR(0, 1148, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1173 * graphLib.gp_SetPrevEdge(self._theGraph, e, newPrevEdge) * * def gp_SetAdjacentEdge(self, int e, int theLink, int newEdge) -> None: # <<<<<<<<<<<<<< * """Set the edge adjacent to e in direction indicated by theLink. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1173, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_133gp_SetAdjacentEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_SetAdjacentEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[64])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_SetAdjacentEdge, __pyx_t_4) < (0)) __PYX_ERR(0, 1173, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1206 * graphLib.gp_SetAdjacentEdge(self._theGraph, e, theLink, newEdge) * * def gp_IsEdge(self, int e) -> int: # <<<<<<<<<<<<<< * """Check if e corresponds to an edge location in the edge storage * of the graph. */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1206, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_135gp_IsEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_IsEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[65])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_IsEdge, __pyx_t_2) < (0)) __PYX_ERR(0, 1206, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1226 * return FALSE * * def gp_IsNotEdge(self, int e) -> int: # <<<<<<<<<<<<<< * """Check if e does not correspond to an edge location in the * edge storage of the graph. */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1226, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_137gp_IsNotEdge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_IsNotEdge, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[66])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_IsNotEdge, __pyx_t_4) < (0)) __PYX_ERR(0, 1226, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1246 * return FALSE * * def gp_GetNeighbor(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the neighbor vertex indicated by an in-use edge e. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1246, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_139gp_GetNeighbor, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetNeighbor, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[67])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetNeighbor, __pyx_t_2) < (0)) __PYX_ERR(0, 1246, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1266 * return graphLib.gp_GetNeighbor(self._theGraph, e) * * def gp_SetNeighbor(self, int e, int v) -> None: # <<<<<<<<<<<<<< * """Set the neighbor vertex of an in-use edge e to v. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1266, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1266, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_141gp_SetNeighbor, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_SetNeighbor, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[68])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1266, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_SetNeighbor, __pyx_t_4) < (0)) __PYX_ERR(0, 1266, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1289 * graphLib.gp_SetNeighbor(self._theGraph, e, v) * * def gp_InitEdgeFlags(self, int e) -> None: # <<<<<<<<<<<<<< * """Initialize the edge flags of an in-use edge e. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1289, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1289, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_143gp_InitEdgeFlags, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_InitEdgeFlags, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[69])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1289, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_InitEdgeFlags, __pyx_t_2) < (0)) __PYX_ERR(0, 1289, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1306 * graphLib.gp_InitEdgeFlags(self._theGraph, e) * * def gp_GetEdgeVisited(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the edge visited flag of an in-use edge e. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1306, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1306, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_145gp_GetEdgeVisited, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetEdgeVisited, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[70])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1306, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetEdgeVisited, __pyx_t_4) < (0)) __PYX_ERR(0, 1306, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1326 * return graphLib.gp_GetEdgeVisited(self._theGraph, e) * * def gp_ClearEdgeVisited(self, int e) -> None: # <<<<<<<<<<<<<< * """Clears the edge visited flag of an in-use edge e. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1326, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1326, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_147gp_ClearEdgeVisited, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ClearEdgeVisited, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[71])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1326, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ClearEdgeVisited, __pyx_t_2) < (0)) __PYX_ERR(0, 1326, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1343 * graphLib.gp_ClearEdgeVisited(self._theGraph, e) * * def gp_SetEdgeVisited(self, int e) -> None: # <<<<<<<<<<<<<< * """Set the edge visited flag of an in-use edge e. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1343, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_149gp_SetEdgeVisited, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_SetEdgeVisited, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[72])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_SetEdgeVisited, __pyx_t_4) < (0)) __PYX_ERR(0, 1343, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1360 * graphLib.gp_SetEdgeVisited(self._theGraph, e) * * def gp_GetEdgeMarked(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the edge marked flag of an in-use edge e. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1360, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1360, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_151gp_GetEdgeMarked, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetEdgeMarked, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[73])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1360, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetEdgeMarked, __pyx_t_2) < (0)) __PYX_ERR(0, 1360, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1380 * return graphLib.gp_GetEdgeMarked(self._theGraph, e) * * def gp_ClearEdgeMarked(self, int e) -> None: # <<<<<<<<<<<<<< * """Clears the edge marked flag of an in-use edge e. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1380, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1380, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_153gp_ClearEdgeMarked, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ClearEdgeMarked, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[74])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1380, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ClearEdgeMarked, __pyx_t_4) < (0)) __PYX_ERR(0, 1380, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1397 * graphLib.gp_ClearEdgeMarked(self._theGraph, e) * * def gp_SetEdgeMarked(self, int e) -> None: # <<<<<<<<<<<<<< * """Set the edge marked flag of an in-use edge e. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1397, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_155gp_SetEdgeMarked, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_SetEdgeMarked, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[75])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_SetEdgeMarked, __pyx_t_2) < (0)) __PYX_ERR(0, 1397, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1414 * graphLib.gp_SetEdgeMarked(self._theGraph, e) * * def gp_GetEdgeType(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the edge type of an in-use edge e. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1414, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_157gp_GetEdgeType, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetEdgeType, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[76])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetEdgeType, __pyx_t_4) < (0)) __PYX_ERR(0, 1414, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1436 * return graphLib.gp_GetEdgeType(self._theGraph, e) * * def gp_ClearEdgeType(self, int e) -> None: # <<<<<<<<<<<<<< * """Clears the edge type of an in-use edge e. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1436, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1436, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_159gp_ClearEdgeType, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ClearEdgeType, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[77])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1436, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ClearEdgeType, __pyx_t_2) < (0)) __PYX_ERR(0, 1436, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1453 * graphLib.gp_ClearEdgeType(self._theGraph, e) * * def gp_SetEdgeType(self, int e, int type) -> None: # <<<<<<<<<<<<<< * """Sets the edge type of an in-use edge e to type for the first * time. To change the type after setting the first time, use */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1453, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_161gp_SetEdgeType, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_SetEdgeType, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[78])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1453, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_SetEdgeType, __pyx_t_4) < (0)) __PYX_ERR(0, 1453, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1481 * graphLib.gp_SetEdgeType(self._theGraph, e, type) * * def gp_ResetEdgeType(self, int e, int type) -> None: # <<<<<<<<<<<<<< * """Reset the edge type of in-use edge e to type, clearing the previous type. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1481, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_163gp_ResetEdgeType, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ResetEdgeType, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[79])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1481, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ResetEdgeType, __pyx_t_2) < (0)) __PYX_ERR(0, 1481, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1506 * graphLib.gp_ResetEdgeType(self._theGraph, e, type) * * def gp_GetEdgeFlagInverted(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the edge inverted flag of an in-use edge e. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1506, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_165gp_GetEdgeFlagInverted, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetEdgeFlagInverted, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[80])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1506, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetEdgeFlagInverted, __pyx_t_4) < (0)) __PYX_ERR(0, 1506, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1526 * return graphLib.gp_GetEdgeFlagInverted(self._theGraph, e) * * def gp_SetEdgeFlagInverted(self, int e) -> None: # <<<<<<<<<<<<<< * """Set the edge inverted flag of an in-use edge e. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1526, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1526, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_167gp_SetEdgeFlagInverted, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_SetEdgeFlagInverted, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[81])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1526, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_SetEdgeFlagInverted, __pyx_t_2) < (0)) __PYX_ERR(0, 1526, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1543 * graphLib.gp_SetEdgeFlagInverted(self._theGraph, e) * * def gp_ClearEdgeFlagInverted(self, int e) -> None: # <<<<<<<<<<<<<< * """Clear the edge inverted flag of an in-use edge e. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1543, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_169gp_ClearEdgeFlagInverted, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ClearEdgeFlagInverted, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[82])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ClearEdgeFlagInverted, __pyx_t_4) < (0)) __PYX_ERR(0, 1543, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1560 * graphLib.gp_ClearEdgeFlagInverted(self._theGraph, e) * * def gp_XorEdgeFlagInverted(self, int e) -> None: # <<<<<<<<<<<<<< * """Toggle the edge inverted flag of an in-use edge e. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1560, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1560, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_171gp_XorEdgeFlagInverted, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_XorEdgeFlagInverted, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[83])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1560, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_XorEdgeFlagInverted, __pyx_t_2) < (0)) __PYX_ERR(0, 1560, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1577 * graphLib.gp_XorEdgeFlagInverted(self._theGraph, e) * * def gp_GetDirection(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the direction flag of an in-use edge e. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1577, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1577, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_173gp_GetDirection, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetDirection, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[84])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1577, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetDirection, __pyx_t_4) < (0)) __PYX_ERR(0, 1577, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1597 * return graphLib.gp_GetDirection(self._theGraph, e) * * def gp_SetDirection(self, int e, int direction) -> None: # <<<<<<<<<<<<<< * """Set the direction flag of an in-use edge e. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1597, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_175gp_SetDirection, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_SetDirection, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[85])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1597, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_SetDirection, __pyx_t_2) < (0)) __PYX_ERR(0, 1597, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1621 * graphLib.gp_SetDirection(self._theGraph, e, direction) * * def gp_LowerBoundEdges(self) -> int: # <<<<<<<<<<<<<< * """Get the lower bound for edges. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1621, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1621, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_177gp_LowerBoundEdges, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_LowerBoundEdges, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[86])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1621, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_LowerBoundEdges, __pyx_t_4) < (0)) __PYX_ERR(0, 1621, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1629 * return graphLib.gp_LowerBoundEdges(self._theGraph) * * def gp_UpperBoundEdges(self) -> int: # <<<<<<<<<<<<<< * """Get the upper bound for edges (the lower bound + M + numEdgeHoles). * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1629, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1629, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_179gp_UpperBoundEdges, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_UpperBoundEdges, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[87])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1629, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_UpperBoundEdges, __pyx_t_2) < (0)) __PYX_ERR(0, 1629, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1637 * return graphLib.gp_UpperBoundEdges(self._theGraph) * * def gp_EdgeInUse(self, int e) -> int: # <<<<<<<<<<<<<< * """Determines if an edge is in-use, i.e., if the neighbor vertex is set. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1637, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1637, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_181gp_EdgeInUse, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_EdgeInUse, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[88])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1637, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_EdgeInUse, __pyx_t_4) < (0)) __PYX_ERR(0, 1637, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1651 * return FALSE * * def gp_EdgeNotInUse(self, int e) -> int: # <<<<<<<<<<<<<< * """Determines if an edge is not in-use. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1651, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1651, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_183gp_EdgeNotInUse, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_EdgeNotInUse, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[89])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1651, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_EdgeNotInUse, __pyx_t_2) < (0)) __PYX_ERR(0, 1651, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1673 * #return FALSE * * def gp_LowerBoundEdgeStorage(self) -> int: # <<<<<<<<<<<<<< * """Get the lower bound for edge storage; for iterating over all edge storage. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1673, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1673, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_185gp_LowerBoundEdgeStorage, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_LowerBoundEdgeStorage, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[90])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1673, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_LowerBoundEdgeStorage, __pyx_t_4) < (0)) __PYX_ERR(0, 1673, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1681 * return graphLib.gp_LowerBoundEdgeStorage(self._theGraph) * * def gp_UpperBoundEdgeStorage(self) -> int: # <<<<<<<<<<<<<< * """Get the upper bound for edge storage; for iterating over all edge storage. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1681, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1681, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_187gp_UpperBoundEdgeStorage, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_UpperBoundEdgeStorage, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[91])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1681, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_UpperBoundEdgeStorage, __pyx_t_2) < (0)) __PYX_ERR(0, 1681, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1692 * return graphLib.gp_UpperBoundEdgeStorage(self._theGraph) * * def gp_Read(self, str fileName) -> None: # <<<<<<<<<<<<<< * """Reads the graph from the file named fileName. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1692, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1692, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_189gp_Read, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_Read, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[92])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1692, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_Read, __pyx_t_4) < (0)) __PYX_ERR(0, 1692, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1712 * ) * * def gp_ReadFromString(self, str inputStr) -> None: # <<<<<<<<<<<<<< * """Reads the graph from the given input string. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1712, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1712, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_191gp_ReadFromString, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ReadFromString, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[93])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1712, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ReadFromString, __pyx_t_2) < (0)) __PYX_ERR(0, 1712, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1729 * ) * * def gp_Write(self, str fileName, int writeMode) -> None: # <<<<<<<<<<<<<< * """Writes the graph to the file named fileName in the writeMode format. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1729, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1729, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_193gp_Write, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_Write, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[94])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1729, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_Write, __pyx_t_4) < (0)) __PYX_ERR(0, 1729, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1757 * ) * * def gp_WriteToString(self, int writeMode) -> str: # <<<<<<<<<<<<<< * """Writes the graph to a string in the writeMode format. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1757, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_str) < (0)) __PYX_ERR(0, 1757, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_195gp_WriteToString, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_WriteToString, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[95])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1757, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_WriteToString, __pyx_t_2) < (0)) __PYX_ERR(0, 1757, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1805 * ) from string_conversion_error * * def gp_ExtendWith_DFSUtils(self) -> None: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the DFSUtils extension, which * adds the data structures and methods necessary for performing DFS-related */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1805, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1805, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_197gp_ExtendWith_DFSUtils, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ExtendWith_DFSUtils, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[96])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1805, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ExtendWith_DFSUtils, __pyx_t_4) < (0)) __PYX_ERR(0, 1805, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1819 * ) * * def gp_DepthFirstSearch(self) -> None: # <<<<<<<<<<<<<< * """Performs a depth-first search (DFS) to give vertices values for their * depth first indices (DFIs) and DFS parents and give edges value for */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1819, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1819, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_199gp_DepthFirstSearch, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_DepthFirstSearch, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[97])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1819, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_DepthFirstSearch, __pyx_t_2) < (0)) __PYX_ERR(0, 1819, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1834 * ) * * def gp_SortVertices(self) -> None: # <<<<<<<<<<<<<< * """Sort vertices in ascending order according to their DFIs. * This method invokes gp_DepthFirstSearch(), if it has not already */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1834, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1834, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_201gp_SortVertices, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_SortVertices, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[98])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1834, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_SortVertices, __pyx_t_4) < (0)) __PYX_ERR(0, 1834, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1851 * ) * * def gp_ComputeLowpoints(self) -> None: # <<<<<<<<<<<<<< * """Computes lowpoints and least ancestors for all vertices. This method * first performs gp_DepthFirstSearch() and gp_SortVertices() if they */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1851, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1851, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_203gp_ComputeLowpoints, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ComputeLowpoints, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[99])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1851, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ComputeLowpoints, __pyx_t_2) < (0)) __PYX_ERR(0, 1851, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1864 * ) * * def gp_ComputeLeastAncestors(self) -> None: # <<<<<<<<<<<<<< * """Computes least ancestor values for all vertices. This method * first performs gp_DepthFirstSearch() and gp_SortVertices() if they */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1864, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 1864, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_205gp_ComputeLeastAncestors, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ComputeLeastAncestors, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[100])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1864, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ComputeLeastAncestors, __pyx_t_4) < (0)) __PYX_ERR(0, 1864, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1877 * ) * * def gp_GetParent(self, int v) -> int: # <<<<<<<<<<<<<< * """Get DFS parent of vertex v, once gp_DepthFirstSearch() has been called. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1877, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1877, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_207gp_GetParent, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetParent, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[101])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1877, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetParent, __pyx_t_2) < (0)) __PYX_ERR(0, 1877, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1897 * return graphLib.gp_GetParent(self._theGraph, v) * * def gp_GetLeastAncestor(self, int v) -> int: # <<<<<<<<<<<<<< * """Get least ancestor of vertex v, after least ancestors are computed. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1897, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1897, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_209gp_GetLeastAncestor, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetLeastAncestor, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[102])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1897, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetLeastAncestor, __pyx_t_4) < (0)) __PYX_ERR(0, 1897, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1917 * return graphLib.gp_GetLeastAncestor(self._theGraph, v) * * def gp_GetLowpoint(self, int v) -> int: # <<<<<<<<<<<<<< * """Get lowpoint value of vertex v, after lowpoint values are computed. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1917, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1917, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_211gp_GetLowpoint, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetLowpoint, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[103])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1917, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetLowpoint, __pyx_t_2) < (0)) __PYX_ERR(0, 1917, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1936 * return graphLib.gp_GetLowpoint(self._theGraph, v) * * def gp_IsDFSTreeRoot(self, int v) -> int: # <<<<<<<<<<<<<< * """Determine if vertex v corresponds to DFS tree root (if DFS parent is NIL). * This method assumes that gp_DepthFirstSearch() has been called. */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1936, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1936, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_213gp_IsDFSTreeRoot, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_IsDFSTreeRoot, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[104])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1936, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_IsDFSTreeRoot, __pyx_t_4) < (0)) __PYX_ERR(0, 1936, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":1967 * return FALSE * * def gp_IsNotDFSTreeRoot(self, int v) -> int: # <<<<<<<<<<<<<< * """Determine if vertex v is not the DFS roo (if DFS parent is not NIL). * This method assumes that gp_DepthFirstSearch() has been called. */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1967, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1967, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_215gp_IsNotDFSTreeRoot, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_IsNotDFSTreeRoot, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[105])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1967, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_IsNotDFSTreeRoot, __pyx_t_2) < (0)) __PYX_ERR(0, 1967, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1999 * return FALSE * * def gp_GetBicompRootFromDFSChild(self, int c) -> int: # <<<<<<<<<<<<<< * """Given a DFS child c of a vertex v, this method returns the biconneced * component (bicomp) root of v associated with c. The bicomp root is a */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1999, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 1999, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_217gp_GetBicompRootFromDFSChild, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetBicompRootFromDFSChi, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[106])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1999, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetBicompRootFromDFSChild, __pyx_t_4) < (0)) __PYX_ERR(0, 1999, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":2021 * return graphLib.gp_GetBicompRootFromDFSChild(self._theGraph, c) * * def gp_GetDFSChildFromBicompRoot(self, int R) -> int: # <<<<<<<<<<<<<< * """Given a biconnected component root R (a virtual vertex), this method * returns the DFS child c of a vertex v that R represents. */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2021, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 2021, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_219gp_GetDFSChildFromBicompRoot, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetDFSChildFromBicompRo, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[107])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2021, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetDFSChildFromBicompRoot, __pyx_t_2) < (0)) __PYX_ERR(0, 2021, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":2042 * return graphLib.gp_GetDFSChildFromBicompRoot(self._theGraph, R) * * def gp_GetVertexFromBicompRoot(self, int R) -> int: # <<<<<<<<<<<<<< * """Given a biconnected component root R (a virtual vertex), this method * returns the vertex v that R represents. */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2042, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 2042, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_221gp_GetVertexFromBicompRoot, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_GetVertexFromBicompRoot, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[108])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2042, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_GetVertexFromBicompRoot, __pyx_t_4) < (0)) __PYX_ERR(0, 2042, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":2083 * * * def gp_IsBicompRoot(self, int v) -> int: # <<<<<<<<<<<<<< * """Determines whether a given non-virtual or virtual vertex is a * biconnected component root. This method essentially just returns */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2083, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 2083, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_223gp_IsBicompRoot, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_IsBicompRoot, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[109])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2083, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_IsBicompRoot, __pyx_t_2) < (0)) __PYX_ERR(0, 2083, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":2111 * return FALSE * * def gp_IsSeparatedDFSChild(self, int theChild) -> int: # <<<<<<<<<<<<<< * """Determines whether a given vertex (theChild) is in a * separate biconnected component from its DFS parent, v. */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 2111, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_225gp_IsSeparatedDFSChild, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_IsSeparatedDFSChild, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[110])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_IsSeparatedDFSChild, __pyx_t_4) < (0)) __PYX_ERR(0, 2111, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":2136 * return FALSE * * def gp_IsNotSeparatedDFSChild(self, int theChild) -> int: # <<<<<<<<<<<<<< * """Determines whether a given vertex (theChild) is not in a * separate biconnected component from its DFS parent, v. */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 2136, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_227gp_IsNotSeparatedDFSChild, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_IsNotSeparatedDFSChild, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[111])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_IsNotSeparatedDFSChild, __pyx_t_2) < (0)) __PYX_ERR(0, 2136, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":2161 * return FALSE * * def gp_ExtendWith_Planarity(self) -> None: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the Planarity extension, which * adds the data structures and methods necessary for planar graph embedding */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 2161, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_229gp_ExtendWith_Planarity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ExtendWith_Planarity, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[112])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ExtendWith_Planarity, __pyx_t_4) < (0)) __PYX_ERR(0, 2161, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":2178 * ) * * def gp_Embed(self, int embedFlags) -> int: # <<<<<<<<<<<<<< * """Modifies the graph to be either an embedding of the original * graph or a minimal subgraph obstructing embedding. The type of */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 2178, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_231gp_Embed, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_Embed, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[113])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_Embed, __pyx_t_2) < (0)) __PYX_ERR(0, 2178, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":2205 * return embed_result * * def gp_TestEmbedResultIntegrity(self, Graph origGraph, int embedResult) -> int: # <<<<<<<<<<<<<< * """Tests whether the graph has valid content based on the * embedding algorithm performed by gp_Embed(), a copy of the */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 2205, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_233gp_TestEmbedResultIntegrity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_TestEmbedResultIntegrit, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[114])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_TestEmbedResultIntegrity, __pyx_t_4) < (0)) __PYX_ERR(0, 2205, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":2228 * return check_result * * def gp_ExtendWith_Outerplanarity(self) -> None: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the Outerplanarity extension, * which adds the data structures and methods necessary for outerplanar */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 2228, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_235gp_ExtendWith_Outerplanarity, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ExtendWith_Outerplanari, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[115])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ExtendWith_Outerplanarity, __pyx_t_2) < (0)) __PYX_ERR(0, 2228, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":2245 * ) * * def gp_ExtendWith_DrawPlanar(self) -> int: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the DrawPlanar extension, which * adds the data structures and methods necessary for embedding and then */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 2245, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_237gp_ExtendWith_DrawPlanar, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ExtendWith_DrawPlanar, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[116])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ExtendWith_DrawPlanar, __pyx_t_4) < (0)) __PYX_ERR(0, 2245, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":2265 * return result * * def gp_DrawPlanar_RenderToFile(self, str theFileName) -> None: # <<<<<<<<<<<<<< * """Draws into a file an ASCII rendition of a planar graph * embedding created by gp_Embed(). */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 2265, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_239gp_DrawPlanar_RenderToFile, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_DrawPlanar_RenderToFile, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[117])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_DrawPlanar_RenderToFile, __pyx_t_2) < (0)) __PYX_ERR(0, 2265, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":2286 * ) * * def gp_DrawPlanar_RenderToString(self) -> str: # <<<<<<<<<<<<<< * """Draws into a string an ASCII rendition of a planar graph * embedding created by gp_Embed(). */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2286, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_str) < (0)) __PYX_ERR(0, 2286, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_241gp_DrawPlanar_RenderToString, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_DrawPlanar_RenderToStri, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[118])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2286, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_DrawPlanar_RenderToString, __pyx_t_4) < (0)) __PYX_ERR(0, 2286, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":2311 * ) from string_conversion_error * * def gp_DrawPlanar_GetVertexPosition(self, int v) -> int: # <<<<<<<<<<<<<< * """Get the vertical position of a vertex v. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 2311, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_243gp_DrawPlanar_GetVertexPosition, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_DrawPlanar_GetVertexPos, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[119])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_DrawPlanar_GetVertexPosition, __pyx_t_2) < (0)) __PYX_ERR(0, 2311, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":2332 * return result * * def gp_DrawPlanar_GetVertexStart(self, int v) -> int: # <<<<<<<<<<<<<< * """Get the horizontal start position of a vertex v. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2332, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 2332, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_245gp_DrawPlanar_GetVertexStart, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_DrawPlanar_GetVertexSta, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[120])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2332, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_DrawPlanar_GetVertexStart, __pyx_t_4) < (0)) __PYX_ERR(0, 2332, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":2353 * return result * * def gp_DrawPlanar_GetVertexEnd(self, int v) -> int: # <<<<<<<<<<<<<< * """Get the horizontal end position of a vertex v. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2353, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 2353, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_247gp_DrawPlanar_GetVertexEnd, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_DrawPlanar_GetVertexEnd, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[121])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2353, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_DrawPlanar_GetVertexEnd, __pyx_t_2) < (0)) __PYX_ERR(0, 2353, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":2374 * return result * * def gp_DrawPlanar_GetEdgePosition(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the horizontal position of an edge e. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 2374, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_249gp_DrawPlanar_GetEdgePosition, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_DrawPlanar_GetEdgePosit, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[122])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_DrawPlanar_GetEdgePosition, __pyx_t_4) < (0)) __PYX_ERR(0, 2374, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":2395 * return result * * def gp_DrawPlanar_GetEdgeStart(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the vertical start position of an edge e. * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2395, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 2395, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_251gp_DrawPlanar_GetEdgeStart, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_DrawPlanar_GetEdgeStart, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[123])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2395, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_DrawPlanar_GetEdgeStart, __pyx_t_2) < (0)) __PYX_ERR(0, 2395, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":2416 * return result * * def gp_DrawPlanar_GetEdgeEnd(self, int e) -> int: # <<<<<<<<<<<<<< * """Get the vertical end position of an edge e. * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2416, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 2416, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_253gp_DrawPlanar_GetEdgeEnd, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_DrawPlanar_GetEdgeEnd, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[124])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2416, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_DrawPlanar_GetEdgeEnd, __pyx_t_4) < (0)) __PYX_ERR(0, 2416, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":2437 * return result * * def gp_ExtendWith_K23Search(self) -> None: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the K23Search extension, which * adds the data structures and methods necessary to search for a subgraph */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2437, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 2437, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_255gp_ExtendWith_K23Search, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ExtendWith_K23Search, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[125])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2437, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ExtendWith_K23Search, __pyx_t_2) < (0)) __PYX_ERR(0, 2437, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":2451 * ) * * def gp_ExtendWith_K33Search(self) -> None: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the K33Search extension, which * adds the data structures and methods necessary to search for a subgraph */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 2451, __pyx_L1_error) __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_257gp_ExtendWith_K33Search, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ExtendWith_K33Search, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[126])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_4); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ExtendWith_K33Search, __pyx_t_4) < (0)) __PYX_ERR(0, 2451, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "planarity/full/graph.pyx":2465 * ) * * def gp_ExtendWith_K4Search(self) -> None: # <<<<<<<<<<<<<< * """Dynamically subclasses the graph with the K4Search extension, which * adds the data structures and methods necessary to search for a subgraph */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2465, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 2465, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_259gp_ExtendWith_K4Search, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph_gp_ExtendWith_K4Search, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[127])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2465, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_9planarity_4full_5graph_Graph, __pyx_mstate_global->__pyx_n_u_gp_ExtendWith_K4Search, __pyx_t_2) < (0)) __PYX_ERR(0, 2465, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_261__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[128])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_2) < (0)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "(tree fragment)":3 * def __reduce_cython__(self): * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_5graph_5Graph_263__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_Graph___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graph, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[129])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_2) < (0)) __PYX_ERR(1, 3, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graph.pyx":1 * #!/usr/bin/env python # <<<<<<<<<<<<<< * # cython: embedsignature=True * """ */ __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_2) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); if (__pyx_m) { if (__pyx_mstate->__pyx_d && stringtab_initialized) { __Pyx_AddTraceback("init planarity.full.graph", __pyx_clineno, __pyx_lineno, __pyx_filename); } #if !CYTHON_USE_MODULE_STATE Py_CLEAR(__pyx_m); #else Py_DECREF(__pyx_m); if (pystate_addmodule_run) { PyObject *tp, *value, *tb; PyErr_Fetch(&tp, &value, &tb); PyState_RemoveModule(&__pyx_moduledef); PyErr_Restore(tp, value, tb); } #endif } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init planarity.full.graph"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if CYTHON_PEP489_MULTI_PHASE_INIT return (__pyx_m != NULL) ? 0 : -1; #else return __pyx_m; #endif } /* #### Code section: pystring_table ### */ /* #### Code section: cached_builtins ### */ static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); /* Cached unbound methods */ __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items; __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type; __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop; __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type; __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values; return 0; } /* #### Code section: cached_constants ### */ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); __Pyx_RefNannyFinishContext(); return 0; } /* #### Code section: init_constants ### */ static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); { const struct { const unsigned int length: 12; } index[] = {{1},{36},{44},{50},{49},{49},{48},{54},{49},{34},{39},{36},{31},{31},{4},{179},{50},{30},{47},{60},{57},{55},{62},{59},{57},{2},{2},{1},{8},{20},{13},{14},{14},{7},{6},{9},{17},{21},{2},{50},{52},{46},{44},{47},{44},{45},{34},{29},{54},{22},{50},{61},{21},{57},{55},{49},{80},{46},{57},{58},{66},{43},{52},{55},{50},{44},{42},{45},{48},{41},{50},{49},{44},{42},{42},{48},{42},{48},{38},{64},{59},{41},{43},{46},{53},{44},{42},{56},{60},{46},{49},{62},{59},{16},{61},{29},{44},{47},{52},{120},{46},{57},{52},{46},{43},{52},{55},{37},{50},{44},{42},{45},{45},{51},{41},{47},{41},{50},{39},{42},{42},{44},{42},{52},{42},{52},{43},{25},{71},{47},{47},{59},{39},{24},{50},{45},{23},{21},{27},{9},{50},{24},{40},{14},{46},{10},{15},{22},{25},{26},{14},{15},{17},{20},{16},{14},{21},{22},{17},{23},{23},{22},{5},{5},{23},{25},{16},{30},{24},{22},{25},{20},{21},{30},{25},{21},{27},{18},{26},{28},{19},{25},{30},{35},{32},{32},{37},{34},{32},{34},{17},{23},{18},{21},{14},{27},{29},{28},{30},{29},{29},{28},{34},{29},{25},{17},{24},{34},{34},{21},{22},{24},{28},{22},{20},{23},{21},{22},{17},{20},{25},{20},{13},{18},{13},{14},{20},{20},{18},{20},{16},{24},{32},{26},{27},{19},{17},{19},{25},{22},{18},{19},{21},{22},{15},{19},{27},{25},{18},{31},{20},{27},{28},{17},{24},{30},{24},{32},{27},{34},{13},{23},{22},{26},{20},{22},{24},{24},{21},{22},{28},{22},{20},{23},{21},{17},{20},{18},{20},{20},{20},{19},{21},{33},{30},{24},{32},{27},{34},{27},{30},{14},{22},{28},{1},{3},{13},{5},{4},{2},{20},{1},{4},{13},{15},{8},{18},{11},{1},{12},{18},{9},{1},{7},{3},{7},{3},{7},{10},{11},{12},{7},{15},{18},{8},{8},{12},{10},{24},{18},{16},{19},{14},{15},{24},{19},{15},{21},{12},{20},{22},{13},{19},{24},{29},{26},{26},{31},{28},{26},{28},{11},{17},{12},{15},{8},{21},{23},{22},{24},{23},{23},{22},{28},{23},{19},{11},{18},{28},{28},{15},{16},{18},{22},{16},{14},{17},{15},{16},{11},{14},{19},{14},{7},{12},{7},{8},{14},{14},{12},{14},{10},{18},{26},{20},{21},{13},{11},{13},{19},{16},{12},{13},{15},{16},{9},{13},{21},{19},{12},{25},{14},{21},{22},{11},{18},{24},{18},{26},{21},{28},{7},{17},{16},{20},{14},{16},{18},{18},{15},{16},{22},{16},{14},{17},{15},{11},{14},{12},{14},{14},{14},{13},{15},{27},{24},{18},{26},{21},{28},{22},{21},{24},{8},{16},{22},{8},{8},{3},{13},{5},{8},{10},{8},{7},{12},{11},{11},{11},{9},{8},{9},{12},{12},{14},{20},{3},{11},{12},{10},{17},{13},{15},{15},{20},{6},{6},{4},{12},{10},{12},{19},{8},{3},{23},{8},{8},{11},{12},{8},{7},{4},{1},{5},{1},{6},{6},{13},{5},{9},{2942},{44},{19},{19},{38},{33},{43},{22},{47},{21},{47},{49},{87},{47},{52},{172},{38},{38},{43},{59},{45},{100},{47},{87},{130},{59},{33},{28},{38},{50},{50},{47},{47},{50},{63},{100},{63},{54},{50},{47},{72},{58},{44},{99},{61},{47},{79},{92},{42},{86},{87},{87},{47},{61},{33},{19},{19},{47},{50},{60},{60},{146},{38},{18},{47},{59},{123},{123},{25},{133},{25},{57},{19},{43},{9},{59},{49},{40},{66},{60},{58},{21},{22},{60},{33},{33},{53},{101},{19},{89},{60},{58},{38},{94},{14},{21},{37},{40},{43},{59},{44},{49},{49},{49},{50},{47},{62},{49},{58},{19},{59},{18},{59},{18},{51},{18}}; #if (CYTHON_COMPRESS_STRINGS) == 3 && __PYX_LIMITED_VERSION_HEX >= 0x030e0000 /* compression: zstd (5428 bytes) */ const char* const cstring = "(\265/\375`aTU\251\000*\210\270\034G\360\260\272\001\314\300\314\316\003\0026F\3344`\205\024\222\nX!\205\244\303\027N\377S\262S\322M\23199\372\2344\321\220di$\311q\016;\323\224\211\374\241\272\347\022\377\217\373\226\t\010C7\337\362\221\377\377\203\262)\227\001\253\001\305\0014]\204\231\305l\315\312+\025\211\355\246\302\305W\230\307\337\367\027\356\231)\365RY\351\321\363\341\376.\030E\327`\027/\327\266\035\363i\177\373\373\313\264l\352\243\347\250o\313d~\243\215\\\274\260\324\351\373\276S\263O\003\365\327\241>\255|\377\313\375\363\317\267H\233\021G\276\213\337\353\217{\337g\275\262]\232\355\367\211\030\214\236Y\364\006\265*&\207\251\236uh\232Pb\273&\343\204{\307\353\001\004\275/\346u\277(\366K\223\021\277\r3\0025\211\366\033\274\301\214\370\227\350/r\014\202Y\3045\031\221\320\350\023 G\375\236?l$\373]\244\351~K&l/\266P_\257`L\213\271\205.\027\304\365:\006\324Xf\344\375\352\237u\367[F\3542\177\373\270\376\362\0130\337\033M\2070\231\273\214\264\017sJ\333v\337\340%\301_\344<\177\2555\277\243x\2732\325\245\335\376\345\373\207{\204\2712\361z\355}\016?\230\321_\377?\375\202\347\213\302\001\345\244\205j]\376\335B\r\263C\r^\277M\367\347\331\277\372\213,\315E\226\315\303x/\315\2760\370\016/\270\303l\343*\222+\003\273\356\\\334?\2132]\224uMk\321\272\376c\013Ji\366\365\254a%\014&\306\377\215=\363\034\266fr?\335\331\3373wF\313=\346\202\\\177\032\315\305\331\277\265b\370\356\337_\323\375]\333\270\370]\361\303\370\364\354\273\267\277{\214\376|\337\037\216^w\030\031}A\035\356\234\032\005\230\353p\004E\214\371\3162\030{\031\3547\376\033f\257X8\006\177|\224a,\343*-\223Y\240\036\261\326]\224i\025\255a|\031Fc\276q\370u\374a\257\371\376\243\330\305o$\356\217\337|\326\260\222B\365\212y,1\230jU\342\344\341\027\n\224\313+\366\222\351\027\376\337>\321\334Z\030\233h\321\\d\231hA\255T\274\323J\305b\321h.\252\357u\014\346uL\356\"\310GQ\245k\317UZ\367\030}:\301b\321 \337\251\026J\311\273p\325\212\016wJ\214\275hP/\277W\336\215\366\363\367\030\177#\024l\345\245PJ$L/\017\005{\241X\336\252\205""\302{\2350\354\204RaA\241P\257X\214\205zy-\024K\225B\235b-\254\227\207\342\325\222:\255T$L&L\236\nF\265^b8\346\322\362\262b\265\260T\230\325\242\212\231P/\325\t\257x\253TL\305\242Z\341\227\230\312\344\265<\023F\255\234P8\346\225\2144l2f~\317\314\276=\013\241\277>\212>e\244u\3770`8\2123\177in4\013a8\312,`\3747\337_\230\267m\367\177\302E>\202\027c\375\215\240\356\030g\231\006\257\310A\355\367\350\212|d\263y\222\361\212)d\342j\345\302\372#\355\217\"(\262\314\310\304\230\376\273\243\370]\204i\230\r\006\203\2013\232\303\362\267\305=\2027\314\327\217\272\357\260\254_3\232\005f\232\206y\255{\314\353\237\301\r\362\374y\325\366~s\325\3367\331\376\\\203\252\031\270I|\367\33331\233\356-\335s++\262S\013\221\2000 XAd\257\225\022\254#\244\2579P\200\223\256\316\316Y3CJONp\323\235%\235\025\364\2611\2639S\246\344:8r5RA\215W\343A*\001\224 lj\345\003\217G\202<\271Zi*i\324\034\360\310\301^\253\307\231P9\352BA\316\230\351\231#9\221)\"R;\325s\245 LV\\\246 =@\300\211\340JhXMN\320t\231\021>\353\207\303&\237\243\323;Q\230)\312\020Q\032\236#gwR\250\251YM\001@Wf\307\254\225\227\243\326R\021\330\305\352\202\265\262R\326\224\222\265$\264r\220\031\\\251\227\246\\\022:\303D1E\246\214\224\223r\010\271\031\351T\216:\302\223\363J\n\235\3111A\220\277\006\245\306\003\344\351\260\001n<\022\002I\235\201\242\240\"\024\003\203\233\031d\210tV\350\254\265\232\003\0346$\362\343aCJg\234('(GB[<\253\307#7\240\303&\270\021\245\036j\250\t\3658O&\311\024\371\254\240\016\033\272\351LQg\355<7\234s\302\207\013\005\241\n\326P\207\365\270\021\235\024:\253\247\222T\223'\227K\023\362\303#\347\"E\310\r5\0048r\"5DG\320\016%-X\031tX\220\033\016z\241\263\302\254\265\326Zk\255\265\326Zk\255\265\326Zk\255\265\326Zk\255\265\326\236`\261\330\026J\311Zk-\250y\314\366|\274&%\024n\317\263\357\232|\276m\t\270E\233-\231p[6o\033i#\210\275\376\030w\261w\355\261\357\337\177\335cY\250=\357\343\327}\2175\335AN\243k4\214i\"m4\362\372\337`\360\356\242\314\310\003.\023dr\314\033Y2\310\335J\n4dW.\000\235\030\010%\020y|L\350@iJH\315\006\216""\203#\001\252\2454hJ6\035\224%\372O\003\"\217MNDb\212\350N\013%\003\227)\201T;S\036t\0379A\347q\223\317\321\205\365\345ZQ\270\017\256C\3150\272Q\361\262\276\224 \r<\244\024\000\210#\340\\\021\352\322\257F\310u\232\270\312\220.\224K\007dW\302)C\346X>(]e\005\220\232\241t\340\340dQ\212\224]\031\203\006\032\"+\324\014\350\34487\365\374i}\272\016\341w;$\224\014\207\3514\334C\303\002j\303\213k\003\033D\373\027\031\315\323\374\t\231\rJ\260R1!\027~b\233\367\365\327!\005}M\rK\037i1\221\021\372Y\306/\005\222n\312\010\216\020\203\302\271\"\265i\310\334|\303%]Y-\212\307\331\377\353\342\372sD\002\205V^\031!x\213y\330!\003\201\264\246d\306B\017\0132\217\036\372\300\216\217\201?=\026\335\357Reg\264\357\235L\266:XP""\372i\261V)\222V\271\376\307\300\323KN(\006\244\211\353F\266\340s!\r\301\370\340%\022\340S\202\233\247\317i\256\2028Z`J\200\343\241\2333\014\341\2664\010hz\246\030\375\024\245r\216\035\257\364\324Q\232\017\233\335d\233\356\2703\243\017\252NkN\216a\255rQD\035S\330.)\r\350\361AO\310\316\234$>\357\370`\206hR\276\366\034Zc\235\230\241\302U!\357\036\210g\357I\0264S\263\340\006$U\031\"\006\374\340\007,[o\225\241.\033\353\356\004=\010\343\366\251\337\246\002\322(\344|9F\227\234*\252\211\314Cb\315z\030_D\325\215\2609:u\222\256|\037J\356$\350m\263\321}[\005\251\201 \276\214\323\ta\365o\246\207\222\375\371P\367l\317c:\002\361\211z\3222\253q\332\253\357\257\226\224\022\002\222ll*!\330\216\362\216\254\275*_\204=#\352\n\033\353p\354\232\256&\016\225\240c7\265\224SUGw\207|\304\366\310\241b\376~ \322\002l_&nf\345}\200\265\030\245\t@p\243\"2\235\256\234\203\337&pa\200\0075\273:\342\276@\002\024Gh\036\317\331m\332\"N\265\305\272\265mf\354\230\266F\352#\002\344g\nDS^\227y\004I\006\243\326\001m\347\230\267\255\210\220U\023\251k\202\004 \326\356\\\351\3614\264\005\235t\020\327Fwz\310\rG\361\030^`@\223\334\222\215;\352\342_\310\214\220$~\323\364\236e\275\337H\205d\231\007\031?\256u\226\332,N\2268kF\353\344#r\234\344\021a\034\345W\257n\311\307,\254\233\327\347bx\353\371\216w\004KD\341\235\350\361\277\244\320R\016\272(\347L\343\237\237\332>&\337\214H\035\261\000\262\003z\3301\004\225@~u\361\310t\263\3616\265M'h\227\367a\033\031N\353\206oA\023\037B#^\033\266>\036*\264#\263]h0x]\320\364\245+>\273o\306\275\233<\244\332\325\303\000\337N\317\356\274\245\255\300\017\316\3155\240\257r;\033\347kN\377~H\316\213\t\007&i6\202\\\320 \366A\016\213\3669\245\030h\255\250/(J`*X\252i\201\3009\270s\201\271\247V\235\3436\356\251\201\301\377\207\332$7\335\222\201\377RZ2\335\354\213\233R\216\342*\037\270B\355\317Z\003\237\030;~r\360M-\243-\3203\255`\245P\214\246\006\201v\367\001\002\217%\017_\020\353I]2X\365X\334\350\254h\225/@\253\307b\302\255v\035D29\206+\270\023\232\201C\037%\243\332\017\231i\237y\371fe""\026\tt\260\\\301[\307g\225,\324S\233\320D\343\022\254n\323\312 \"\204\227j\325d[B\235g\021\230\266L\315?\204I\304\343#W\030\253\270I@\257n(\260_\211\265\322\325\300\215\205\344\235_\005.MT)\026u\320\327\211u\340p7%:M\322\223P@\271c(.\243^\222\224\213)\227\236rF\252\207\252\032aE\201\255>\361J-,/!k\010VNjQi\353\tp\311\232\313\t\273\026\366I\336\340AlO\260&\n\253\205\030C\213\235\340\230[d\346Wl\347\262\n\315p\353l\013hn\214\346\317\2649R\213\304\032\356\2657\262I\324\346O\270}\310n1\276\221\n\356.\304y:\316l\312\255\244\271\016\240\303t\210T^\351\300\341\356\226\357\354!\036\247\274)\364\\\254g>\367\014\020\337\n}\271\335GA\277\207\376,\002\3203\003\2761\260Z\202\010\006o\342x%\307\271\345\010\225\001\007m\016_.O9\252/\336|\027/\201\016;\203""\222\205\200\260\372\376\217Q\206\246\226\343\345\342\275h\267O\232\336IE\312\0377&\215\013\242\243\300d\032\n\330O\332\242\345\212\322,c\233\262\022\214\021\301:\227\t\016>0X\343l\214\177\363_\006\373\240\370O&:\224\204U\276\004\273D\034\024^Uv\261\327\211\031\337\335\232,4;\233`\252\027\336*\241\330\364H{\340&\213\311\345\310#0/\305Je\217\350\240\000\255\202\225\223\207>\364'7\3726\240v\320G\357\224\314h\373\3610L\005\r\364\377\274\231\362{V\300gi\275\306\207\373&\013g{\204\033\351\343\363Z\312\341\205A\3613\221M\244\001\225\336\247\314\222\002\314\363\256fm\023\001\236C\016\031\203\337W\036\360(D\273L\037\220\n\276\227\310\250\"l(\335\337\326%n\312J\356W\272'\251\246\237\002K\323\360\016\243o(z\207\204\301\024\207U\336Y\326!\263\214m\243\024U\370E\253z!\225\032\241\232NB\346X=\222\274 \337\224\3610Wc\214\263\243\246y\032e\223\355p\2724\201A\252\216\356.\316\273\266\025\3366H\301N\324\215\313\322\211\004\274I@\221\215\017\241\201\310w{\302\302U\\<\217V\260\030\304{\240\2614\212\257\330\222\237 \320\216m\304\215\217\273\353\237\325U9\006\032\264{N=\267J\003~\201\016t/m@\203\316\323(\257\266\215\346qa\206\261\301\273\277|\201\367u!\200\216\300\326B\256\235S\227\342\314h\020g7\237dy\361\345\207l\373\320\002vi\346\tFt\320|\312,\207\264\303\312\315K\r\023\250\375\222\353\355\354\215e}\024^\204*-!H,\351\267\021\032}<\306\212\274%\016\033\334\327#6\r@~\227)\031\270\330>\321Ps\305\3313-\244\265\254\317\356\227)@\376$\344u\235y^\003.\325\333\205@_\372!\315}u\217\246c\274\231\225\214\007i\035\014{~\230h05\251\375\210\217\371S\246\374p\241\253""\3544\033\036\311\265'\000\272\234\370Qd\256\rr\241\020\362\212x\331h\031Y}^\216\260k\222\204\344.\025.rsbg\247\007W{j\333\342\330\361'V_(\003\277\260\277\217\232\3207\346K\254\257\353%\325\217H\022A\201\311GQ\236\346\336\302_\307\321\001y\n\213\001\"\363\212n\000{T\336\264\0178\321'v!)\240\370\"\247\n\243~\331\3479\273\327\214\272\0148\215O\360\376i0\270\032\014fA\276\030\032\320!\300\000\301\303\000-\017\346\200\327E\013\240=\221{2Z\245\255\222\027\262\002}\325\264\371\271!\376\357\301\356F\177\020_\372\261]\016\322\224\205\253\3342\026\300\313\006\334A{\372c=yG\324@a|\371,\210\375n\033cw\233\365\337I\236\014&\203\031b\345}nGMx{2\005\305\022\354i\201\375\025)\304\361bl\256=_#8*d\202z&\301\206\033\242mM\357\020DTI\020(\366\355GE\004\331 \234\335\004\\\025j\306<\266Y\371\202W\032\313\336\311 \351\323\361\341\320\345\257\205h\360l\257\372\037\310\030\257\323=\005\004\375\30588\310\355\355\270\206,5\341\303\214T\377\214=\250\016\000\346\221()\3522.^D\036\2343\232\320.E\270\"J\251\264U`F40\230G}\213\004\270\370\315\035\261\275\330\202@\352BvjD\264\305\312\317\353E:\r\021HS\363v\017'5\0003*6\304w\371\026\2224\247\262_\362H/0\021\361\241\"\316^\222\246\211,\230\236\024-\321\215Q\270\324\315F\177W\210\344\253\363\224\310=\204E\307~t\354\354r\003"; PyObject *data = __Pyx_DecompressString(cstring, 5428, 3); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif #elif (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (5302 bytes) */ const char* const cstring = "BZh91AY&SY.\214\221N\000\007.\177\377\357\377\377\377\377\377\377\377\377\377\377\377\277\377\377\377\300@@@@@@@@@@@@\000@\000`\031\374\302\276j\207wn2\327\333\323\323\312{n\324\212\274\264\247Mm\335\271\257K\273\215\022\255\214\200O\200\031\356=\314T\201\237w^\301\275\275:(\035\274\032 \017;g\273\000\221\"\"m\0040\203Sjx\002\t<\204\303B1C\010\036SG\246S\322\001\240\006\200\311\246i\242h\310\032\006\2314%!\023 h\320\000\000\000\000\000\000\000\000\003@\3204\032h\000\001\240U7\371I\004\024\323&\206\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000I\251\t4\001OE=4\305\023\311\250?Ti\265\003\324\365\000\006\215= \320\000\000\000\000\000\000\364\232\000\"\222MOB\233I1\352\217P\363\"\232y=OT\363OPP\3656\231\020\017(0\324\003\324\036\243\324\365\003\312\036\024z\200\3612\200\017A\022D\320@D\322\237\212\236\230\322\217L\246M\242<\246&S\312hh\032\000\000\036\240\000\000d\3204\0004i\327\006\013\005Ty\200\352:z\022\251\362(\275\017n\326\3053\241r\305\026\023*;F\351o%\276xS\013<\254\352\034S,\350\350\275@\317U\354\210\337\0026\310\024b$\301\2444\244\251\333xdkW\2351\325j\267\373\273z\006v\3543\0074\372M\346\346\325oN8\3340\211\"\003\036\277\317\300\340\002G\016x\215\003\304\340\253\341p\322\277\217n\356\326\315g\rD\261E+\231\330\304\231[G5\236\217\245\252\272;\0140\326\035_\nb\330'\333\233'qP2)\001;\n\022\226\302\252\314\222q[\214y&\366*\253\330%O\357\342\204\017@?\304=\037\363'\372\264\260\266\310\364j%\213\274\022@\014\3156\001\250\004\222\2233\200X\001\200\343\213\305\010/\376\251\201\302\346\206f|>\342\200^\324\006\252\007\334\204\020\201$\030\033\2663A\023[w\036\237t\n\0205]\005SX@F\"\250\212g\211 \0305\311\262`\013\3500@\366`C\334\260\031\010<\315\252\240\200f\206E\006\302\231\3638\206\360\336\316\023y;\035\350\262\326\251M\322\232\275\357\214\241\014d\000\216\006L4g\214\244\265b\031\337<\250\234\224\334\206\256\361Q\256\\\205\271u|\350|!GPq\023q\277y\303\231\304^#\274\3219\006\241\247\335\035\3407\206\\\303e\010\032\220S-\327\007qr\352\345\323B\226\021\357w""\3642\206\212\231\030L\257\306\300\232\347\232\375L\215\303\310\350\016\361\273\226\270\3252\334\027mJ\341n\225\345G\007\220}\027\362\315tu~\330\20161\242\205)\350\206\255\0377\tO\317\236\033\350\017\315`X1?\213m\220\024\002\tm)\010\201\272\010Q\035#R\222\236\024R\250(\373\215\374\016\303\247\305\243\3131\355\352ov\2673\330j\361Z\\\320un\332\2275>\327z7v_\3132\336\306\027M\340\265\357\\\233J\335>-\276\265\372\302VF\n\275\20749\230\244\254\250\027\256t\031\257Q\316p\200\251\220\337\254\243@\336W.[@;\343\245\254\203\210\250ui\242\3605\345\336+mgQZ\035\244\244\233\365\306\203\264I\000:zT\003\227\016f\016\363\353o\315\206\334\314v\327V\376}x\340j\3235\r\3232%z\027Kd\347\267\360\027u\342\334\233\246F\351mZ9\232\3247\014i\317\216\021\233D3\032%\265X,\252#\203\227\356_\212n\302\354\343\007\276r\023t\341\020\347\246O\372\234S\302M\373\251R\255M\272>W\020>\337]\360Y\243\016\241p\367\337!%\322\346\017@G2\353\000\372nQ\"\264\272\364N\207:bgR\230,\303\025/\226\031-S+?@\3216~\377s`\035o\277\337\343>\221\236\333\216Z\232\224\027\311\20044.\005\370Q^\305j\313\\,LL\230\370Wr\027\n\235R\315b\260\227ta|F\023\277\032\266Y\246\262\332n \207\232T\314\211\220\347\002=\006\365\316Rl\204\004\274\222q\007,\310\255b\010\201\230V\323m<\315\205.: F\366\332\331\002\225\326~\243\206:\362\220\234\257\253\036\320\220+\035\203\r_r\3128\014\365\254\264\337s \2006\262pUS\214DD\254\245m#\377lRQ\333T\243\304\\\315\200[\203\023\211T\"\n\252\"=\331\264\331!\r{7l\017\203\351z\347\\\035z\261o\340\250\253\004Z\264Z\264Y\273\217o\243\212\037;\3704f\254+\261F\201\241\234\274$\001Sm\r\202m\010\n\"\005\251\326`)\271\304\035J\"\355\354\227\322\337\n\253\357\374\275\034\030\320\261kxN\304;\034\303\016\023\302{I\355\272X\2643\205\345\264\033T\r\324HU\314+\206\256Y-r\222\202\344\226\307\331M\306\r\373\212\263\303t\242\237\313\371\233m\266\353\245l\260Z8\252Y<-\355\037\253\333\266\2164$X\003a:^\203\251l\031#\352\340\356\357}|\203\257W\001d[Z\317\325\272^\301\013\327\224\356\024L\233\031'W\311\261\356`\354\000\351""\346:\001\321\315\370M\302\211T*\242U\360j\206\221\200\\\331R\240\326\253!'\337\314\337\323? 8!\324\367\227\305\343U\374\226\3746<-\266\337*\347H7K\274b\336\027\000\270\021\300\006\357\270\303x\372\003\370X+L\313\026\326\025F\311T\245\362\245F\326\223(_hIj\247\177\031?_\221\361\275\262)\304\022\221\360\311%\3447\007\177\361\007\343\345:&\336\210\3551\026;m\261\261\263\330LhN\204\002\255\271xKqn\026V\366\2139\256G\231\223\\\354\367\205;AT)\332\262\257\0143(\t\312<\276\353*\252\252\253\001\223\r\204\311\240\236\303\001\030K\351p\005\341v\262\341W\216\035,X>;/\263\276\247[r]r\305\211\320\254\230c\207c\316\310\330d5\002\277\227v\033\017\004\244b\234\334\332\360\216Y\212\242\201\201\272\021QZC\245TE\021\024)\265J\013\332\262i\013r\314\254(\242\224 dKTX,X\242\212)N*Pb\325\223H[EJ\301;y\227\216]\021\215\270\003\351&$k\303\233\217\265\271\276&|*\274\204\227a#?\250m\\\212E\300\344dx\006\000\026\313UYZ\326\305\373\002\252\330(8K\353\201\254\010H@]\362k\035S*\330\033[\2049\226e\023\341\265\021\023\365h\205E\202\276\376\242EEf\273jb\211\326\322\331\256\252\371\337b\256\316\331DY\326\310LZ\251J\201!Q2wS\016VnX\222h\255 \257rQ \306\267\221\265\034\232\275\353\212g9\323\326\351\2301\035\200\300\224\302|\027\365vi\322t\t\357\353U:C\036\362\275~\"!\303L\246F\340s\241i\347\034\240\026!\016M\247\351\327}iM%4\226|\347>\330\034k\342\352V\363\362\317V\361t\326\322l0\006\366\274\222\006\201\260\251%@H;\000\273\002\354 \347\\\371\253mkJ6\254q96\324A\020\341\267\016\024c\306_\236\334\224w91\330\324t\347=\351\231\256[\312A\212\213\240N\313#\210\315\331\240Z+6\340Dy\215q\264E\303\030H\250\256\235\306o\232q\000\256\340\242\236\320\273\272gx/\210\010\245\233V\233m\272\n\032Nt\016\326\347!\010\306\227wry\212>dmj\205\317\212\255\n\263s$=\370\216\232V\225\246\022BS\021%K\2558\"\"\222\207R\343\274\033\346\030\013\3521\255\335\257,\347\270+\300`h\026`\351\242c@\306\231\341\306\220P\264\\\222Gp[\036\221\333c\202\010\252*\275:\252\346\022\006\256\332\252\367j\225j\251j\253\301\355M\014\244n\0348\347yL""|\030\362h\335\275\257\232\027T\234\266\362V\364\344*\323\205\312\2576\r\267@\363\n\020\336y\323\230sO?In\035\034\317\210>t\016@\035\3659&\r\333\374\376\233RK\004Z\263kJ#!\335%\252\327l\367\3346\305\233\331\263\2272\322nd\\\331;\004%B,q\355\023\t\004\212$\242\211\335\337\327\247\343\256$X\005\270\267\2400-\345\240\256.\027,<\334\322,\007AQ*\303\276T\006\363\325\003\030\004\364\301\326t\330\013\t$P7$\201\206EA\354\010\004\002(\004\010\244\002\006d] \213\2048\322\270\207^\270\303\225\251\363i\230\032\214P\311\200\241\205\210$\322\336\340:\222K\271)\246\3623\023\267^'\222\327Jt\316\275\271\021Wj\252\301\263\305L\251:\265\245\244\356\203\361\327;'(hf\007i\376\347Iq\016<\377\351Cd\177\346\303X\n\016II.\200TV\001\316\301\"!\010\004\033?\326\262'\246\250\032V,<\274p\204\016\334l\212G\326\336z\007\343\3657\210]@\0354\t\314\002@ \257x\n\000\373\320\260?T\007\304\006\\\014\001yOB\266%@(Np\226%\202L R[\\\2442\214\244\317@\360F\255CEY\270\333\004\200\307\r\255|X1aP\273U5\365\033\330\220\261B\313\037\221 \272\222\232\320\\\010T\006\316\374\211]\235H\330\004LC\200=\214\226\3213N\375\005m\214\321\342O)\272\356\250\231\231\306{4f\227\320dj\t\275s\034\303\247\247\250\357\346\030!\340\203\rhvK\022\365Gi\020\013\241\226KE\214\252\320[*\324/a.\302\\\275B\004\251\205\244Q\251(\252\221.\030\n\205\206\311!jR\300%\353+\236\350\022\254|\005\001\036<\352\214\362\310\367CS\275\024\017q\023&\014\004 \244\210(H\221(\233\340\303u\r\2645\364B\306O\006\021J\304\003:L\267\364\327`\370S\250|#a:;\234\265\013\2364\r`\223\303\364""\365`@\233\204\362a\026\373\251\336\230\273R\204\264E'\255\214\244\251\004\244\027L\363\"C\006\375;\274\301\262)\217\200\013f\207\003*XQ\27102\r\020B\343&\242l0\244\030\260\301\226\014\250\r\206]ErXM\216\205U,\020/\0254\200\302M\0359\007Vx\311\342\320k6\001mi\"I\021b\222K\310J]\303A\345\332\204\014\210\200]\240\016\377\211\035\360W/y\037Q\340g\243`\365\207\270\016\361\322\254\030\031\242x\300\3313\347P\211\302-\004}DL` {\306\214Y\020\2216\326\371//#\350C)E\240}\360U:\322\271@r\205\3375\215\013\207\274\033\017\230\016\307\241\202s\030\204V\252\252\223\270\351\372*\273\371\034\257\335\363\325;\037\030D\013\"\n\355^D|`i\274\023\230\006,H\241 \004\3524Z\313#\214\013\225\0138\003\013\233x\033od\013\200t\252+z\375\261#\210G j\\\201\334)\024\230\331L\004\001C\224Q2i&\373[sx\004\2300\002e\332D %\222,\302\261&\355\000IU{xk\237h \232\305j\252A\222FR\"\254\"\010P\301\002\271,W\264\370\237XHB\010\310\0022\t FE\\\001\221\337 \035\034\327\000\314\242( \202L\373\245\301\272\241\341fD\026\034\336|\232F\274\232\355\022\277\t\206\304\366\026f\370\351\326\270\247A\256\201y\035\"\017\253\346F0\r\370$Y\tz\001\314s3\366NH\034\003\207\227\006i\002t\253\266\305\230@\205\302\202\014A\032 \215\321.\2760\266,W\257\300\242A\307\302Ue*\023+w\255\235\2533*C\322&Y\027\313(@2\000<\272\026\3638\200y\263\312\223c\233\230\034\303\267\207\003v[HD6\323c;\000\364\001\226&\323\241\310\200d\252\252\252\252\252\332P:\214%B\032@\277\235\327i3\006P\005@=\213\241\240\320i3\3316v\006\304\240\257-\246]s\253%\023\3033B\301\010\030)\026\263\272\220\010\00594\206x\306\017\213;X\222\n\004\022B\021Ub\004o\000\232\241w\215\207\202 \013l;\267r\360\221\302\031\206A\202`\201q\211\020\325\210\001\236ap\324.\025\001\220Y\230F\200\327]3\317\\{`]41|\367UQz\033\005f\003.FF\032\253UTD@UB\300Y\265\211\n\252!\t\n\252$\330/\245\246\344\\f\036C\345j\252\233\266 j'\317\010)\324\006=7\306\211\377|\317\002t/}+Z\372X\333,\266'_\316{w\004\201\326a\033\350\253G\266\032\333x\346\007\025\274\361~\033\021\201\204\355\353\345\271F\312pE\250\222(\021>\237nR\352\027E\337-\016\351\224\225\347\177\203\353\366\370\276\337\005:\304\010\363Ww\244\"\224\004q\321\347\370\363\021\363\304R\240\201RU(\301H\373\0377\264{gq\353\276\033>8\231>\250P\303\340S\016Aq\300\371\003\303\322u\006C\022aQ\326\262X\0130\355\335\271\252\251\206\245\254TFjR\240\033F\257\177\030\217\332\310\021\204\210\n\250\237\223\336\037\270\237(H\242\261\021\201\252\nC\034\210\372\341\230\037N\353\312\213l$*;G\024\000D\t\363$\030\252\304\"F\337\346\222\017\220\370\024\251\261\306)f\r\203y\3336\022\220\332\221\031\346\241\270\001\230n\206\231\232\037\357\016\273\270\226\243\022^\242J&\342\017\277\274C\307\006\310\200E\241\303\343\265F\304\211\230\213r&7\223\356\346\220\241F\367)\030\205\245u{#\212W\364d\312\010\236\246\"'\316'\255MH&\321S\367\010RT\334\203\307B)`\036\271\273\366\250\321(Y\263\203\375\355n\375\024\215\303#\337\322\022\375$\005\260\362\312\016\241\374q\365u\347M\340\320\023Ag\0304*\363DFM\271,\223%\234>\271\313\311\223\220L\237\215\344\360\007g\342\3333Hb\227,&\023L&\031\204\220NeE\350\002\020\377\264\226\2566|pBR\032\331a\303\037\375\002^\212ay\244\314\232/#M\243\341\356\310\220\305\350\010\376k\272\007\022\343A\211-]\356%\"\"\031\350\315{\305}\020\003\026\263J\350\177\266g\357D&Y5\022\027{\344\016\366\247\353F\251\314$I`K&]\016$\206H$}\205\223\333=c8ND\020\016h\367w=>\363l\315\374\tMh\0309\340G\227\322\036\333\033^=F\245\240zb&\236\244N~0\355p\352\023\2208\327\243\3316t\353GfM\204\324\302s\237\213J4\267\001\n5\377\305\253OZ5\316&\032\226\223\331\037\375F|\261\244\2240\211-\2602f\314\2103t\221\231\231\200d|\350\014z\273\271\"D\0032\375p\267\223\355\260\014\275W\364\013/}\345\314\023\227%\341f\312\321\006r<\200d\352\347p\213k/(\021\350\213&Xp{\276\341o t\340$\376\025\214\372\270\275\206bPx7\372\037;\345\337\303\346\365z\030~k\033\275\253\335\277""\361mWjl\2141\030\010$r|\200U\275\010\362\351b\214H4\210\315Ywk\031XH4\364\246\352L\201\364\274\222\320\255$%j\356eh\3239\210\033wY,p\0071\266;\374\004\243B\007\226\037D\220\350<&\304\213'H\375\005g\230}.\035\357<\333\270G\365.w\302\265\233\007'_Q\362\034|\274\376\002\375X\261F9N\354\347)\343\235%\024\023\236:\325\250\242S_\231\232\241\217\022qG\222\340\213\001\202\t\331\200ml\326\313\024\343%\002I%\024\010\337%\014\273\251\303U\005\002\212J\206\003\n\2243\030\325\245\364\n\215\351\304\013\303\020\312\331\343\3316\326i$\300\206jA3\246_E\026\323\247\"\300\241\204\246H,\024\212((#\243\014\340\201%*\tk\030\222Hd@&&d\234,Q\2715rl\316\205#wSd2\001\000\243!\322\212\223'\r\320x\256E\331\311\266\332\233\252\307\000\332\t\254\010]\272\n\3327sb\252\324\344\333\246pe,s9n\203y4\304\233\030\t9-Y\013*\361\333\026\356EM\245X\313\272\251\245N\305R+\017\375\377\213\271\"\234(H\027FH\247\000"; PyObject *data = __Pyx_DecompressString(cstring, 5302, 2); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (5555 bytes) */ const char* const cstring = "x\332\255[\317w\333F\222n\275\350\355\310Y\315D\264\264\216\354q\034\310\366\304\226#\313#K\311d3\312di\211r8\246e\211\240\343x7\033<\210\200$L(\220\004@Y\332Iv\366\250#\217<\362\310#\217<\362\250#\216:\372O\360\2370\325?\000t\003\r\220\362[\275g\211\250\256\352_U]\375}\005zyK\267j\246\241\230G{\360\3331\335V\315S,\3333\017\034\313;U\252\207f\365\347e\246\343\325\225j\335>6\035O\331P\\\317\261\354\003,\3339\365\016\3536\023p\272\346\211g\332\206r\340\350\215C\345\215\345\035*\233\216\376f\247\246\333\272\203\265[U\257\005\003fZ<{\274\252\232\272S=\034\333`\365\262\006k\227\323\177\321\362L\247A\026\2017hL\253\235l\203\206\351\354\327\235#\346\205:<\352\236U\2679\r\007:4\035\252`\260\215\337H\356\271Lm\037\032\225{E\373X\257Y\206R\263\354\237\301\301\206y\242\300\220J\013?\177\235\332|\314\232\267\353\266\271]\367L\305;\324\301\373\324\343\226\253\030f\315\332\303\2635kdiV\025v\007+\331\312Na\347\341\332Wk\212n\343\270\372\233Y\365\\\305m\355Uk\272\353\232\256R\337W\366ZV\315\263l\305;m\300n(\305}\345\264\336Rl\223\355\t\350\361\006\336\241\tAfz\370\203rO\267\355\272G6I\003sX\351=\305\260\034\030\304:6\261\365\226^s\315\345\227\266\276W3i\3406N\025\335\370\233^5\355\352),\323\205\351\354;\365#\334\350\035\302R\210\267x\013\307\204e)\016\314\037\264\306h\245\236\266[G\232i\034\300\204\277Q^bg\324N\261\037\016\032Z\024\375\332S\323+\200\316N\335\265\360\022\356/\302\0165\352\216\007+\337\007_Bt,\217\262U=\335\361\336\307\260`\033\2275\373\036\216\274y\362\276\263\245\326\3575_j\2322\343{\313K\312\267\272ah\020\t\346b\340\\\217\034@\255\005\333OB\217D0~\330;\305b\341)h3,\027\373\325$\336\275G\0060\215er\000\366\254j\375\250\2418\365\272\227\020(e\260=\250\302\254\363\206\201\267\026fIm\277VZa\244\300\014\025\034\020\312\375\326\222r\274\010&\367\301b\243\006Y\007\333l\325\364\203\"I\252\246\301\331[\354<\022K\023\217\303\331<\327\235\237\307\327\256\300\361\032W\367{\013|<^\327\251\223 k9Q\2169\335\364nc\312\260\265\220_K\246\356zy\273j\272^\335qC\253eN\243\376\246Q""\207k*\336h{\216^\365R}Qe\n\342j 5<\305\007X\350k\323\254\231\236\231\332\223A\232\205~6\315\206w\270e9\256Go\024\251]\220\3517\267T\005R(M+\330\270\325\220\314\341\324\326\217\254\352\345\243\253`\273pB\260\321\206\336\320\253p\357\204\306\330\010gQbTe\255X\030\232\321C\2274\304\321\177\000\351\325V\352\016\276d\260\001\271\350^A\336\323`A/=\253\346Jg)\201\002L\235\273\017\241?8\362yv\214c+\226\205\341hm\370\3352\311\304\341\322(\321\303N\r\237\220c\\\206S\274\005\227\000\314f\343\320\252e\004h5\264\014t\261]\324\213\314\322r\274\226^\013z(G=\320\213\212d\322\021\353\303\353zr\212g\236>5z[\037\217i\223\272#\227LF\314b\254T\304t\307HDLs\2744\004\312\344\270\2459\237\337\236{T\277\210\037F\246!P,\351\343\365\313Y\360Ik\254!X\016\033Gw\314d\013\232\333\246up\270'\235Al\357\266\341Tf\2352\272\300H\177G\007t9\326lw\034\363\3702=W\336Xc\234\005\232\227\336\377\330\215i\2173s\025\037p\356\314\2170\345\024\307\274\350\276\263\014\226g\245\371\362\020\232\003\013\320.\032\260\361\326\376)\266\260 \300\2446\026S\n\206(\332Vx\246\335\021\273\213u\323\364\304\211\027m\027\236S\257#\2134Kn\244\242\233\271\351U\200j\226\201\0215\217\257\2021]\360I\3051\3154\217\2133t\201\250\\\332@5\033:\2461\306\350\253\000\022'\321\010\254\337\333t\333|#\\\367eS'\267\212JX\235t\177\201u\030\224\266X6\340\240\200\0002c\361\256\266l\312\374H\243;v\n\036K\027S\266P\035\362]V0;T\203\355\301\262h\223\032\316\314\312U\364\032=\313X\023\037\014\010s\305h\221\342\003\260L\nc\030\254\203+U\301\244\225%hz \254*\345\3220\256z)x\241\276/\274\030s\030\333|\203\233C\233,X`\004mci\307Vqi\020\241\276\037\210H3\213/\364\222HC\275\004\322P\307\016s\3652A\256^\006\226\250\227\200%\307\231&\260q\2418TL\2050\304)\340\020\2420Z]\310\201\352\245\021\217\334\002f\034HC\2651\261\213:6v\311\326\224\364z2\346q\037\245\t\253\013TB\233QXg|M\350=P\tm\306\305\023j\335\361\022\351\024\247\274W\016\330W\352\211+e\377\022%\335\214n\202\331\274\301\355\317\353\006\233y\232z\275\345\301\255E\305\270|\270\375\262T\312P\217n\003""\322?\343\217\230\300\212\023\033sB\240V\337\217:\301\027\343\017\365K\025a@\242\264\356\271\261B\"\2513\211\345\247c\246|\234P^\306\353\266\001\334\350J\324\271TH\317\333\262\345\322\272\224a\343\252\303\276\216\013\364\232\346\230F\253jj\032\\\205d\203\354\272\375\0206\345\330\002\344\253iU\013\000\235\246\205e\352G\373\255Z\355\021-64NO\024\367\260\336\002\024\202G\334#9\203\342-\330\035\374\031#`\017\320\323\362:\335g\267\336r\252\346_\210\037\016\255\352!)\323\276\261\334\303\240\226\200\215hr\200\036\360\322\377~\374+\245\371\270\014\267\310>\262b[\276\242\0256\237\026\264\215\374N~\243Xy\255\225\212\317\213\025,\332*\345\237j\233\305ra\243R|\261\255\025\267_l\227^K\032^\274\254\004-Z\345\365NA{\222\337x\026=m|W,mF\217[/\312\257\362eN\260\375\242\262Y\330*n\0278\331N\276\\\330\256D\317\225r\241Px\376\244\260\211\207V\265\315r\376\325N)\277\rZ\221\020\246Q('\244\t\201Z\310\2277\276\203Y<{\274*\025\257\312\305k[\371\222Z E!\362k9tz\225\234NM\013\304\340\002\327\003\000\032k\210\352\222\341\263\264\352\230l\245\031;)\307\227eR\312r\224\330 \353\"\241(\253\366%Z\203J\037\327\020U\3718a\3434\037\034\264\022\256\356\013M\3346b\t)\336\227I\355~DK\341$l\213*\202\234H,\371E\r\262\262{FkP[\317P!\005\364\224\366\260N\236\331>b\020\256N/\323(\223WK\225\372\026\344\306\254v\232\305\237\306\013\233\221@(j\206b\374P\264_\272\242\004\230YL\210\337lEO\211:g\254I\254eF\215\311\272\245\264-\\\235\2545|7)m\\\315j\\Ko\023\337/\3124v\022\215[\220|)\0370\305M\305\r\202 V2\345\345\362\212(\257!\257|\n\032\001)\341\205\021'\210K\023~\221\224!\343m\261\304\302\225\026\343\262x\272\341\313\205\274\220|&\325\017^Jp3/\010p\255 \343S\227\320\300\262\026/{.<$\226\261-<|/<1\264+\312N\022\323\241\025:A\302\000%/\303\3256\376\231\236\221M\363\000\256\374\244<\335\331\264\275h\247YB$K\232bN\301\2050a\202Qe,\024\305\313_Q\003_\342\022\244qIP\264\212D\256dQB\241\211\223\306,\023\356\210D\301)\344\233\204j\224\330\020\357XR\207\022\233\343;Cd\264\340\231h\312\352*\241,\357\004\302\330t\236\324[4""\213\250\020\344:7a\261\325\225\310\203+%\315.\341Q\256)\232\220\240\201\353\\\302CT1\343\304\256$-\020)y\212O\210\325\243\004o\010u-\231T\230\225\232\222WUYNT\2459Q\315\310}\2524\367\251\222E\252\362\334\247\312r\237\032\317r\252$\313\251\211\\\245J\022\222*IH\252$\375\250\311\014\300S\327PX\201}&W}\231|#\251\030|!)Tx\331hdD\246\330\352J\344\362\310\024\333\205\031qM)\221)\034!\021\265\010M\tLC\310\251\370\224\200Q\022\242\272\275],\001E\"\344a3\377\244T\000b\363\342\031\376\246\316\213g\232\266sz\002\3776\255\252\247a\317\224\315\375r\245\374\262\360\252\014\\K\313o\376\265TT+\341\303\363|\245\\\374\201>>\375RwO\355\252U_\256\326\035 \354\226m\272\264(\257a\222X%_\t\323\3507\305\252\300\351L\315\2625\014\310\315=\275\372sX\2504\315'\346>\034\025Sk\261\257]\000+f_\271 _O\")\332\214|L>\262~\001\304\003u7\330\037\2148\267\365#\223=\026\355\260\206\260\317Z4m\277eW5\3709\010\270\220\026\321\2374\342\223\244\322\0318f\263\005G\300\340\257&\n@\035\323k9\220\370j\373\244\274\316\366\005>\26170\\\321]\223\024\340]\247J\226\356z\016}\205\242\321\267l.\036\332t\234\272\243i0>t\023|#\004\376\0060\027>\022c\315h5\202\327\271\354=;~#\335\"`\372\230\274\356u\351[\300c>b\010\302\016_\177\221}\334Q\356\323\277\213(x>\256[\306\"\202\270\210\232\262~8\305%\245z\250;\312\203E\271\370\301\242T\272\204\377S\211\264I\326\022NI\"\225\351\023\311\245~\342\346Q\037\322\226\224A\023\n\2434\306\350\254e\273\326\201m\032\262\016\3056\354\303\240\r\373\203\177\026\237\344;\224\320\210\251\311\333\003%\016l#\372e&\224F\177\220\204\377 \031yA\022\272\202\344P\033\245am\224\002\266Q\n\332Fr\270\215\262\3606J\001\334(\tuQ\034\2272\301s\366w;\370\373=J\303!\311\006\027\245#\021$\205\"(\013\213\2408\204@I\014\201bw,J\273I\223\r1\335\304l\223\227)\312\272MQ:9D\014N\241\004\254BY\274\021\305o\325P\200\244\274\034\361\304\034e\240\r\024c\371H\316\330\221@\331Q\032AG\231\014\035\245St\224\316\321\321\010\222\216\262X:\342I5\222\322g\224\302\237Q\026\327DYd\023\305\330&\222\223I\024g\223H\244\223(\301'Q\214P\"\216A\"\221B\"\t\207D\"\211D<}D\"aD\"cD\274\230\236\361g\260\316\213\376\312\305\034\214\327[\353\3752Xy;=\333^y;\365\321Y\323\237\374\274\267\202U\347\333\277D]\371\223\260\236w7\310<\036\367\027\372k\375_\206+t&\267\333\371h\240w\377\202\256\314\004\235\314\221\225\204c\204\302\351\263\2653\257\375Mw\242\233\303\226\017:\371\213\231\377\030N\014\261u\356.\033\0246\010\246\371\356\226\\\375\253\301\304\200\0146\337\376{w\241\273\326\375\245\277B\347\250\310\r\326\007\371\301.6\230>\373\242=\345\317/\372\213\353\376\372\266\277\375\223\377\223\026j};h\016'\360,\224N\263;\331-\365?\010\272M\231\366\326P\0376\261\301\203^\256w\267W\033,Pup\342\255\316\017\335W\275|\017\034\266\334\323\337N\315\372\263\177\350\356v\215\336\222\377\345_\317\357\234\013\376\3036\267\361\020_\267\177\350h\376\3227\203\335p\214\37407\\\300S\277\323\205`\202n\356v\363\335J\357f\177\267o\017\237\235\273~Y\275\230\376\350\354\327\316F\247y13\327\316Ch\314|\332i\276\025\2742}\366M\347\203\316\212\350*\342\343\213\251\351\263\374\031L\363\343v\363b\352\312\005\204\302z\347MW\357\302\023\356\226s\357\333\3319\177r\261\227\303\361\021\306\270.\215H\25453R\013G\004\216\252\316\255n\2637\331+\r&\222j$4\302\260\374\360\342\267\037\235\271\355\273\376\265U\210\302&~r\332s\376\277=&c\314\335\013\372\341#\032\037\253y.v\233\222\271\204\221\013*x\034\034'\223\355\022x{\266\273\321\365\374\317\3772\320\007\315\320)\177\036\254\014\362A\374\355\331\246?\363\260\267\333#>\304sX\207\3431\021M\364b\346j{\301\237\305'}\005\317\345\343\266\321y\010\216 \316\\o\273\235\205P\227\356\333\024[\330\355.\313J\271\331\366j\333\360oP\237\302\323\343v\005{\013\373t\376vp\302y\237\262\2748G\207\305\tfu\240\363\241\205\025\256\322\325A""\014wv/8c<\356U\262\377\324\270)\rN\334C\312\266\303\371\034\350\344\004\371\037\207!G\203~\224\243\300\002:\356\315\365~\034\260c2\227m\021:m\201Fr\212z\230\273\356D\t\021\253\337\310V\307\363Y\214\222\027^\363|`\201\335\374\001\364\345\365\326\374GO\206\013\303\225\320\234<%7\200]3#\315\311!\241aK\335\363\023=<\242V\020,\271\005\230\372\\\367\307\376,\276\026\204M\016#\221\273E\330\004\376\321\321;^\367\033\2705s\274\357\277\350\357\216\216z\272\260\360pR\253[\362AK\347\371\363]\271\005=\343_\366\365\2767X\0376\263\3168\336\370\333#\323N\356\342*\254\004\033qW}\376\"v.\256\216\354'\014\226`g!\024a\232,\257S\244\361\3430\227<\026$\223P\335[c\3709\270\037A\363+8\341{\235\311\316w0\037\331\202\270s1;\310\323!n\312w\\\330\205\020_\360\273\200\215\351\346\377\251\337\034L\016J\347\023Y\233\017JQ\324\247\234tz7\253\276\362\347\301J\022\266\010\021\212\273\273\221r\233\377\373 7\300\027\002\217\017\340j{;u\275s\235\036\\\177us\230O\356<\311\256\264\3579\262\262G\275f\177\262_\032N\235OH\323\027`\24444\024L{<\267p\t\226\366:?\022c\341\244\177\267c@\3322z\017\301\003\022\337\211\030K\350V\3646\354\306p\227\317\025\377\335\273\323\253\370+$\024\023\373\232\354\226\306\001n\277;\250\235/d\305\001(\215\025s\37024\372K\370\302\021Q\006\275\221\226\300\255\225\376\315\201:\234\340\035\002b\254\000;\312`\210?\tP\216q\000v\021Q\255\224\024\037^\343\177\010\020 UO\311\206\204g0\037B\210\3656\373\323\370`a\213\233Y\026\327\302\354\210\221\246pq\342\371\336\030\037\034E\034\002\306\205\331\277[\302\266_\266g\333O\000\"|\006Y#:J\030&.P7g)La\264\370{\266~u\360\233\201\033Q,\025\342\370iw\265\033\341\000\034;\225\363\034x\035#b_\001\310\323\317\207\356\306\253\241\030\225z,'=GX\353j\004\340v\351Jn\ngPv\002\t*j\257\320\016\004\344\272\004\256\230\010\221\353\347\004\200\314)A&\346Q\0168$\315W\\j\245\307\342u\267\332\233\363\037\222\204\025j\341\3647\2017m\344I\347\260\341k|\320\341\212\216\206~\357\364A5\014\226\014\216\360\366K\206\276\0332\315\323!\240\210\247C\222?\271\260\335\300n""\246\r\312\377K\010\371\327\243\256\337\014\253\3479\251\003az\355\315\316\004\201\211,\310\375\311\342y\216\315.H\003\325\341,&\364/\316\233\370RT\374O\361\025\001L\254\324\275\202\017\351[\350\032\223\257U\330\203\207=\267\037\240a\240h\021\034\235\346n@\0101\360\242\204\257\207y'\212\221\377\233\270\230\374\360\354\3636\330\000\275\014\3214\207\237El=\317Hh_\347\343\014\233\246d\2210\253\317\267\177\215\322\0166`\350\372\177:\271\316\235\316\217\275OB\230\303u\374I\207\350}\201\317\310p\216\322\234\220\210~\336\331\355\0003\376\264\323\352\302@\363\235\t\350i\021\023\322\\\373\023\334\020Nm~d\312\0311\313\261ls\267`>Fw\251\007\321\017;\315\352\027A2\337\245\302y<\304\377\262=\254b\010\217]5\217\357\363\377\352\375\006\322\301Dp\237'\310\035\037\\\030\023\262\305\315\221;#\000\321\037\014V\370\344\203\025f\262\024\340,\262\033N\210\306\344\210pv\000(\374\376f\007\"\365\265\377\372?\337-\363\274\373\203\301\027\303+\347\263\347\005\177\267\234\236N\371#\001\251\317\377#E{4\341\263|\027f\327\345\236\316\242\232\356C\216\212\256\215Q\240\311pV\310\212\204{\036`\374\030A\022\261\266\320\203:\265\275:\266m\356SB+\326{\315p9!\304_\221\336\037X\013|\374Yw\227\004E\310\006\222\260\r'\204\033\235G\275\\X\222!\325\230o\273\367\200\240-$\2521\027\270\032\003\263\177;C\317\364B8\026\227\233\330\002\177G\246\t\315=\257\277\222\0347ZK\347\023`D^o\275\1772h\312\364pgs#*6\004\261\205]~\030\253\321\210\365\033y\r\022\263\030\212rCn\232\034\346\273\363\211s\330_8\030i$\227\313\n\377`\313jR\203[\2275H\031!\342\301\274\001\234\2154\203\020\315\202\217\250;\326\007\314b.\333\"w?\342\331xF\343\320\364h\264\370zR\300vT\246\210\033\\\275\374\321d\023\235\346\002r\201\212\256\311\370\317|P\347H\272\032\343,\326\333\357\022\375\0131F\321T\020c\017\t\252\233\013\2312\037c\327;92\265\366\t\351\216U\344\037\300\005\3369\r\n4\027\243\256\356\033\035zu\267O\t|\333\375'4\244}\221"; PyObject *data = __Pyx_DecompressString(cstring, 5555, 1); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif #else /* compression: none (21857 bytes) */ const char* const bytes = ".Failed embed result integrity check.Failed to convert C string to Python string.Failed to extend graph with DrawPlanar structures.Failed to extend graph with K23Search structures.Failed to extend graph with K33Search structures.Failed to extend graph with K4Search structures.Failed to extend graph with Outerplanarity structures.Failed to extend graph with Planarity structures.Failed to perform embed operation.Failed to render embedding to C string.Failed to render embedding to file 'Invalid link index for ulink: 'Invalid link index for vlink: 'NoneNote that Cython is deliberately stricter than PEP-484 and rejects subclasses of builtin types. If you need to pass subclasses then set the 'annotation_typing' directive to False.Unable to copy adjacency lists from to this graph.Unable to create random graph.Unable to create random graph with num_edges = Underlying gp_DrawPlanar_GetEdgePosition() reported failure.Underlying gp_DrawPlanar_GetEdgeStart() reported failure.Underlying gp_DrawPlanar_GetEdgeEnd() reported failure.Underlying gp_DrawPlanar_GetVertexPosition() reported failure.Underlying gp_DrawPlanar_GetVertexStart() reported failure.Underlying gp_DrawPlanar_GetVertexEnd() reported failure.'., ?add_note) adjacent to e_u = and vlink = by e_ulink = by e_vlink = disableenable' failed. for bicomp root. for bicomp root R = gcgp_AddEdge() failed: unable to add edge (u, v) = (gp_ClearEdgeFlagInverted() failed: invalid edge e = gp_ClearEdgeMarked() failed: invalid edge e = gp_ClearEdgeType() failed: invalid edge e = gp_ClearEdgeVisited() failed: invalid edge e = gp_ClearMarked() failed: invalid vertex v = gp_ClearVisited() failed: invalid vertex v = gp_ComputeLeastAncestors() failed.gp_ComputeLowpoints() failed.gp_ContractEdge() failed: unable to contract edge e = gp_CopyGraph() failed.gp_DeleteEdge() failed: unable to delete edge e = gp_DepthFirstSearch() failed: unable to perform DFS on graph.gp_DupGraph() failed.gp_DynamicAddEdge() failed: unable to add edge (u, v) ""= (gp_EnsureEdgeCapacity() failed to set edge capacity to gp_EnsureVertexCapacity() failed for given order gp_ExtendWith_DFSUtils() failed: unable to extend graph with DFSUtils structuresgp_GetAdjacentEdge() failed: invalid edge e = gp_GetAdjacentEdge() failed: invalid value for theLink = gp_GetBicompRootFromDFSChild() failed: invalid vertex c = gp_GetDFSChildFromBicompRoot() failed: invalid virtual vertex R = gp_GetDirection() failed: invalid edge e = gp_GetEdgeByLink() failed: invalid vertex index v = gp_GetEdgeByLink() failed: invalid value for theLink = gp_GetEdgeFlagInverted() failed: invalid edge e = gp_GetEdgeMarked() failed: invalid edge e = gp_GetEdgeType() failed: invalid edge e = gp_GetEdgeVisited() failed: invalid edge e = gp_GetFirstEdge() failed: invalid vertex index 'gp_GetIndex() failed: invalid vertex v = gp_GetLastEdge() failed: invalid vertex index v = gp_GetLeastAncestor() failed: invalid vertex v = gp_GetLowpoint() failed: invalid vertex v = gp_GetMarked() failed: invalid vertex v = gp_GetNeighbor() failed: invalid edge e = gp_GetNextEdge() failed: invalid edge index e = gp_GetParent() failed: invalid vertex v = gp_GetPrevEdge() failed: invalid edge index e = gp_GetTwin() failed: invalid edge e = gp_GetVertexFromBicompRoot() failed: invalid virtual vertex R = gp_GetVertexFromBicompRoot() failed: invalid DFS child c = gp_GetVertexFromBicompRoot() failed: c = gp_GetVisited() failed: invalid vertex v = gp_HideVertex() failed: unable to hide vertex gp_IdentifyVertices() failed: unable to identify v = gp_InitEdgeFlags() failed: invalid edge e = gp_InitFlags() failed: invalid vertex v = gp_InsertEdge() failed: unable to insert edge (u, v) = (gp_IsBicompRoot() failed: invalid candidate bicomp root v = gp_IsDFSTreeRoot() failed: invalid vertex v = gp_IsNotDFSTreeRoot() failed: invalid vertex v = gp_IsNotSeparatedDFSChild() failed: invalid vertex theChild = gp_IsSeparatedDFSChild() failed: invalid vertex theChild = gp_New() failed.gp_ReadFromString() fai""led: unable to read from input string.gp_Read() failed for infile 'gp_ResetEdgeType() failed: invalid edge e = gp_ResetEdgeType() failed: invalid edge type = gp_RestoreVertex() failed: unable to restore vertex.gp_RestoreVertices() failed: unable to restores all vertices hidden during an edge contraction or vertex identification.gp_SetAdjacentEdge() failed: invalid edge e = gp_SetAdjacentEdge() failed: invalid value for theLink = gp_SetAdjacentEdge() failed: invalid edge newEdge = gp_SetDirection() failed: invalid direction = gp_SetDirection() failed: invalid edge e = gp_SetEdgeByLink() failed: invalid vertex index v = gp_SetEdgeByLink() failed: invalid value for theLink = gp_SetEdgeByLink() failed: newEdge = gp_SetEdgeFlagInverted() failed: invalid edge e = gp_SetEdgeMarked() failed: invalid edge e = gp_SetEdgeType() failed: invalid edge e = gp_SetEdgeType() failed: invalid edge type = gp_SetEdgeVisited() failed: invalid edge e = gp_SetFirstEdge() failed: invalid vertex index v = gp_SetFirstEdge() failed: newFirstEdge = gp_SetIndex() failed: invalid value theIndex = gp_SetIndex() failed: invalid vertex v = gp_SetLastEdge() failed: invalid vertex index v = gp_SetLastEdge() failed: newLastEdge = gp_SetMarked() failed: invalid vertex v = gp_SetNeighbor() failed: invalid edge e = gp_SetNeighbor() failed: invalid vertex v = gp_SetNextEdge() failed: invalid edge e = gp_SetNextEdge() failed: invalid edge newNextEdge = gp_SetPrevEdge() failed: invalid edge e = gp_SetPrevEdge() failed: invalid edge newPrevEdge = gp_SetVisited() failed: invalid vertex v = gp_SortVertices() failed.gp_WriteToString() failed: failed to convert C string to Python string.gp_WriteToString() failed: invalid writeMode = gp_WriteToString() failed: outputString is NULLgp_WriteToString() failed: unable to write graph to string.gp_Write() failed: invalid writeMode = gp_Write() of graph to 'gp_XorEdgeFlagInverted() failed: invalid edge e = in u's adjacency list and adjacent to e_v = in v's adjacency lis""t. is not a valid edge. is not a valid edge index.isenabledno default __reduce__ due to non-trivial __cinit__planarity/full/graph.pyx should not be the root of the DFS tree. to which you wish to set the index of v = {v} with u = ) with ulink = AT_EDGE_CAPACITY_LIMITEDGEFLAG_DIRECTION_INONLYEDGEFLAG_DIRECTION_OUTONLYEDGE_TYPE_BACKEDGE_TYPE_CHILDEDGE_TYPE_FORWARDEDGE_TYPE_NOTDEFINEDEDGE_TYPE_PARENTEDGE_TYPE_TREEEMBEDFLAGS_DRAWPLANAREMBEDFLAGS_OUTERPLANAREMBEDFLAGS_PLANAREMBEDFLAGS_SEARCHFORK23EMBEDFLAGS_SEARCHFORK33EMBEDFLAGS_SEARCHFORK4FALSEGraphGraph.__reduce_cython__Graph.__setstate_cython__Graph.gp_AddEdgeGraph.gp_ClearEdgeFlagInvertedGraph.gp_ClearEdgeMarkedGraph.gp_ClearEdgeTypeGraph.gp_ClearEdgeVisitedGraph.gp_ClearMarkedGraph.gp_ClearVisitedGraph.gp_ComputeLeastAncestorsGraph.gp_ComputeLowpointsGraph.gp_ContractEdgeGraph.gp_CopyAdjacencyListsGraph.gp_CopyGraphGraph.gp_CreateRandomGraphGraph.gp_CreateRandomGraphExGraph.gp_DeleteEdgeGraph.gp_DepthFirstSearchGraph.gp_DrawPlanar_GetEdgeEndGraph.gp_DrawPlanar_GetEdgePositionGraph.gp_DrawPlanar_GetEdgeStartGraph.gp_DrawPlanar_GetVertexEndGraph.gp_DrawPlanar_GetVertexPositionGraph.gp_DrawPlanar_GetVertexStartGraph.gp_DrawPlanar_RenderToFileGraph.gp_DrawPlanar_RenderToStringGraph.gp_DupGraphGraph.gp_DynamicAddEdgeGraph.gp_EdgeInUseGraph.gp_EdgeNotInUseGraph.gp_EmbedGraph.gp_EnsureEdgeCapacityGraph.gp_EnsureVertexCapacityGraph.gp_ExtendWith_DFSUtilsGraph.gp_ExtendWith_DrawPlanarGraph.gp_ExtendWith_K23SearchGraph.gp_ExtendWith_K33SearchGraph.gp_ExtendWith_K4SearchGraph.gp_ExtendWith_OuterplanarityGraph.gp_ExtendWith_PlanarityGraph.gp_FindDirectedEdgeGraph.gp_FindEdgeGraph.gp_GetAdjacentEdgeGraph.gp_GetBicompRootFromDFSChildGraph.gp_GetDFSChildFromBicompRootGraph.gp_GetDirectionGraph.gp_GetEdgeByLinkGraph.gp_GetEdgeCapacityGraph.gp_GetEdgeFlagInvertedGraph.gp_GetEdgeMarkedGraph.gp_GetEdgeTypeGraph.gp_GetEdgeVisitedGraph.gp_GetFirstEdgeGraph.gp_GetGraphFlagsGraph.gp_GetIndexGraph.gp_GetLastEdgeGraph.gp_GetLe""astAncestorGraph.gp_GetLowpointGraph.gp_GetMGraph.gp_GetMarkedGraph.gp_GetNGraph.gp_GetNVGraph.gp_GetNeighborGraph.gp_GetNextEdgeGraph.gp_GetParentGraph.gp_GetPrevEdgeGraph.gp_GetTwinGraph.gp_GetVertexDegreeGraph.gp_GetVertexFromBicompRootGraph.gp_GetVertexInDegreeGraph.gp_GetVertexOutDegreeGraph.gp_GetVisitedGraph.gp_HideEdgeGraph.gp_HideVertexGraph.gp_IdentifyVerticesGraph.gp_InitEdgeFlagsGraph.gp_InitFlagsGraph.gp_InsertEdgeGraph.gp_IsBicompRootGraph.gp_IsDFSTreeRootGraph.gp_IsEdgeGraph.gp_IsNeighborGraph.gp_IsNeighborDirectedGraph.gp_IsNotDFSTreeRootGraph.gp_IsNotEdgeGraph.gp_IsNotSeparatedDFSChildGraph.gp_IsNotVertexGraph.gp_IsNotVirtualVertexGraph.gp_IsSeparatedDFSChildGraph.gp_IsVertexGraph.gp_IsVirtualVertexGraph.gp_LowerBoundEdgeStorageGraph.gp_LowerBoundEdgesGraph.gp_LowerBoundVertexStorageGraph.gp_LowerBoundVerticesGraph.gp_LowerBoundVirtualVerticesGraph.gp_ReadGraph.gp_ReadFromStringGraph.gp_ResetEdgeTypeGraph.gp_ResetGraphStorageGraph.gp_RestoreEdgeGraph.gp_RestoreVertexGraph.gp_RestoreVerticesGraph.gp_SetAdjacentEdgeGraph.gp_SetDirectionGraph.gp_SetEdgeByLinkGraph.gp_SetEdgeFlagInvertedGraph.gp_SetEdgeMarkedGraph.gp_SetEdgeTypeGraph.gp_SetEdgeVisitedGraph.gp_SetFirstEdgeGraph.gp_SetIndexGraph.gp_SetLastEdgeGraph.gp_SetMarkedGraph.gp_SetNeighborGraph.gp_SetNextEdgeGraph.gp_SetPrevEdgeGraph.gp_SetVisitedGraph.gp_SortVerticesGraph.gp_TestEmbedResultIntegrityGraph.gp_UpperBoundEdgeStorageGraph.gp_UpperBoundEdgesGraph.gp_UpperBoundVertexStorageGraph.gp_UpperBoundVerticesGraph.gp_UpperBoundVirtualVerticesGraph.gp_VirtualVertexInUseGraph.gp_VirtualVertexNotInUseGraph.gp_WriteGraph.gp_WriteToStringGraph.gp_XorEdgeFlagInvertedNNILNONEMBEDDABLENOTOKNoneOK__Pyx_PyDict_NextRefRTRUEWRITE_ADJLISTWRITE_ADJMATRIXWRITE_G6asyncio.coroutinesbicomp_rootccheck_resultcline_in_tracebackdirectioneeBeforee_ue_ulinke_ve_vlinkembedFlagsembedResultembed_resultencodedencodedFileNameencodedInputStringfileName__func____getstate__gp_AddEdgegp_ClearEdgeFlagInvertedgp_ClearEdgeMarkedgp""_ClearEdgeTypegp_ClearEdgeVisitedgp_ClearMarkedgp_ClearVisitedgp_ComputeLeastAncestorsgp_ComputeLowpointsgp_ContractEdgegp_CopyAdjacencyListsgp_CopyGraphgp_CreateRandomGraphgp_CreateRandomGraphExgp_DeleteEdgegp_DepthFirstSearchgp_DrawPlanar_GetEdgeEndgp_DrawPlanar_GetEdgePositiongp_DrawPlanar_GetEdgeStartgp_DrawPlanar_GetVertexEndgp_DrawPlanar_GetVertexPositiongp_DrawPlanar_GetVertexStartgp_DrawPlanar_RenderToFilegp_DrawPlanar_RenderToStringgp_DupGraphgp_DynamicAddEdgegp_EdgeInUsegp_EdgeNotInUsegp_Embedgp_EnsureEdgeCapacitygp_EnsureVertexCapacitygp_ExtendWith_DFSUtilsgp_ExtendWith_DrawPlanargp_ExtendWith_K23Searchgp_ExtendWith_K33Searchgp_ExtendWith_K4Searchgp_ExtendWith_Outerplanaritygp_ExtendWith_Planaritygp_FindDirectedEdgegp_FindEdgegp_GetAdjacentEdgegp_GetBicompRootFromDFSChildgp_GetDFSChildFromBicompRootgp_GetDirectiongp_GetEdgeByLinkgp_GetEdgeCapacitygp_GetEdgeFlagInvertedgp_GetEdgeMarkedgp_GetEdgeTypegp_GetEdgeVisitedgp_GetFirstEdgegp_GetGraphFlagsgp_GetIndexgp_GetLastEdgegp_GetLeastAncestorgp_GetLowpointgp_GetMgp_GetMarkedgp_GetNgp_GetNVgp_GetNeighborgp_GetNextEdgegp_GetParentgp_GetPrevEdgegp_GetTwingp_GetVertexDegreegp_GetVertexFromBicompRootgp_GetVertexInDegreegp_GetVertexOutDegreegp_GetVisitedgp_HideEdgegp_HideVertexgp_IdentifyVerticesgp_InitEdgeFlagsgp_InitFlagsgp_InsertEdgegp_IsBicompRootgp_IsDFSTreeRootgp_IsEdgegp_IsNeighborgp_IsNeighborDirectedgp_IsNotDFSTreeRootgp_IsNotEdgegp_IsNotSeparatedDFSChildgp_IsNotVertexgp_IsNotVirtualVertexgp_IsSeparatedDFSChildgp_IsVertexgp_IsVirtualVertexgp_LowerBoundEdgeStoragegp_LowerBoundEdgesgp_LowerBoundVertexStoragegp_LowerBoundVerticesgp_LowerBoundVirtualVerticesgp_Readgp_ReadFromStringgp_ResetEdgeTypegp_ResetGraphStoragegp_RestoreEdgegp_RestoreVertexgp_RestoreVerticesgp_SetAdjacentEdgegp_SetDirectiongp_SetEdgeByLinkgp_SetEdgeFlagInvertedgp_SetEdgeMarkedgp_SetEdgeTypegp_SetEdgeVisitedgp_SetFirstEdgegp_SetIndexgp_SetLastEdgegp_SetMarkedgp_SetNeighborgp_SetNextEdgegp_SetPrevEdgegp_SetVisitedgp_SortVerticesgp_TestEmbe""dResultIntegritygp_UpperBoundEdgeStoragegp_UpperBoundEdgesgp_UpperBoundVertexStoragegp_UpperBoundVerticesgp_UpperBoundVirtualVerticesgp_UpperBoundlVerticesgp_VirtualVertexInUsegp_VirtualVertexNotInUsegp_Writegp_WriteToStringgp_XorEdgeFlagInvertedgraphLibinputStrint_is_coroutineitems__main____module____name__newEdgenewFirstEdgenewLastEdgenewNextEdgenewPrevEdgenew_graphnumEdgesorigGraphoutputStringoutput_bytesplanarity.fullplanarity.full.graphpop__pyx_state__qualname____reduce____reduce_cython____reduce_ex__renditionStringrendition_bytesrequiredEdgeCapacityresultreturnself__set_name__setdefault__setstate____setstate_cython__srcGraphstrstring_conversion_error__test__theChildtheFileNametheGraph_duptheIndextheLinktypeuulinkvvaluesvertexvirtualVertexvlinkwriteModegraphP (graphP)\000graphP (void)\000int (graphP)\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000int (graphP, char *)\000\000\000int (graphP, char **)\000int (graphP, char **, int)\000int (graphP, char *, int)\000int (graphP, graphP)\000\000int (graphP, graphP, int)\000int (graphP, int)\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000int (graphP, int, int)\000\000\000\000int (graphP, int, int, int)\000int (graphP, int, int, int, int)\000\000int (graphP, int, int, int, int, int, int)\000int (graphP, int, int, unsigned int)\000\000int (graphP, unsigned int)\000void (graphP *)\000void (graphP)\000void (graphP, int)\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000void (graphP, int, int)\000\000\000\000\000\000\000\000\000void (graphP, int, int, int)\000\000gp_DupGraph\000gp_New\000gp_ComputeLeastAncestors\000gp_ComputeLowpoints\000gp_CreateRandomGraph\000gp_DepthFirstSearch\000gp_ExtendWith_DFSUtils\000gp_ExtendWith_DrawPlanar\000gp_ExtendWith_K23Search\000gp_ExtendWith_K33Search\000gp_ExtendWith_K4Searc""h\000gp_ExtendWith_Outerplanarity\000gp_ExtendWith_Planarity\000gp_GetEdgeCapacity\000gp_GetGraphFlags\000gp_GetM\000gp_GetN\000gp_GetNV\000gp_LowerBoundEdgeStorage\000gp_LowerBoundEdges\000gp_LowerBoundVertexStorage\000gp_LowerBoundVertices\000gp_LowerBoundVirtualVertices\000gp_RestoreVertex\000gp_RestoreVertices\000gp_SortVertices\000gp_UpperBoundEdgeStorage\000gp_UpperBoundEdges\000gp_UpperBoundVertexStorage\000gp_UpperBoundVertices\000gp_UpperBoundVirtualVertices\000gp_DrawPlanar_RenderToFile\000gp_Read\000gp_ReadFromString\000gp_DrawPlanar_RenderToString\000gp_WriteToString\000gp_Write\000gp_CopyAdjacencyLists\000gp_CopyGraph\000gp_TestEmbedResultIntegrity\000gp_ContractEdge\000gp_CreateRandomGraphEx\000gp_DeleteEdge\000gp_DrawPlanar_GetEdgeEnd\000gp_DrawPlanar_GetEdgePosition\000gp_DrawPlanar_GetEdgeStart\000gp_DrawPlanar_GetVertexEnd\000gp_DrawPlanar_GetVertexPosition\000gp_DrawPlanar_GetVertexStart\000gp_EdgeInUse\000gp_EnsureEdgeCapacity\000gp_EnsureVertexCapacity\000gp_GetBicompRootFromDFSChild\000gp_GetDFSChildFromBicompRoot\000gp_GetDirection\000gp_GetEdgeFlagInverted\000gp_GetEdgeMarked\000gp_GetEdgeType\000gp_GetEdgeVisited\000gp_GetFirstEdge\000gp_GetIndex\000gp_GetLastEdge\000gp_GetLeastAncestor\000gp_GetLowpoint\000gp_GetMarked\000gp_GetNeighbor\000gp_GetNextEdge\000gp_GetParent\000gp_GetPrevEdge\000gp_GetTwin\000gp_GetVertexDegree\000gp_GetVertexInDegree\000gp_GetVertexOutDegree\000gp_GetVisited\000gp_HideVertex\000gp_IsBicompRoot\000gp_IsEdge\000gp_IsNotEdge\000gp_IsNotSeparatedDFSChild\000gp_IsNotVertex\000gp_IsNotVirtualVertex\000gp_IsSeparatedDFSChild\000gp_IsVertex\000gp_IsVirtualVertex\000gp_VirtualVertexInUse\000gp_VirtualVertexNotInUse\000gp_FindEdge\000gp_GetAdjacentEdge\000gp_GetEdgeByLink\000gp_IsNeighbor\000gp_IdentifyVertices\000gp_AddEdge\000gp_DynamicAddEdge\000gp_InsertEdge\000gp_FindDirectedEdge\000gp_IsNeighborDirected\000gp_Embed\000gp_Free\000gp_ResetGraphStorage\000gp_ClearEdgeFlagInverted\000gp_ClearEdgeMarked\000gp_ClearEdgeT""ype\000gp_ClearEdgeVisited\000gp_ClearMarked\000gp_ClearVisited\000gp_HideEdge\000gp_InitEdgeFlags\000gp_InitFlags\000gp_RestoreEdge\000gp_SetEdgeFlagInverted\000gp_SetEdgeMarked\000gp_SetEdgeVisited\000gp_SetMarked\000gp_SetVisited\000gp_XorEdgeFlagInverted\000gp_ResetEdgeType\000gp_SetDirection\000gp_SetEdgeType\000gp_SetFirstEdge\000gp_SetIndex\000gp_SetLastEdge\000gp_SetNeighbor\000gp_SetNextEdge\000gp_SetPrevEdge\000gp_SetAdjacentEdge\000gp_SetEdgeByLink\320\0040\260\001\360\034\000\t\032\320\0311\260\021\260$\260l\300!\330\010\013\2107\220#\220Q\330\014\022\220,\230a\330\020C\3001\300A\320\004*\250!\360\014\000\t\030\320\0270\260\001\260\024\260Q\320\004*\250!\360\022\000\t\030\320\0270\260\001\260\024\260Q\320\004(\250\001\360\020\000\t\032\320\0310\260\001\260\024\260Q\330\010\013\2107\220#\220Q\330\014\022\220,\230a\330\020\021\320\004!\240\021\360\030\000\t\024\320\023#\2401\240D\250\014\260C\260q\330\014\022\220,\230a\330\020\021\320\004:\270!\360\026\000\t\n\330\014\020\320\020#\2401\240O\2601\330\024*\250!\2504\250|\2701\340\014\023\2201\340\010\017\210q\320\004+\2501\360\026\000\t\030\220|\2401\240D\250\014\260C\260q\320\0041\260\021\360\032\000\t\032\320\0312\260!\2604\260|\3001\330\010\013\2107\220\"\220A\330\014\022\220,\230a\330\020\021\360\006\000\t\020\210q\320\004+\2501\360\024\000\t\030\320\027*\250!\2504\250|\2701\320\004+\2501\360\024\000\t\014\2104\210t\220=\240\001\240\021\330\014\022\220*\230A\330\020@\300\001\300\021\360\006\000\021$\2401\240D\250\014\260A\320\004#\2401\360\036\000\t\014\2104\210t\220=\240\001\240\021\330\014\022\220*\230A\330\0208\270\001\270\021\360\006\000\t\030\220{\240!\2404\240|\2601\320\0041\260\021\360 \000\t\014\2104\210t\220=\240\001\240\021\330\014\022\220*\230A\330\020<\270A\270Q\360\006\000\t\014\2105\220\010\320\030)\320)<\320\270a\270q\330\014\022\220*\230A\330\020;\2701\270A\360\006\000\t\014\2105\220\004\220L\240\001\240\032\2503\250d\3202E\300Q\300a\330\014\022\220*\230A\330\020A\300\021\300!\360\010\000\021\035\230A\230T\240\034\250S\260\001\320\0043\2601\360\032\000\t\032\320\0314\260A\260T\270\034\300Q\330\010\013\2107\220\"\220A\330\014\022\220,\230a\330\020\021\360\006\000\t\020\210q\320\0043\2601\360\032\000\t\014\2104\210t\220=\240\001\240\021\330\014\022\220*""\230A\330\020>\270a\270q\360\006\000\t\014\2105\220\010\320\030)\320)<\320\270a\270q\360\006\000\t\030\320\027(\250\001\250\024\250\\\270\021\320\004)\250\021\360\024\000\t\014\2104\210t\220=\240\001\240\021\330\014\022\220*\230A\330\020>\270a\270q\360\006\000\021\"\240\021\240$\240l\260!\320\004*\250!\360\024\000\t\014\2104\210t\220=\240\001\240\021\330\014\022\220*\230A\330\020?\270q\300\001\360\006\000\021#\240!\2404\240|\2601\320\004*\250!\360\032\000\t\014\2104\210t\220=\240\001\240\021\330\014\022\220*\230A\330\020?\270q\300\001\360\006\000\t\030\320\027)\250\021\250$\250l\270!\320\004(\250\001\360\030\000\t\014\2104\210t\220<\230q\240\003\2404\240t\2504\320/B\300!\3001\330\014\022\220*\230A\330\020B\300!\3001\360\006\000\t\030\320\027'""\240q\250\004\250L\270\001\320\004:\270!\360\026\000\t\014\2104\210t\220<\230q\240\003\2404\240t\2504\320/B\300!\3001\330\014\022\220*\230A\330\020E\300Q\300a\360\006\000\t\014\2104\210}\230A\230^\2503\250d\3202B\300!\3001\330\014\022\220*\230A\330\020;\2701\270A\360\010\000\021!\240\001\240\024\240\\\260\023\260A\320\004)\250\021\360\032\000\t\014\2104\210t\220<\230q\240\001\330\014\022\220*\230A\330\020@\300\001\300\021\360\026\000\t\014\2104\210\177\230a\230t\240=\260\001\260\021\330\014\023\2201\340\010\017\210q\320\0045\260Q\360\032\000\t\014\2104\210t\320\023&\240a\240q\330\014\022\220*\230A\330\020\021\330\020\026\220a\220q\360\006\000\t\030\320\0274\260A\260T\270\034\300Q\320\0045\260Q\360\036\000\t\014\2104\210t\220<\230q\240\001\330\014\022\220*\230A\330\020L\310A\310Q\360\006\000\t\030\320\0274\260A\260T\270\034\300Q\320\0045\260Q\360\032\000\t\032\320\0316\260a\260t\270<\300q\330\010\013\2107\220\"\220A\330\014\022\220,\230a\330\020\021\360\006\000\t\020\210q\320\004(\250\001\360\"\000\t\014\2105\220\004\220L\240\001\240\023\240C\240t\320+>\270a\270q\330\014\022\220*\230A\330\020\021\330\022\023\2201\360\006\000\t\024\320\023#\2401\240D\250\014\260A\330\014\023\2201\340\010\017\210q\320\004(\250\001\360\022\000\t\014\2105\220\004\220L\240\001\240\023\240C\240t\320+>\270a\270q\330\014\022\220*\230A\330\020?\270q\300\001\360\006\000\021!\240\001\240\024\240\\\260\021\320\0046\260a\360\026\000\t\032\320\0310\260\001\260\024\260\\\300\021\330\010\013\2107\220#\220Q\330\014\022\220,\230a\330\020A\300\021\300!\320\0046\260a\360\036\000\t\014\2104\210t\220<\230q\240\003\2404\240t\2504\320/B\300!\3001\330\014\022\220*\230A\330\020F\300a\300q\360\006\000\t\014\2108\2203\220b\230\004\230H\240C\240q\330\014\022\220*\230A\330\020\021\330\022\023\2201\360\006\000\t\030\320\027(\250\001\250\024\250\\\270\023\270A\320\0046\260a\360\034\000\t\014\2104\210t\220<\230q\240\001\330\014\022\220*\230A\330\020\021\330\022\023\2201\360\006\000\t\024\320\023*\250!\2504\250|\2701""\330\014\023\2201\340\010\017\210q\320\0046\260a\360\032\000\t\032\320\0317\260q\270\004\270L\310\001\330\010\013\2107\220\"\220A\330\014\022\220,\230a\330\020\021\360\006\000\t\020\210q\320\0047\260q\360\030\000\t\014\2104\210t\220=\240\001\240\021\330\014\022\220*\230A\330\020=\270Q\270a\360\006\000\t\014\210:\220X\230S\320 ;\2701\330\014\022\220*\230A\330\020@\300\001\300\021\360\006\000\021!\240\001\240\024\240\\\260\023\260A\320\0047\260q\360\032\000\t\014\210:\220X\230_\320,=\270Q\330\014\022\220*\230A\330\0209\270\021\270!\360\010\000\t\036\230X\240W\250A\250Q\330\010+\2501\340\010\031\230\031\240!\2404\240|\3203D\300A\330\010\013\2107\220#\220Q\330\014\022\220,\230a\330\020*\250!\2501\320\0047\260q\360\024\000\t\032\320\031/\250q\260\004\260L\300\010\310\001\330\010\013\2107\220#\220Q\330\014\022\220,\230a\330\020\021\320\0048\270\001\360 \000\t\014\2104\210t\220=\240\001\240\021\330\014\022\220*\230A\330\020@\300\001\300\021\360\006\000\t\014\2108\2203\220b\230\004\230H\240C\240q\330\014\022\220*\230A\330\020\021\330\022\023\2201\360\006\000\t\030\320\027*\250!\2504\250|\2703\270a\320\0048\270\001\360\030\000\t\014\2104\210t\220=\240\001\240\021\330\014\022\220*\230A\330\020<\270A\270Q\360\006\000\t\014\210<\220s\230$\230d\240$\240d\250-\260q\270\001\330\014\022\220*\230A\330\020\021\330\022\023\2201\360\006\000\021 \230q\240\004\240L\260\003\2601\320\0048\270\001\360\030\000\t\014\2104\210t\220<\230q\240\001\330\014\022\220*\230A\330\020D\300A\300Q\360\006\000\t\014\2104\210}\230A\230]\250#\250T\3201A\300\021\300!\330\014\022\220*\230A\330\0209\270\021\270!\360\010\000\021 \230q\240\004\240L\260\003\2601\320\0048\270\001\360\032\000\t\032\320\0319\270\021\270$\270l\310!\330\010\013\2107\220\"\220A\330\014\022\220,\230a\330\020\021\360\006\000\t\020\210q\320\0049\270\021\360\034\000\t\014\2104\210t\220<\230q\240\001\330\014\022\220*\230A\330\020\021\330\022\023\2201\360\006\000\t\024\320\023-\250Q\250d\260,\270a\330\014\023\2201\340\010\017\210q\320\004*""\250!\360\020\000\t\024\320\023,\250A\250T\260\034\270S\300\001\330\014\022\220,\230a\330\020\021\320\004,\250A\360\020\000\t\030\320\0272\260!\2604\260q\320\004$\240A\360\014\000\t\030\320\027*\250!\2504\250q\320\004,\250A\360\024\000\t\014\2104\210t\220=\240\001\240\021\330\014\022\220*\230A\330\020A\300\021\300!\360\006\000\021%\240A\240T\250\034\260Q\320\004,\250A\360\032\000\t\014\2104\210t\220<\230q\240\001\330\014\022\220*\230A\330\020C\3001\300A\360\006\000\t\030\320\027+\2501\250D\260\014\270A\320\004,\250A\360\034\000\t\014\2104\210t\220<\230q\240\001\330\014\022\220*\230A\330\020C\3001\300A\360\026\000\t\014\2104\210t\320\023$\240A\240Q\330\014\023\2201\340\010\017\210q\320\004$\240A\360\032\000\t\014\2105\220\004\220L\240\001\240\023\240C\240t\320+>\270a\270q\330\014\022\220*\230A\330\020;\2701\270A\360\006\000\t\030\220|\2401\240D\250\014\260A\320\004A\300\021\360,\000\t\014\2106\220\023\220B\220d\230&\240\003\2401\330\014\022\220*\230A\330\0201\260\021\260!\360\006\000\t\014\2106\220\023\220B\220d\230&\240\003\2401\330\014\022\220*\230A\330\0201\260\021\260!\360\010\000\t\032\230\033\240A\240T\250\034\260S\270\007\270s\300!\330\010\013\2107\220#\220S\230\004\230G\2403\240a\330\014\022\220,\230a\330\020D\300A\300T\310\021\310!\330\020\037\230q\320 3\2601\260A\360\006\000\t\020\210q\320\004$\240A\360\020\000\t\032\320\031,\250A\250T\260\021\330\010\013\2107\220#\220Q\330\014\022\220,\230a\330\020\021\320\004$\240A\360\022\000\021\035\230A\230T\240\034\250Q\320\004A\300\021\360\034\000\t\032\320\031/\250q\260\004\260L\300\001\330\010\013\2107\220#\220Q\330\014\022\220,\230a\330\020\021\330\020\022\220!\2201\320\004$\240A\360\026\000\t\n\330\r\017\210s\220$\320\026,\250D\260\001\330\r\017\210r\220\024\320\025+\2504\250q\330\024 \240\001\240\024\240\\\260\021\340\014\023\2201\340\010\017\210q\320\004C\3001\360\034\000\t\014\2104\210t\220<\230q\240\001\330\014\022\220*\230A\330\020F\300a\300q\360\006\000\t\014\2104\210}\230A\230Y\240c\250\024\320-=\270Q\270a""\330\014\022\220*\230A\330\0207\260q\270\001\360\010\000\t\014\2108\2203\220b\230\004\230H\240C\240q\330\014\022\220*\230A\330\020\021\330\022\023\2201\360\006\000\021\"\240\021\240$\240l\260#\260Y\270a\320\004E\300Q\360\034\000\t\014\2104\210t\220=\240\001\240\021\330\014\022\220*\230A\330\020@\300\001\300\021\360\006\000\t\014\2108\2203\220b\230\004\230H\240C\240q\330\014\022\220*\230A\330\020\021\330\022\023\2201\360\006\000\t\014\2108\2203\220d\230$\230d\240$\240m\2601\260A\330\014\022\220*\230A\330\020\021\330\022\023\2201\360\006\000\021$\2401\240D\250\014\260C\260y\300\001\320\004G\300q\360\032\000\t\030\320\027+\2501\250D\260\014\270C\270s\300!\320\004G\300q\360 \000\t\014\2106\220\023\220B\220d\230&\240\003\2401\330\014\022\220*\230A\330\0201\260\021\260!\360\006\000\t\014\2106\220\023\220B\220d\230&\240\003\2401\330\014\022\220*\230A\330\0201\260\021\260!\360\010\000\t\032\320\031+\2501\250D\260\014\270C\270w\300c\310\021\330\010\013\2107\220#\220Q\330\014\022\220,\230a\330\020\021\330\020\023\2201\220D\230\001\320\031*\250!\320+>\270a\270q\320\004I\310\021\360\032\000\t\030\320\027-\250Q\250d\260,\270c\300\023\300A\320\004O\310q\360\036\000\t \320\037;\2701\330\020\024\220L\240\t\250\034\260Q\340\010\013\210=\230\003\2303\230d\240-\250s\260!\330\014\022\220,\230a\230q\340\010\017\210q\320\004\"\240!\360\014\000\t\030\320\027(\250\001\250\024\250Q\320\004=\270Q\360\026\000\t\n\330\014\020\320\020#\2401\240O\2601\330\024-\250Q\250d\260,\270a\340\014\023\2201\340\010\017\210q\200\001\330\004\n\210+\220Q\320\004%\240Q\360\026\000\t\n\330\021\023\2202\220T\320\0312\260$\260a\330\021\023\2203\220d\320\0323\2604\260q\330\030%\240Q\240d\250,\260a\340\014\023\2201\340\010\017\210q\320\004%\240Q\360\032\000\t\014\2104\210t\220<\230q\240\001\330\014\022\220*\230A\330\020<\270A\270Q\360\006\000\t\030\220}\240A\240T\250\034\260Q\320\004%\240Q\360\022\000\t\014\2104\210z\230\021\230#\230\\\250\035\260a\260t\270<\300q\330\014\023\2201\340\010\017\210q\320\004\035\230Q""\360\022\000\t5\260L\300\001\300\024\300Q\330\010\013\210=\230\003\2301\330\014\022\220+\230Q\230a\340\010\037\230u\240A\330\020\030\230\001\230\021\230)\2401\330\010\021\220\035\230a\340\010\017\210q\320\004%\240Q\360\030\000\t\014\2105\220\004\220L\240\001\240\023\240C\240t\320+>\270a\270q\330\014\022\220*\230A\330\020<\270A\270Q\360\006\000\t\030\220}\240A\240T\250\034\260Q\320\004%\240Q\360\022\000\t\014\2105\220\004\220L\240\001\240\023\240C\240t\320+>\270a\270q\330\014\022\220*\230A\330\020<\270A\270Q\360\006\000\021\036\230Q\230d\240,\250a\320\004-\250Q\360\024\000\t\030\320\027,\250A\250T\260\034\270Q\320\004-\250Q\360\030\000\t\030\220~\240Q\240d\250,\260c\270\021\320\004=\270Q\360\030\000\t\036\230[\250\007\250q\260\001\330\010+\2501\340\010\031\320\0314\260A\260T\270\034\300Q\330\010\013\2107\220#\220Q\330\014\022\220,\230a\330\0206\260a\260q\320\004%\240Q\360\024\000\t\024\320\023'\240q\250\004\250L\270\003\2701\330\014\022\220,\230a\330\020\021\320\004%\240Q\360\020\000\t\024\320\023'\240q\250\004\250L\270\003\2701\330\014\022\220,\230a\330\020\021\320\004@\300\001\360\032\000\t\032\320\031-\250Q\250d\260,\270c\300\023\300A\330\010\013\2107\220#\220Q\330\014\022\220,\230a\330\020G\300q\310\001\330\033\034\230A\320\004Y\320YZ\360.\000\t\032\230\036\240q\250\004\250L\270\003\2705\300\t\310\023\310E\320QR\330\010\013\2107\220#\220S\230\004\230G\2403\240a\330\014\022\220,\230a\330\020\021\330\020\023\2201\220D\230\001\320\031/\250q\3200B\300!\3001\330\020;\2701\270A\330\020\022\220!\2201\360\006\000\t\020\210q\320\004.\250a\360\014\000\t\030\320\0274\260A\260T\270\021\320\004.\250a\360\026\000\t\014\2104\210t\220=\240\001\240\021\330\014\022\220*\230A\330\020<\270A\270Q\360\006\000\t\014\2105\220\004\220L\240\001\240\023\240C\240t\320+>\270a\270q\330\014\022\220*\230A\330\020>\270a\270q\360\006\000\021 \230q\240\004\240L\260\003\2601\320\004&\240a\360\030\000\t\014\2105\220\004\220L\240\001\240\023\240C\240t\320+>\270a\270q\330\014\022\220*\230A\330\020=""\270Q\270a\360\006\000\t\030\220~\240Q\240d\250,\260a\320\004&\240a\360\022\000\t\014\2105\220\004\220L\240\001\240\023\240C\240t\320+>\270a\270q\330\014\022\220*\230A\330\020=\270Q\270a\360\006\000\021\037\230a\230t\240<\250q\320\004.\250a\360\026\000\t\032\320\0316\260a\260t\2701\330\010\013\2107\220#\220Q\330\014\022\220,\230a\330\020\021\320\004.\250a\360\024\000\t&\240Q\340\010\031\320\0316\260a\260t\270<\300q\310\001\330\010\013\2107\220#\220Q\330\014\022\220,\230a\230q\340\010\032\230/\250\021\330\010\014\210A\210Q\330\010\t\330\014\023\220?\240'\250\021\250!\330\010\017\210}\230A\330\014\022\220,\230a\330\020\021\330\023\024\320\004&\240a\340\020%\240Q\240d\250!\320\004.\250a\360\024\000\t\030\320\027-\250Q\250d\260,\270a\320\004&\240a\360\016\000\t\032\320\031.\250a\250t\2601\330\010\013\2107\220#\220Q\330\014\022\220,\230a\230q\320\004.\250a\360\026\000\t\032\230\035\240a\240t\250<\260x\270q\330\010\013\2107\220#\220Q\330\014\022\220,\230a\230q\320\004&\240a\360\024\000\t\032\230\036\240q\250\004\250L\270\001\330\010\013\2107\220#\220Q\330\014\022\220,\230a\330\020D\300A\300Q\320\004.\250a\360\026\000\t\n\330\r\017\210r\220\024\320\0252\260$\260a\330\r\017\210s\220$\320\0263\2604\260q\330\024*\250!\2504\250|\2701\340\014\023\2201\340\010\017\210q\320\004(\250\001\360\024\000\t\032\320\031)\250\021\250$\250l\270!\330\010\013\2107\220#\220Q\330\014\022\220,\230a\330\020H\310\001\310\021\320\004'\240q\360\032\000\t\014\2104\210t\220=\240\001\240\021\330\014\022\220*\230A\330\020<\270A\270Q\360\006\000\t\030\220\177\240a\240t\250<\260q\320\004'\240q\360\036\000\t\014\2104\210t\220=\240\001\240\021\330\014\022\220*\230A\330\020<\270A\270Q\360\006\000\t\030\220\177\240a\240t\250<\260q\320\004'\240q\360\032\000\t\014\2104\210t\220=\240\001\240\021\330\014\022\220*\230A\330\020B\300!\3001\360\006\000\t\030\220\177\240a\240t\250<\260q\320\004/\250q\360\032\000\t\014\2104\210t\220=\240\001\240\021\330\014\022\220*\230A\330\020D\300A\300Q\360\006\000\t\030\320\027.""\250a\250t\260<\270q\320\004/\250q\360\024\000\t\014\2104\210t\220=\240\001\240\021\330\014\022\220*\230A\330\020D\300A\300Q\360\006\000\021(\240q\250\004\250L\270\001\320\004'\240q\360\030\000\t\014\2104\210t\220<\230q\240\003\2404\240t\2504\320/B\300!\3001\330\014\022\220*\230A\330\020D\300A\300Q\360\006\000\t\030\220\177\240a\240t\250<\260q\320\004'\240q\360\030\000\t\014\2104\210t\220<\230q\240\001\330\014\022\220*\230A\330\020>\270a\270q\360\006\000\t\030\220\177\240a\240t\250<\260q\320\004'\240q\360\022\000\t\014\2105\220\004\220L\240\001\240\023\240C\240t\320+>\270a\270q\330\014\022\220*\230A\330\020>\270a\270q\360\006\000\021 \230q\240\004\240L\260\001\320\004'\240q\360\014\000\t\030\320\027-\250Q\250d\260!\320\004'\240q\360\026\000\t\036\230X\240W\250A\250Q\330\010+\2501\340\010\031\230\030\240\021\240$\240l\260!\330\010\013\2107\220#\220Q\330\014\022\220,\230a\330\020/\250q\260\001\320\004'\240q\360\016\000\021 \230q\240\004\240L\260\001\320\004'\240q\360\026\000\t\n\330\r\017\210r\220\024\320\025+\2504\250q\330\r\017\210s\220$\320\026-\250T\260\021\330\024#\2401\240D\250\014\260A\340\014\023\2201\340\010\017\210q\320\004\031\230\021\360\014\000\t\030\220x\230q\240\004\240A\320\004*\250!\360*\000\t \230y\250\001\250\024\250\\\270\021\330\010\013\210=\230\003\2303\230d\240-\250s\260!\330\014\022\220,\230a\230q\340\010\017\210q\320\004\032\230!\360\014\000\t\030\220y\240\001\240\024\240Q"; PyObject *data = NULL; CYTHON_UNUSED_VAR(__Pyx_DecompressString); #endif PyObject **stringtab = __pyx_mstate->__pyx_string_tab; Py_ssize_t pos = 0; for (int i = 0; i < 510; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); if (likely(string) && i >= 147) PyUnicode_InternInPlace(&string); if (unlikely(!string)) { Py_XDECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } stringtab[i] = string; pos += bytes_length; } for (int i = 510; i < 626; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); stringtab[i] = string; pos += bytes_length; if (unlikely(!string)) { Py_XDECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } } Py_XDECREF(data); for (Py_ssize_t i = 0; i < 626; i++) { if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { __PYX_ERR(0, 1, __pyx_L1_error) } } #if CYTHON_IMMORTAL_CONSTANTS { PyObject **table = stringtab + 510; for (Py_ssize_t i=0; i<116; ++i) { #if PY_VERSION_HEX >= 0x030F0000 PyUnstable_SetImmortal(table[i]); #elif CYTHON_COMPILING_IN_CPYTHON_FREETHREADING if ((PY_SSIZE_T_MAX <= _Py_IMMORTAL_REFCNT_LOCAL)) break; #if PY_VERSION_HEX < 0x030E0000 if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1) #else if (PyUnstable_Object_IsUniquelyReferenced(table[i])) #endif { Py_SET_REFCNT(table[i], ((Py_ssize_t)_Py_IMMORTAL_REFCNT_LOCAL + 1)); } #else if ((PY_SSIZE_T_MAX < _Py_IMMORTAL_INITIAL_REFCNT)) break; Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); #endif } } #endif } return 0; __pyx_L1_error:; return -1; } /* #### Code section: init_codeobjects ### */ typedef struct { unsigned int argcount : 3; unsigned int num_posonly_args : 1; unsigned int num_kwonly_args : 1; unsigned int nlocals : 4; unsigned int flags : 10; unsigned int first_line : 12; } __Pyx_PyCode_New_function_description; /* NewCodeObj.proto */ static PyObject* __Pyx_PyCode_New( const __Pyx_PyCode_New_function_description descr, PyObject * const *varnames, PyObject *filename, PyObject *funcname, PyObject *line_table, PyObject *tuple_dedup_map ); static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { PyObject* tuple_dedup_map = PyDict_New(); if (unlikely(!tuple_dedup_map)) return -1; { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 66}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_N, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_EnsureVertexCapacity, __pyx_mstate->__pyx_kp_b_iso88591_0_1_l_7_Q_a_C1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 86}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_requiredEdgeCapacity, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_EnsureEdgeCapacity, __pyx_mstate->__pyx_kp_b_iso88591_A_q_L_7_Q_a_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 106}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ResetGraphStorage, __pyx_mstate->__pyx_kp_b_iso88591_a_Qd, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 110}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetN, __pyx_mstate->__pyx_kp_b_iso88591_xq_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 118}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetNV, __pyx_mstate->__pyx_kp_b_iso88591_y_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 126}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetM, __pyx_mstate->__pyx_kp_b_iso88591_xq_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 134}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetEdgeCapacity, __pyx_mstate->__pyx_kp_b_iso88591_A_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 142}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_srcGraph, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_CopyGraph, __pyx_mstate->__pyx_kp_b_iso88591_a_at_xq_7_Q_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 157}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_theGraph_dup, __pyx_mstate->__pyx_n_u_new_graph}; __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_DupGraph, __pyx_mstate->__pyx_kp_b_iso88591_Q_5L_Q_1_Qa_uA_1_a_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 176}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_srcGraph, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_CopyAdjacencyLists, __pyx_mstate->__pyx_kp_b_iso88591_7q_q_L_7_Q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 192}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_CreateRandomGraph, __pyx_mstate->__pyx_kp_b_iso88591_a_at1_7_Q_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 203}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_numEdges, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_CreateRandomGraphEx, __pyx_mstate->__pyx_kp_b_iso88591_6a_0_7_Q_a_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 220}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_u, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_IsNeighbor, __pyx_mstate->__pyx_kp_b_iso88591_Q_Qd_c, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 234}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_u, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_FindEdge, __pyx_mstate->__pyx_kp_b_iso88591_1_1D_Cq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 247}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetVertexDegree, __pyx_mstate->__pyx_kp_b_iso88591_1_4_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 259}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_u, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_direction}; __pyx_mstate_global->__pyx_codeobj_tab[15] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_IsNeighborDirected, __pyx_mstate->__pyx_kp_b_iso88591_I_Qd_c_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[15])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 274}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_u, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_direction}; __pyx_mstate_global->__pyx_codeobj_tab[16] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_FindDirectedEdge, __pyx_mstate->__pyx_kp_b_iso88591_Gq_1D_Cs, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[16])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 289}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[17] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetVertexInDegree, __pyx_mstate->__pyx_kp_b_iso88591_Q_AT_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[17])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 301}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[18] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetVertexOutDegree, __pyx_mstate->__pyx_kp_b_iso88591_a_Qd_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[18])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 313}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_u, __pyx_mstate->__pyx_n_u_ulink, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_vlink, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[19] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_AddEdge, __pyx_mstate->__pyx_kp_b_iso88591_A_6_Bd_1_A_1_6_Bd_1_A_1_AT_S_s, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[19])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 355}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_u, __pyx_mstate->__pyx_n_u_ulink, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_vlink, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[20] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_DynamicAddEdge, __pyx_mstate->__pyx_kp_b_iso88591_Gq_6_Bd_1_A_1_6_Bd_1_A_1_1D_Cwc, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[20])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {7, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 389}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_u, __pyx_mstate->__pyx_n_u_e_u, __pyx_mstate->__pyx_n_u_e_ulink, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_e_v, __pyx_mstate->__pyx_n_u_e_vlink, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[21] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_InsertEdge, __pyx_mstate->__pyx_kp_b_iso88591_YYZ_q_L_5_EQR_7_S_G3a_a_1D_q0B, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[21])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 423}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[22] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_DeleteEdge, __pyx_mstate->__pyx_kp_b_iso88591_a_q_L_7_Q_a_DAQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[22])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 439}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[23] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_HideEdge, __pyx_mstate->__pyx_kp_b_iso88591_A_AT_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[23])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 450}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[24] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_RestoreEdge, __pyx_mstate->__pyx_kp_b_iso88591_q_q_L, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[24])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 459}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_vertex, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[25] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_HideVertex, __pyx_mstate->__pyx_kp_b_iso88591_1_q_L_7_Q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[25])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 478}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[26] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_RestoreVertex, __pyx_mstate->__pyx_kp_b_iso88591_4q_7_Q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[26])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 493}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[27] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ContractEdge, __pyx_mstate->__pyx_kp_b_iso88591_l_7_Q_a_H, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[27])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 509}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_u, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_eBefore, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[28] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_IdentifyVertices, __pyx_mstate->__pyx_kp_b_iso88591_Qd_c_A_7_Q_a_Gq_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[28])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 529}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[29] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_RestoreVertices, __pyx_mstate->__pyx_kp_b_iso88591_A_AT_7_Q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[29])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 544}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[30] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetGraphFlags, __pyx_mstate->__pyx_kp_b_iso88591_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[30])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 552}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[31] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetFirstEdge, __pyx_mstate->__pyx_kp_b_iso88591_4t_q_4t4_B_1_A_B_1_q_L, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[31])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 571}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[32] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetLastEdge, __pyx_mstate->__pyx_kp_b_iso88591_q_4t_q_4t4_B_1_A_DAQ_at_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[32])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 590}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_theLink}; __pyx_mstate_global->__pyx_codeobj_tab[33] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetEdgeByLink, __pyx_mstate->__pyx_kp_b_iso88591_6a_4t_q_4t4_B_1_A_Faq_83b_HCq_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[33])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 618}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_newFirstEdge}; __pyx_mstate_global->__pyx_codeobj_tab[34] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_SetFirstEdge, __pyx_mstate->__pyx_kp_b_iso88591_4t_q_4t4_B_1_A_EQa_4_A_3d2B_1_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[34])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 642}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_newLastEdge}; __pyx_mstate_global->__pyx_codeobj_tab[35] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_SetLastEdge, __pyx_mstate->__pyx_kp_b_iso88591_8_4t_q_A_DAQ_4_A_T1A_A_9_q_L_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[35])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 667}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_theLink, __pyx_mstate->__pyx_n_u_newEdge}; __pyx_mstate_global->__pyx_codeobj_tab[36] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_SetEdgeByLink, __pyx_mstate->__pyx_kp_b_iso88591_C1_4t_q_A_Faq_4_AYc_Qa_A_7q_83b, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[36])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 700}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[37] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_LowerBoundVertices, __pyx_mstate->__pyx_kp_b_iso88591_q_Qd, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[37])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 708}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[38] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_UpperBoundVertices, __pyx_mstate->__pyx_kp_b_iso88591_q_Qd, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[38])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 716}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[39] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_LowerBoundVirtualVertices, __pyx_mstate->__pyx_kp_b_iso88591_a_4AT, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[39])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 724}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[40] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_UpperBoundVirtualVertices, __pyx_mstate->__pyx_kp_b_iso88591_a_4AT, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[40])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 732}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[41] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_LowerBoundVertexStorage, __pyx_mstate->__pyx_kp_b_iso88591_A_2_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[41])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 742}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[42] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_UpperBoundVertexStorage, __pyx_mstate->__pyx_kp_b_iso88591_A_2_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[42])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 752}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[43] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_IsVertex, __pyx_mstate->__pyx_kp_b_iso88591_A_s_D_r_4q_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[43])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 772}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[44] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_IsVirtualVertex, __pyx_mstate->__pyx_kp_b_iso88591_1_s_34q_r_2_a_q_L_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[44])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 792}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[45] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_IsNotVertex, __pyx_mstate->__pyx_kp_b_iso88591_q_r_4q_s_T_1D_A_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[45])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 812}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[46] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_IsNotVirtualVertex, __pyx_mstate->__pyx_kp_b_iso88591_a_r_2_a_s_34q_4_1_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[46])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 832}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_virtualVertex}; __pyx_mstate_global->__pyx_codeobj_tab[47] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_VirtualVertexInUse, __pyx_mstate->__pyx_kp_b_iso88591_1O1_4_1_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[47])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 851}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_virtualVertex}; __pyx_mstate_global->__pyx_codeobj_tab[48] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_VirtualVertexNotInUse, __pyx_mstate->__pyx_kp_b_iso88591_Q_1O1_Qd_a_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[48])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 870}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[49] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetIndex, __pyx_mstate->__pyx_kp_b_iso88591_A_5_L_Ct_aq_A_1A_1D_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[49])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 890}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_theIndex}; __pyx_mstate_global->__pyx_codeobj_tab[50] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_SetIndex, __pyx_mstate->__pyx_kp_b_iso88591_2_5_L_Ct_aq_A_1A_5_L_3d2EQa_A_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[50])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 914}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[51] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_InitFlags, __pyx_mstate->__pyx_kp_b_iso88591_Q_5_L_Ct_aq_A_AQ_Qd_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[51])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 930}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[52] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetVisited, __pyx_mstate->__pyx_kp_b_iso88591_a_5_L_Ct_aq_A_Qa_Qd_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[52])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 949}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[53] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ClearVisited, __pyx_mstate->__pyx_kp_b_iso88591_5_L_Ct_aq_A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[53])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 965}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[54] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_SetVisited, __pyx_mstate->__pyx_kp_b_iso88591_a_5_L_Ct_aq_A_Qa_at_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[54])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 981}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[55] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetMarked, __pyx_mstate->__pyx_kp_b_iso88591_Q_5_L_Ct_aq_A_AQ_AT_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[55])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1000}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[56] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ClearMarked, __pyx_mstate->__pyx_kp_b_iso88591_q_5_L_Ct_aq_A_aq_q_L, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[56])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1016}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[57] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_SetMarked, __pyx_mstate->__pyx_kp_b_iso88591_Q_5_L_Ct_aq_A_AQ_Qd_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[57])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1032}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[58] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetTwin, __pyx_mstate->__pyx_kp_b_iso88591_1_4t_A_8_4_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[58])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1054}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[59] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetNextEdge, __pyx_mstate->__pyx_kp_b_iso88591_q_4t_A_B_1_at_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[59])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1074}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[60] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetPrevEdge, __pyx_mstate->__pyx_kp_b_iso88591_q_4t_A_B_1_at_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[60])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1094}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_theLink}; __pyx_mstate_global->__pyx_codeobj_tab[61] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetAdjacentEdge, __pyx_mstate->__pyx_kp_b_iso88591_8_4t_A_83b_HCq_A_1_4_3a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[61])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1123}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_newNextEdge}; __pyx_mstate_global->__pyx_codeobj_tab[62] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_SetNextEdge, __pyx_mstate->__pyx_kp_b_iso88591_8_4t_A_AQ_s_d_d_q_A_1_q_L_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[62])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1148}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_newPrevEdge}; __pyx_mstate_global->__pyx_codeobj_tab[63] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_SetPrevEdge, __pyx_mstate->__pyx_kp_b_iso88591_8_4t_A_AQ_s_d_d_q_A_1_q_L_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[63])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1173}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_theLink, __pyx_mstate->__pyx_n_u_newEdge}; __pyx_mstate_global->__pyx_codeobj_tab[64] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_SetAdjacentEdge, __pyx_mstate->__pyx_kp_b_iso88591_EQ_4t_A_83b_HCq_A_1_83d_d_m1A_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[64])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1206}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[65] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_IsEdge, __pyx_mstate->__pyx_kp_b_iso88591_3d_34q_2T_2_a_4_1_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[65])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1226}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[66] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_IsNotEdge, __pyx_mstate->__pyx_kp_b_iso88591_Q_2T_2_a_3d_34q_Qd_a_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[66])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1246}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[67] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetNeighbor, __pyx_mstate->__pyx_kp_b_iso88591_q_4t_A_AQ_at_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[67])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1266}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[68] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_SetNeighbor, __pyx_mstate->__pyx_kp_b_iso88591_a_4t_A_AQ_5_L_Ct_aq_A_aq_q_L_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[68])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1289}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[69] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_InitEdgeFlags, __pyx_mstate->__pyx_kp_b_iso88591_4t_A_aq_l, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[69])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1306}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[70] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetEdgeVisited, __pyx_mstate->__pyx_kp_b_iso88591_4t_A_q_l, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[70])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1326}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[71] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ClearEdgeVisited, __pyx_mstate->__pyx_kp_b_iso88591_A_4t_A_A_AT_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[71])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1343}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[72] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_SetEdgeVisited, __pyx_mstate->__pyx_kp_b_iso88591_4t_A_q_4_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[72])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1360}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[73] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetEdgeMarked, __pyx_mstate->__pyx_kp_b_iso88591_4t_A_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[73])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1380}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[74] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ClearEdgeMarked, __pyx_mstate->__pyx_kp_b_iso88591_1_4t_A_1D_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[74])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1397}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[75] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_SetEdgeMarked, __pyx_mstate->__pyx_kp_b_iso88591_4t_A_aq_l, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[75])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1414}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[76] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetEdgeType, __pyx_mstate->__pyx_kp_b_iso88591_q_4t_A_AQ_at_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[76])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1436}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[77] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ClearEdgeType, __pyx_mstate->__pyx_kp_b_iso88591_4t_A_aq_l, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[77])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1453}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_type}; __pyx_mstate_global->__pyx_codeobj_tab[78] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_SetEdgeType, __pyx_mstate->__pyx_kp_b_iso88591_1_4t_A_AQ_5_NN___A_q_q_L_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[78])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1481}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_type}; __pyx_mstate_global->__pyx_codeobj_tab[79] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ResetEdgeType, __pyx_mstate->__pyx_kp_b_iso88591_31_4t_A_aq_5_NN___A_A_l_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[79])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1506}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[80] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetEdgeFlagInverted, __pyx_mstate->__pyx_kp_b_iso88591_q_4t_A_DAQ_at_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[80])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1526}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[81] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_SetEdgeFlagInverted, __pyx_mstate->__pyx_kp_b_iso88591_q_4t_A_DAQ_q_L, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[81])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1543}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[82] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ClearEdgeFlagInverted, __pyx_mstate->__pyx_kp_b_iso88591_1_4t_A_Faq_l, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[82])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1560}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[83] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_XorEdgeFlagInverted, __pyx_mstate->__pyx_kp_b_iso88591_q_4t_A_DAQ_q_L, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[83])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1577}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[84] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetDirection, __pyx_mstate->__pyx_kp_b_iso88591_4t_A_Qa_q_L, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[84])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1597}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_direction}; __pyx_mstate_global->__pyx_codeobj_tab[85] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_SetDirection, __pyx_mstate->__pyx_kp_b_iso88591_7q_4t_A_Qa_XS_1_A_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[85])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1621}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[86] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_LowerBoundEdges, __pyx_mstate->__pyx_kp_b_iso88591_A_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[86])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1629}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[87] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_UpperBoundEdges, __pyx_mstate->__pyx_kp_b_iso88591_A_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[87])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1637}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[88] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_EdgeInUse, __pyx_mstate->__pyx_kp_b_iso88591_Q_4z_at_q_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[88])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1651}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e}; __pyx_mstate_global->__pyx_codeobj_tab[89] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_EdgeNotInUse, __pyx_mstate->__pyx_kp_b_iso88591_4_AQ_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[89])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1673}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[90] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_LowerBoundEdgeStorage, __pyx_mstate->__pyx_kp_b_iso88591_0_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[90])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1681}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[91] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_UpperBoundEdgeStorage, __pyx_mstate->__pyx_kp_b_iso88591_0_Q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[91])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1692}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_fileName, __pyx_mstate->__pyx_n_u_encoded, __pyx_mstate->__pyx_n_u_encodedFileName, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[92] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_Read, __pyx_mstate->__pyx_kp_b_iso88591_q_XWAQ_1_l_7_Q_a_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[92])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1712}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_inputStr, __pyx_mstate->__pyx_n_u_encoded, __pyx_mstate->__pyx_n_u_encodedInputString}; __pyx_mstate_global->__pyx_codeobj_tab[93] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ReadFromString, __pyx_mstate->__pyx_kp_b_iso88591_1_XWAQ_a_Qd_6J_Q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[93])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1729}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_fileName, __pyx_mstate->__pyx_n_u_writeMode, __pyx_mstate->__pyx_n_u_encoded, __pyx_mstate->__pyx_n_u_encodedFileName, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[94] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_Write, __pyx_mstate->__pyx_kp_b_iso88591_7q_X__Q_A_9_XWAQ_1_4_3DA_7_Q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[94])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1757}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_writeMode, __pyx_mstate->__pyx_n_u_outputString, __pyx_mstate->__pyx_n_u_output_bytes, __pyx_mstate->__pyx_n_u_string_conversion_error}; __pyx_mstate_global->__pyx_codeobj_tab[95] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_WriteToString, __pyx_mstate->__pyx_kp_b_iso88591_1_X__Q_A_A_AT_QnKsRS_Cq_AQ_q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[95])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1805}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[96] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ExtendWith_DFSUtils, __pyx_mstate->__pyx_kp_b_iso88591_4_3a_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[96])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1819}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[97] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_DepthFirstSearch, __pyx_mstate->__pyx_kp_b_iso88591_Q_q_L_1_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[97])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1834}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[98] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_SortVertices, __pyx_mstate->__pyx_kp_b_iso88591_1D_Cq_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[98])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1851}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[99] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ComputeLowpoints, __pyx_mstate->__pyx_kp_b_iso88591_Q_q_L_1_a_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[99])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1864}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[100] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ComputeLeastAncestors, __pyx_mstate->__pyx_kp_b_iso88591_AT_S_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[100])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1877}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[101] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetParent, __pyx_mstate->__pyx_kp_b_iso88591_Q_4t_q_A_AQ_AT_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[101])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1897}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[102] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetLeastAncestor, __pyx_mstate->__pyx_kp_b_iso88591_A_4t_q_A_C1A_1D_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[102])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1917}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[103] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetLowpoint, __pyx_mstate->__pyx_kp_b_iso88591_q_4t_q_A_aq_at_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[103])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1936}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[104] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_IsDFSTreeRoot, __pyx_mstate->__pyx_kp_b_iso88591_4t_q_A_4_at_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[104])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1967}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[105] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_IsNotDFSTreeRoot, __pyx_mstate->__pyx_kp_b_iso88591_A_4t_q_A_C1A_4t_AQ_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[105])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1999}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_c}; __pyx_mstate_global->__pyx_codeobj_tab[106] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetBicompRootFromDFSChild, __pyx_mstate->__pyx_kp_b_iso88591_5Q_4t_q_A_LAQ_4AT_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[106])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2021}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_R}; __pyx_mstate_global->__pyx_codeobj_tab[107] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetDFSChildFromBicompRoot, __pyx_mstate->__pyx_kp_b_iso88591_5Q_4t_aq_A_aq_4AT_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[107])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2042}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_R, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_bicomp_root}; __pyx_mstate_global->__pyx_codeobj_tab[108] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_GetVertexFromBicompRoot, __pyx_mstate->__pyx_kp_b_iso88591_31_4t_aq_A_aq_D_Qa_4t_q_a_1_d_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[108])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2083}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v}; __pyx_mstate_global->__pyx_codeobj_tab[109] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_IsBicompRoot, __pyx_mstate->__pyx_kp_b_iso88591_5_L_Ct_aq_A_1_1D_A_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[109])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2111}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_theChild}; __pyx_mstate_global->__pyx_codeobj_tab[110] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_IsSeparatedDFSChild, __pyx_mstate->__pyx_kp_b_iso88591_6a_4t_q_A_1_4_1_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[110])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2136}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_theChild}; __pyx_mstate_global->__pyx_codeobj_tab[111] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_IsNotSeparatedDFSChild, __pyx_mstate->__pyx_kp_b_iso88591_9_4t_q_A_1_Qd_a_1_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[111])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2161}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[112] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ExtendWith_Planarity, __pyx_mstate->__pyx_kp_b_iso88591_1_a_7_Q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[112])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2178}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_embedFlags, __pyx_mstate->__pyx_n_u_embed_result}; __pyx_mstate_global->__pyx_codeobj_tab[113] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_Embed, __pyx_mstate->__pyx_kp_b_iso88591_y_3d_s_aq_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[113])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2205}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_origGraph, __pyx_mstate->__pyx_n_u_embedResult, __pyx_mstate->__pyx_n_u_check_result}; __pyx_mstate_global->__pyx_codeobj_tab[114] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_TestEmbedResultIntegrity, __pyx_mstate->__pyx_kp_b_iso88591_Oq_1_L_Q_3d_s_aq_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[114])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2228}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[115] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ExtendWith_Outerplanarity, __pyx_mstate->__pyx_kp_b_iso88591_a_6at1_7_Q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[115])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2245}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[116] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ExtendWith_DrawPlanar, __pyx_mstate->__pyx_kp_b_iso88591_2_4q_7_Q_a_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[116])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2265}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_theFileName, __pyx_mstate->__pyx_n_u_encoded, __pyx_mstate->__pyx_n_u_encodedFileName, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[117] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_DrawPlanar_RenderToFile, __pyx_mstate->__pyx_kp_b_iso88591_Q_q_1_4AT_Q_7_Q_a_6aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[117])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2286}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_renditionString, __pyx_mstate->__pyx_n_u_result, __pyx_mstate->__pyx_n_u_rendition_bytes, __pyx_mstate->__pyx_n_u_string_conversion_error}; __pyx_mstate_global->__pyx_codeobj_tab[118] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_DrawPlanar_RenderToString, __pyx_mstate->__pyx_kp_b_iso88591_a_Q_6at_q_7_Q_aq_AQ_A_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[118])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2311}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[119] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_DrawPlanar_GetVertexPosition, __pyx_mstate->__pyx_kp_b_iso88591_8_9_l_7_A_a_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[119])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2332}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[120] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_DrawPlanar_GetVertexStart, __pyx_mstate->__pyx_kp_b_iso88591_5Q_6at_q_7_A_a_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[120])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2353}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[121] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_DrawPlanar_GetVertexEnd, __pyx_mstate->__pyx_kp_b_iso88591_31_4AT_Q_7_A_a_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[121])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2374}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[122] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_DrawPlanar_GetEdgePosition, __pyx_mstate->__pyx_kp_b_iso88591_6a_7q_L_7_A_a_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[122])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2395}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[123] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_DrawPlanar_GetEdgeStart, __pyx_mstate->__pyx_kp_b_iso88591_31_4AT_Q_7_A_a_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[123])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2416}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_e, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[124] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_DrawPlanar_GetEdgeEnd, __pyx_mstate->__pyx_kp_b_iso88591_1_2_4_1_7_A_a_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[124])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2437}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[125] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ExtendWith_K23Search, __pyx_mstate->__pyx_kp_b_iso88591_1_a_7_Q_a_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[125])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2451}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[126] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ExtendWith_K33Search, __pyx_mstate->__pyx_kp_b_iso88591_1_a_7_Q_a_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[126])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2465}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_result}; __pyx_mstate_global->__pyx_codeobj_tab[127] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graph_pyx, __pyx_mstate->__pyx_n_u_gp_ExtendWith_K4Search, __pyx_mstate->__pyx_kp_b_iso88591_0_Q_7_Q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[127])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self}; __pyx_mstate_global->__pyx_codeobj_tab[128] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[128])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state}; __pyx_mstate_global->__pyx_codeobj_tab[129] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_mstate->__pyx_kp_b_iso88591_Q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[129])) goto bad; } Py_DECREF(tuple_dedup_map); return 0; bad: Py_DECREF(tuple_dedup_map); return -1; } /* #### Code section: init_globals ### */ static int __Pyx_InitGlobals(void) { /* PythonCompatibility.init */ if (likely(__Pyx_init_co_variables() == 0)); else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) /* CommonTypesMetaclass.init */ if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) /* CachedMethodType.init */ #if CYTHON_COMPILING_IN_LIMITED_API { PyObject *typesModule=NULL; typesModule = PyImport_ImportModule("types"); if (typesModule) { __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType"); Py_DECREF(typesModule); } } // error handling follows #endif if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) /* CythonFunctionShared.init */ if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } /* #### Code section: cleanup_globals ### */ /* #### Code section: cleanup_module ### */ /* #### Code section: main_method ### */ /* #### Code section: utility_code_pragmas ### */ #ifdef _MSC_VER #pragma warning( push ) /* Warning 4127: conditional expression is constant * Cython uses constant conditional expressions to allow in inline functions to be optimized at * compile-time, so this warning is not useful */ #pragma warning( disable : 4127 ) #endif /* #### Code section: utility_code_def ### */ /* --- Runtime support code --- */ /* Refnanny */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule(modname); if (!m) goto end; p = PyObject_GetAttrString(m, "RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* TupleAndListFromArray (used by fastcall) */ #if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL static CYTHON_INLINE PyObject * __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) { PyObject *res; Py_ssize_t i; if (n <= 0) { return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); } res = PyTuple_New(n); if (unlikely(res == NULL)) return NULL; for (i = 0; i < n; i++) { Py_INCREF(src[i]); if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { Py_DECREF(res); return NULL; } } return res; } #elif CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { PyObject *v; Py_ssize_t i; for (i = 0; i < length; i++) { v = dest[i] = src[i]; Py_INCREF(v); } } static CYTHON_INLINE PyObject * __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) { PyObject *res; if (n <= 0) { return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); } res = PyTuple_New(n); if (unlikely(res == NULL)) return NULL; __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); return res; } static CYTHON_INLINE PyObject * __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) { PyObject *res; if (n <= 0) { return PyList_New(0); } res = PyList_New(n); if (unlikely(res == NULL)) return NULL; __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); return res; } #endif /* BytesEquals (used by UnicodeEquals) */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\ !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) return PyObject_RichCompareBool(s1, s2, equals); #else if (s1 == s2) { return (equals == Py_EQ); } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { const char *ps1, *ps2; Py_ssize_t length = PyBytes_GET_SIZE(s1); if (length != PyBytes_GET_SIZE(s2)) return (equals == Py_NE); ps1 = PyBytes_AS_STRING(s1); ps2 = PyBytes_AS_STRING(s2); if (ps1[0] != ps2[0]) { return (equals == Py_NE); } else if (length == 1) { return (equals == Py_EQ); } else { int result; #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) Py_hash_t hash1, hash2; hash1 = ((PyBytesObject*)s1)->ob_shash; hash2 = ((PyBytesObject*)s2)->ob_shash; if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { return (equals == Py_NE); } #endif result = memcmp(ps1, ps2, (size_t)length); return (equals == Py_EQ) ? (result == 0) : (result != 0); } } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { return (equals == Py_NE); } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { return (equals == Py_NE); } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); Py_DECREF(py_result); return result; } #endif } /* UnicodeEquals (used by fastcall) */ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL return PyObject_RichCompareBool(s1, s2, equals); #else int s1_is_unicode, s2_is_unicode; if (s1 == s2) { goto return_eq; } s1_is_unicode = PyUnicode_CheckExact(s1); s2_is_unicode = PyUnicode_CheckExact(s2); if (s1_is_unicode & s2_is_unicode) { Py_ssize_t length, length2; int kind; void *data1, *data2; #if !CYTHON_COMPILING_IN_LIMITED_API if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) return -1; #endif length = __Pyx_PyUnicode_GET_LENGTH(s1); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(length < 0)) return -1; #endif length2 = __Pyx_PyUnicode_GET_LENGTH(s2); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(length2 < 0)) return -1; #endif if (length != length2) { goto return_ne; } #if CYTHON_USE_UNICODE_INTERNALS { Py_hash_t hash1, hash2; hash1 = ((PyASCIIObject*)s1)->hash; hash2 = ((PyASCIIObject*)s2)->hash; if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { goto return_ne; } } #endif kind = __Pyx_PyUnicode_KIND(s1); if (kind != __Pyx_PyUnicode_KIND(s2)) { goto return_ne; } data1 = __Pyx_PyUnicode_DATA(s1); data2 = __Pyx_PyUnicode_DATA(s2); if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { goto return_ne; } else if (length == 1) { goto return_eq; } else { int result = memcmp(data1, data2, (size_t)(length * kind)); return (equals == Py_EQ) ? (result == 0) : (result != 0); } } else if ((s1 == Py_None) & s2_is_unicode) { goto return_ne; } else if ((s2 == Py_None) & s1_is_unicode) { goto return_ne; } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); Py_DECREF(py_result); return result; } return_eq: return (equals == Py_EQ); return_ne: return (equals == Py_NE); #endif } /* fastcall */ #if CYTHON_METH_FASTCALL static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) { Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(n == -1)) return NULL; #endif for (i = 0; i < n; i++) { PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely(!namei)) return NULL; #endif if (s == namei) return kwvalues[i]; } for (i = 0; i < n; i++) { PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely(!namei)) return NULL; #endif int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ); if (unlikely(eq != 0)) { if (unlikely(eq < 0)) return NULL; return kwvalues[i]; } } return NULL; } #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { Py_ssize_t i, nkwargs; PyObject *dict; #if !CYTHON_ASSUME_SAFE_SIZE nkwargs = PyTuple_Size(kwnames); if (unlikely(nkwargs < 0)) return NULL; #else nkwargs = PyTuple_GET_SIZE(kwnames); #endif dict = PyDict_New(); if (unlikely(!dict)) return NULL; for (i=0; itp_call; if (unlikely(!call)) return PyObject_Call(func, arg, kw); if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) return NULL; result = (*call)(func, arg, kw); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* PyObjectCallMethO (used by PyObjectFastCall) */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { PyObject *self, *result; PyCFunction cfunc; cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); self = __Pyx_CyOrPyCFunction_GET_SELF(func); if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) return NULL; result = cfunc(self, arg); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* PyObjectFastCall (used by PyObjectCallOneArg) */ #if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) { PyObject *argstuple; PyObject *result = 0; size_t i; argstuple = PyTuple_New((Py_ssize_t)nargs); if (unlikely(!argstuple)) return NULL; for (i = 0; i < nargs; i++) { Py_INCREF(args[i]); if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad; } result = __Pyx_PyObject_Call(func, argstuple, kwargs); bad: Py_DECREF(argstuple); return result; } #endif #if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API #if PY_VERSION_HEX < 0x03090000 #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable) #elif CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) { PyTypeObject *tp = Py_TYPE(callable); #if defined(__Pyx_CyFunction_USED) if (__Pyx_CyFunction_CheckExact(callable)) { return __Pyx_CyFunction_func_vectorcall(callable); } #endif if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) { return NULL; } assert(PyCallable_Check(callable)); Py_ssize_t offset = tp->tp_vectorcall_offset; assert(offset > 0); vectorcallfunc ptr; memcpy(&ptr, (char *) callable + offset, sizeof(ptr)); return ptr; } #else #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable) #endif #endif static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) { Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); #if CYTHON_COMPILING_IN_CPYTHON if (nargs == 0 && kwargs == NULL) { if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) return __Pyx_PyObject_CallMethO(func, NULL); } else if (nargs == 1 && kwargs == NULL) { if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) return __Pyx_PyObject_CallMethO(func, args[0]); } #endif if (kwargs == NULL) { #if CYTHON_VECTORCALL #if CYTHON_COMPILING_IN_LIMITED_API return PyObject_Vectorcall(func, args, _nargs, NULL); #else vectorcallfunc f = __Pyx_PyVectorcall_Function(func); if (f) { return f(func, args, _nargs, NULL); } #endif #endif } if (nargs == 0) { return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs); } #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); #else return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); #endif } /* PyObjectCallOneArg (used by CallUnboundCMethod0) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *args[2] = {NULL, arg}; return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } /* PyObjectGetAttrStr (used by UnpackUnboundCMethod) */ #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); return PyObject_GetAttr(obj, attr_name); } #endif /* UnpackUnboundCMethod (used by CallUnboundCMethod0) */ #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { PyObject *result; PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); if (unlikely(!selfless_args)) return NULL; result = PyObject_Call(method, selfless_args, kwargs); Py_DECREF(selfless_args); return result; } #elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000 static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { return _PyObject_Vectorcall (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames); } #else static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { return #if PY_VERSION_HEX < 0x03090000 _PyObject_Vectorcall #else PyObject_Vectorcall #endif (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames); } #endif static PyMethodDef __Pyx_UnboundCMethod_Def = { "CythonUnboundCMethod", __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall), #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 METH_VARARGS | METH_KEYWORDS, #else METH_FASTCALL | METH_KEYWORDS, #endif NULL }; static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { PyObject *method, *result=NULL; method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); if (unlikely(!method)) return -1; result = method; #if CYTHON_COMPILING_IN_CPYTHON if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) { PyMethodDescrObject *descr = (PyMethodDescrObject*) method; target->func = descr->d_method->ml_meth; target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); } else #endif #if CYTHON_COMPILING_IN_PYPY #else if (PyCFunction_Check(method)) #endif { PyObject *self; int self_found; #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY self = PyObject_GetAttrString(method, "__self__"); if (!self) { PyErr_Clear(); } #else self = PyCFunction_GET_SELF(method); #endif self_found = (self && self != Py_None); #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY Py_XDECREF(self); #endif if (self_found) { PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method); if (unlikely(!unbound_method)) return -1; Py_DECREF(method); result = unbound_method; } } #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING if (unlikely(target->method)) { Py_DECREF(result); } else #endif target->method = result; return 0; } /* CallUnboundCMethod0 */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); if (likely(was_initialized == 2 && cfunc->func)) { if (likely(cfunc->flag == METH_NOARGS)) return __Pyx_CallCFunction(cfunc, self, NULL); if (likely(cfunc->flag == METH_FASTCALL)) return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0); if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL); if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS))) return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL); if (cfunc->flag == METH_VARARGS) return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple); return __Pyx__CallUnboundCMethod0(cfunc, self); } #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING else if (unlikely(was_initialized == 1)) { __Pyx_CachedCFunction tmp_cfunc = { #ifndef __cplusplus 0 #endif }; tmp_cfunc.type = cfunc->type; tmp_cfunc.method_name = cfunc->method_name; return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self); } #endif PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self); __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); return result; } #endif static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { PyObject *result; if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; result = __Pyx_PyObject_CallOneArg(cfunc->method, self); return result; } /* py_dict_items (used by OwnedDictNext) */ static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) { return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d); } /* py_dict_values (used by OwnedDictNext) */ static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) { return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d); } /* OwnedDictNext (used by RejectKeywords) */ #if CYTHON_AVOID_BORROWED_REFS static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) { PyObject *next = NULL; if (!*ppos) { if (pvalue) { PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p); if (unlikely(!dictview)) goto bad; *ppos = PyObject_GetIter(dictview); Py_DECREF(dictview); } else { *ppos = PyObject_GetIter(p); } if (unlikely(!*ppos)) goto bad; } next = PyIter_Next(*ppos); if (!next) { if (PyErr_Occurred()) goto bad; return 0; } if (pkey && pvalue) { *pkey = __Pyx_PySequence_ITEM(next, 0); if (unlikely(*pkey)) goto bad; *pvalue = __Pyx_PySequence_ITEM(next, 1); if (unlikely(*pvalue)) goto bad; Py_DECREF(next); } else if (pkey) { *pkey = next; } else { assert(pvalue); *pvalue = next; } return 1; bad: Py_XDECREF(next); #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef"); #else PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef); #endif if (pkey) *pkey = NULL; if (pvalue) *pvalue = NULL; return 0; } #else // !CYTHON_AVOID_BORROWED_REFS static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) { int result = PyDict_Next(p, ppos, pkey, pvalue); if (likely(result == 1)) { if (pkey) Py_INCREF(*pkey); if (pvalue) Py_INCREF(*pvalue); } return result; } #endif /* RejectKeywords */ static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds) { PyObject *key = NULL; if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) { key = __Pyx_PySequence_ITEM(kwds, 0); } else { #if CYTHON_AVOID_BORROWED_REFS PyObject *pos = NULL; #else Py_ssize_t pos = 0; #endif #if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return; #endif __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL); #if CYTHON_AVOID_BORROWED_REFS Py_XDECREF(pos); #endif } if (likely(key)) { PyErr_Format(PyExc_TypeError, "%s() got an unexpected keyword argument '%U'", function_name, key); Py_DECREF(key); } } /* PyErrFetchRestore (used by RaiseException) */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { #if PY_VERSION_HEX >= 0x030C00A6 PyObject *tmp_value; assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); if (value) { #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) #endif PyException_SetTraceback(value, tb); } tmp_value = tstate->current_exception; tstate->current_exception = value; Py_XDECREF(tmp_value); Py_XDECREF(type); Py_XDECREF(tb); #else 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); #endif } static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { #if PY_VERSION_HEX >= 0x030C00A6 PyObject* exc_value; exc_value = tstate->current_exception; tstate->current_exception = 0; *value = exc_value; *type = NULL; *tb = NULL; if (exc_value) { *type = (PyObject*) Py_TYPE(exc_value); Py_INCREF(*type); #if CYTHON_COMPILING_IN_CPYTHON *tb = ((PyBaseExceptionObject*) exc_value)->traceback; Py_XINCREF(*tb); #else *tb = PyException_GetTraceback(exc_value); #endif } #else *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 } #endif /* RaiseException */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *instance_class = NULL; if (value && PyExceptionInstance_Check(value)) { instance_class = (PyObject*) Py_TYPE(value); if (instance_class != type) { int is_subclass = PyObject_IsSubclass(instance_class, type); if (!is_subclass) { instance_class = NULL; } else if (unlikely(is_subclass == -1)) { goto bad; } else { type = instance_class; } } } if (!instance_class) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyObject_Call(type, args, NULL); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } if (cause) { PyObject *fixed_cause; if (cause == Py_None) { fixed_cause = NULL; } else if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { #if PY_VERSION_HEX >= 0x030C00A6 PyException_SetTraceback(value, tb); #elif CYTHON_FAST_THREAD_STATE PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } #else PyObject *tmp_type, *tmp_value, *tmp_tb; PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); Py_INCREF(tb); PyErr_Restore(tmp_type, tmp_value, tb); Py_XDECREF(tmp_tb); #endif } bad: Py_XDECREF(owned_instance); return; } /* WriteUnraisableException */ static void __Pyx_WriteUnraisable(const char *name, int clineno, int lineno, const char *filename, int full_traceback, int nogil) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; __Pyx_PyThreadState_declare PyGILState_STATE state; if (nogil) state = PyGILState_Ensure(); else state = (PyGILState_STATE)0; CYTHON_UNUSED_VAR(clineno); CYTHON_UNUSED_VAR(lineno); CYTHON_UNUSED_VAR(filename); CYTHON_MAYBE_UNUSED_VAR(nogil); __Pyx_PyThreadState_assign __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); if (full_traceback) { Py_XINCREF(old_exc); Py_XINCREF(old_val); Py_XINCREF(old_tb); __Pyx_ErrRestore(old_exc, old_val, old_tb); PyErr_PrintEx(0); } ctx = PyUnicode_FromString(name); __Pyx_ErrRestore(old_exc, old_val, old_tb); if (!ctx) { PyErr_WriteUnraisable(Py_None); } else { PyErr_WriteUnraisable(ctx); Py_DECREF(ctx); } if (nogil) PyGILState_Release(state); } /* RaiseDoubleKeywords (used by ParseKeywordsImpl) */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, "%s() got multiple values for keyword argument '%U'", func_name, kw_name); } /* CallUnboundCMethod2 */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); if (likely(was_initialized == 2 && cfunc->func)) { PyObject *args[2] = {arg1, arg2}; if (cfunc->flag == METH_FASTCALL) { return __Pyx_CallCFunctionFast(cfunc, self, args, 2); } if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL); } #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING else if (unlikely(was_initialized == 1)) { __Pyx_CachedCFunction tmp_cfunc = { #ifndef __cplusplus 0 #endif }; tmp_cfunc.type = cfunc->type; tmp_cfunc.method_name = cfunc->method_name; return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2); } #endif PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2); __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); return result; } #endif static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){ if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; #if CYTHON_COMPILING_IN_CPYTHON if (cfunc->func && (cfunc->flag & METH_VARARGS)) { PyObject *result = NULL; PyObject *args = PyTuple_New(2); if (unlikely(!args)) return NULL; Py_INCREF(arg1); PyTuple_SET_ITEM(args, 0, arg1); Py_INCREF(arg2); PyTuple_SET_ITEM(args, 1, arg2); if (cfunc->flag & METH_KEYWORDS) result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL); else result = __Pyx_CallCFunction(cfunc, self, args); Py_DECREF(args); return result; } #endif { PyObject *args[4] = {NULL, self, arg1, arg2}; return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } } /* ParseKeywordsImpl (used by ParseKeywords) */ static int __Pyx_ValidateDuplicatePosArgs( PyObject *kwds, PyObject ** const argnames[], PyObject ** const *first_kw_arg, const char* function_name) { PyObject ** const *name = argnames; while (name != first_kw_arg) { PyObject *key = **name; int found = PyDict_Contains(kwds, key); if (unlikely(found)) { if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; } name++; } return 0; bad: return -1; } #if CYTHON_USE_UNICODE_INTERNALS static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) { int kind; Py_ssize_t len = PyUnicode_GET_LENGTH(s1); if (len != PyUnicode_GET_LENGTH(s2)) return 0; kind = PyUnicode_KIND(s1); if (kind != PyUnicode_KIND(s2)) return 0; const void *data1 = PyUnicode_DATA(s1); const void *data2 = PyUnicode_DATA(s2); return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0); } #endif static int __Pyx_MatchKeywordArg_str( PyObject *key, PyObject ** const argnames[], PyObject ** const *first_kw_arg, size_t *index_found, const char *function_name) { PyObject ** const *name; #if CYTHON_USE_UNICODE_INTERNALS Py_hash_t key_hash = ((PyASCIIObject*)key)->hash; if (unlikely(key_hash == -1)) { key_hash = PyObject_Hash(key); if (unlikely(key_hash == -1)) goto bad; } #endif name = first_kw_arg; while (*name) { PyObject *name_str = **name; #if CYTHON_USE_UNICODE_INTERNALS if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) { *index_found = (size_t) (name - argnames); return 1; } #else #if CYTHON_ASSUME_SAFE_SIZE if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) #endif { int cmp = PyUnicode_Compare(name_str, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { *index_found = (size_t) (name - argnames); return 1; } } #endif name++; } name = argnames; while (name != first_kw_arg) { PyObject *name_str = **name; #if CYTHON_USE_UNICODE_INTERNALS if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) { if (__Pyx_UnicodeKeywordsEqual(name_str, key)) goto arg_passed_twice; } #else #if CYTHON_ASSUME_SAFE_SIZE if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) #endif { if (unlikely(name_str == key)) goto arg_passed_twice; int cmp = PyUnicode_Compare(name_str, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; } #endif name++; } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; bad: return -1; } static int __Pyx_MatchKeywordArg_nostr( PyObject *key, PyObject ** const argnames[], PyObject ** const *first_kw_arg, size_t *index_found, const char *function_name) { PyObject ** const *name; if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type; name = first_kw_arg; while (*name) { int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); if (cmp == 1) { *index_found = (size_t) (name - argnames); return 1; } if (unlikely(cmp == -1)) goto bad; name++; } name = argnames; while (name != first_kw_arg) { int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); if (unlikely(cmp != 0)) { if (cmp == 1) goto arg_passed_twice; else goto bad; } name++; } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%.200s() keywords must be strings", function_name); goto bad; bad: return -1; } static CYTHON_INLINE int __Pyx_MatchKeywordArg( PyObject *key, PyObject ** const argnames[], PyObject ** const *first_kw_arg, size_t *index_found, const char *function_name) { return likely(PyUnicode_CheckExact(key)) ? __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) : __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name); } static void __Pyx_RejectUnknownKeyword( PyObject *kwds, PyObject ** const argnames[], PyObject ** const *first_kw_arg, const char *function_name) { #if CYTHON_AVOID_BORROWED_REFS PyObject *pos = NULL; #else Py_ssize_t pos = 0; #endif PyObject *key = NULL; __Pyx_BEGIN_CRITICAL_SECTION(kwds); while ( #if CYTHON_AVOID_BORROWED_REFS __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL) #else PyDict_Next(kwds, &pos, &key, NULL) #endif ) { PyObject** const *name = first_kw_arg; while (*name && (**name != key)) name++; if (!*name) { size_t index_found = 0; int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); if (cmp != 1) { if (cmp == 0) { PyErr_Format(PyExc_TypeError, "%s() got an unexpected keyword argument '%U'", function_name, key); } #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(key); #endif break; } } #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(key); #endif } __Pyx_END_CRITICAL_SECTION(); #if CYTHON_AVOID_BORROWED_REFS Py_XDECREF(pos); #endif assert(PyErr_Occurred()); } static int __Pyx_ParseKeywordDict( PyObject *kwds, PyObject ** const argnames[], PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs) { PyObject** const *name; PyObject** const *first_kw_arg = argnames + num_pos_args; Py_ssize_t extracted = 0; #if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; #endif name = first_kw_arg; while (*name && num_kwargs > extracted) { PyObject * key = **name; PyObject *value; int found = 0; #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 found = PyDict_GetItemRef(kwds, key, &value); #else value = PyDict_GetItemWithError(kwds, key); if (value) { Py_INCREF(value); found = 1; } else { if (unlikely(PyErr_Occurred())) goto bad; } #endif if (found) { if (unlikely(found < 0)) goto bad; values[name-argnames] = value; extracted++; } name++; } if (num_kwargs > extracted) { if (ignore_unknown_kwargs) { if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1)) goto bad; } else { __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name); goto bad; } } return 0; bad: return -1; } static int __Pyx_ParseKeywordDictToDict( PyObject *kwds, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject** const *name; PyObject** const *first_kw_arg = argnames + num_pos_args; Py_ssize_t len; #if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; #endif if (PyDict_Update(kwds2, kwds) < 0) goto bad; name = first_kw_arg; while (*name) { PyObject *key = **name; PyObject *value; #if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop)) int found = PyDict_Pop(kwds2, key, &value); if (found) { if (unlikely(found < 0)) goto bad; values[name-argnames] = value; } #elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 int found = PyDict_GetItemRef(kwds2, key, &value); if (found) { if (unlikely(found < 0)) goto bad; values[name-argnames] = value; if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad; } #else #if CYTHON_COMPILING_IN_CPYTHON value = _PyDict_Pop(kwds2, key, kwds2); #else value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2); #endif if (value == kwds2) { Py_DECREF(value); } else { if (unlikely(!value)) goto bad; values[name-argnames] = value; } #endif name++; } len = PyDict_Size(kwds2); if (len > 0) { return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name); } else if (unlikely(len == -1)) { goto bad; } return 0; bad: return -1; } static int __Pyx_ParseKeywordsTuple( PyObject *kwds, PyObject * const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs) { PyObject *key = NULL; PyObject** const * name; PyObject** const *first_kw_arg = argnames + num_pos_args; for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) { #if CYTHON_AVOID_BORROWED_REFS key = __Pyx_PySequence_ITEM(kwds, pos); #else key = __Pyx_PyTuple_GET_ITEM(kwds, pos); #endif #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely(!key)) goto bad; #endif name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { PyObject *value = kwvalues[pos]; values[name-argnames] = __Pyx_NewRef(value); } else { size_t index_found = 0; int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); if (cmp == 1) { PyObject *value = kwvalues[pos]; values[index_found] = __Pyx_NewRef(value); } else { if (unlikely(cmp == -1)) goto bad; if (kwds2) { PyObject *value = kwvalues[pos]; if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else if (!ignore_unknown_kwargs) { goto invalid_keyword; } } } #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(key); key = NULL; #endif } return 0; invalid_keyword: PyErr_Format(PyExc_TypeError, "%s() got an unexpected keyword argument '%U'", function_name, key); goto bad; bad: #if CYTHON_AVOID_BORROWED_REFS Py_XDECREF(key); #endif return -1; } /* ParseKeywords */ static int __Pyx_ParseKeywords( PyObject *kwds, PyObject * const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs) { if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); else if (kwds2) return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name); else return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); } /* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */ #if CYTHON_FAST_THREAD_STATE static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(tuple); for (i=0; i= 0x030C00A6 PyObject *current_exception = tstate->current_exception; if (unlikely(!current_exception)) return 0; exc_type = (PyObject*) Py_TYPE(current_exception); if (exc_type == err) return 1; #else exc_type = tstate->curexc_type; if (exc_type == err) return 1; if (unlikely(!exc_type)) return 0; #endif #if CYTHON_AVOID_BORROWED_REFS Py_INCREF(exc_type); #endif if (unlikely(PyTuple_Check(err))) { result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); } else { result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); } #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(exc_type); #endif return result; } #endif /* PyObjectGetAttrStrNoError (used by GetBuiltinName) */ #if __PYX_LIMITED_VERSION_HEX < 0x030d0000 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) __Pyx_PyErr_Clear(); } #endif static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { PyObject *result; #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 (void) PyObject_GetOptionalAttr(obj, attr_name, &result); return result; #else #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); } #endif result = __Pyx_PyObject_GetAttrStr(obj, attr_name); if (unlikely(!result)) { __Pyx_PyObject_GetAttrStr_ClearAttributeError(); } return result; #endif } /* GetBuiltinName (used by GetModuleGlobalName) */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name); if (unlikely(!result) && !PyErr_Occurred()) { PyErr_Format(PyExc_NameError, "name '%U' is not defined", name); } return result; } /* PyDictVersioning (used by GetModuleGlobalName) */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { PyObject *dict = Py_TYPE(obj)->tp_dict; return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; } static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { PyObject **dictptr = NULL; Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; if (offset) { #if CYTHON_COMPILING_IN_CPYTHON dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); #else dictptr = _PyObject_GetDictPtr(obj); #endif } return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; } static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { PyObject *dict = Py_TYPE(obj)->tp_dict; if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) return 0; return obj_dict_version == __Pyx_get_object_dict_version(obj); } #endif /* GetModuleGlobalName */ #if CYTHON_USE_DICT_VERSIONS static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) #else static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) #endif { PyObject *result; #if CYTHON_COMPILING_IN_LIMITED_API if (unlikely(!__pyx_m)) { if (!PyErr_Occurred()) PyErr_SetNone(PyExc_NameError); return NULL; } result = PyObject_GetAttr(__pyx_m, name); if (likely(result)) { return result; } PyErr_Clear(); #elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear(); __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { return result; } #else result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash); __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { return __Pyx_NewRef(result); } PyErr_Clear(); #endif return __Pyx_GetBuiltinName(name); } /* CIntToDigits (used by CIntToPyUnicode) */ static const char DIGIT_PAIRS_10[2*10*10+1] = { "00010203040506070809" "10111213141516171819" "20212223242526272829" "30313233343536373839" "40414243444546474849" "50515253545556575859" "60616263646566676869" "70717273747576777879" "80818283848586878889" "90919293949596979899" }; static const char DIGIT_PAIRS_8[2*8*8+1] = { "0001020304050607" "1011121314151617" "2021222324252627" "3031323334353637" "4041424344454647" "5051525354555657" "6061626364656667" "7071727374757677" }; static const char DIGITS_HEX[2*16+1] = { "0123456789abcdef" "0123456789ABCDEF" }; /* BuildPyUnicode (used by COrdinalToPyUnicode) */ static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, const char* chars, int clength, int prepend_sign, char padding_char) { PyObject *uval; Py_ssize_t uoffset = ulength - clength; #if CYTHON_USE_UNICODE_INTERNALS Py_ssize_t i; void *udata; uval = PyUnicode_New(ulength, 127); if (unlikely(!uval)) return NULL; udata = PyUnicode_DATA(uval); if (uoffset > 0) { i = 0; if (prepend_sign) { __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, 0, '-'); i++; } for (; i < uoffset; i++) { __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, i, padding_char); } } for (i=0; i < clength; i++) { __Pyx_PyUnicode_WRITE(PyUnicode_1BYTE_KIND, udata, uoffset+i, chars[i]); } #else { PyObject *sign = NULL, *padding = NULL; uval = NULL; if (uoffset > 0) { prepend_sign = !!prepend_sign; if (uoffset > prepend_sign) { padding = PyUnicode_FromOrdinal(padding_char); if (likely(padding) && uoffset > prepend_sign + 1) { PyObject *tmp = PySequence_Repeat(padding, uoffset - prepend_sign); Py_DECREF(padding); padding = tmp; } if (unlikely(!padding)) goto done_or_error; } if (prepend_sign) { sign = PyUnicode_FromOrdinal('-'); if (unlikely(!sign)) goto done_or_error; } } uval = PyUnicode_DecodeASCII(chars, clength, NULL); if (likely(uval) && padding) { PyObject *tmp = PyUnicode_Concat(padding, uval); Py_DECREF(uval); uval = tmp; } if (likely(uval) && sign) { PyObject *tmp = PyUnicode_Concat(sign, uval); Py_DECREF(uval); uval = tmp; } done_or_error: Py_XDECREF(padding); Py_XDECREF(sign); } #endif return uval; } /* COrdinalToPyUnicode (used by CIntToPyUnicode) */ static CYTHON_INLINE int __Pyx_CheckUnicodeValue(int value) { return value <= 1114111; } static PyObject* __Pyx_PyUnicode_FromOrdinal_Padded(int value, Py_ssize_t ulength, char padding_char) { Py_ssize_t padding_length = ulength - 1; if (likely((padding_length <= 250) && (value < 0xD800 || value > 0xDFFF))) { char chars[256]; if (value <= 255) { memset(chars, padding_char, (size_t) padding_length); chars[ulength-1] = (char) value; return PyUnicode_DecodeLatin1(chars, ulength, NULL); } char *cpos = chars + sizeof(chars); if (value < 0x800) { *--cpos = (char) (0x80 | (value & 0x3f)); value >>= 6; *--cpos = (char) (0xc0 | (value & 0x1f)); } else if (value < 0x10000) { *--cpos = (char) (0x80 | (value & 0x3f)); value >>= 6; *--cpos = (char) (0x80 | (value & 0x3f)); value >>= 6; *--cpos = (char) (0xe0 | (value & 0x0f)); } else { *--cpos = (char) (0x80 | (value & 0x3f)); value >>= 6; *--cpos = (char) (0x80 | (value & 0x3f)); value >>= 6; *--cpos = (char) (0x80 | (value & 0x3f)); value >>= 6; *--cpos = (char) (0xf0 | (value & 0x07)); } cpos -= padding_length; memset(cpos, padding_char, (size_t) padding_length); return PyUnicode_DecodeUTF8(cpos, chars + sizeof(chars) - cpos, NULL); } if (value <= 127 && CYTHON_USE_UNICODE_INTERNALS) { const char chars[1] = {(char) value}; return __Pyx_PyUnicode_BuildFromAscii(ulength, chars, 1, 0, padding_char); } { PyObject *uchar, *padding_uchar, *padding, *result; padding_uchar = PyUnicode_FromOrdinal(padding_char); if (unlikely(!padding_uchar)) return NULL; padding = PySequence_Repeat(padding_uchar, padding_length); Py_DECREF(padding_uchar); if (unlikely(!padding)) return NULL; uchar = PyUnicode_FromOrdinal(value); if (unlikely(!uchar)) { Py_DECREF(padding); return NULL; } result = PyUnicode_Concat(padding, uchar); Py_DECREF(padding); Py_DECREF(uchar); return result; } } /* CIntToPyUnicode */ static CYTHON_INLINE PyObject* __Pyx_uchar___Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const int neg_one = (int) -1, const_zero = (int) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (unlikely(!(is_unsigned || value == 0 || value > 0) || !(sizeof(value) <= 2 || value & ~ (int) 0x01fffff || __Pyx_CheckUnicodeValue((int) value)))) { PyErr_SetString(PyExc_OverflowError, "%c arg not in range(0x110000)"); return NULL; } if (width <= 1) { return PyUnicode_FromOrdinal((int) value); } return __Pyx_PyUnicode_FromOrdinal_Padded((int) value, width, padding_char); } static CYTHON_INLINE PyObject* __Pyx____Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char) { char digits[sizeof(int)*3+2]; char *dpos, *end = digits + sizeof(int)*3+2; const char *hex_digits = DIGITS_HEX; Py_ssize_t length, ulength; int prepend_sign, last_one_off; int remaining; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const int neg_one = (int) -1, const_zero = (int) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (format_char == 'X') { hex_digits += 16; format_char = 'x'; } remaining = value; last_one_off = 0; dpos = end; do { int digit_pos; switch (format_char) { case 'o': digit_pos = abs((int)(remaining % (8*8))); remaining = (int) (remaining / (8*8)); dpos -= 2; memcpy(dpos, DIGIT_PAIRS_8 + digit_pos * 2, 2); last_one_off = (digit_pos < 8); break; case 'd': digit_pos = abs((int)(remaining % (10*10))); remaining = (int) (remaining / (10*10)); dpos -= 2; memcpy(dpos, DIGIT_PAIRS_10 + digit_pos * 2, 2); last_one_off = (digit_pos < 10); break; case 'x': *(--dpos) = hex_digits[abs((int)(remaining % 16))]; remaining = (int) (remaining / 16); break; default: assert(0); break; } } while (unlikely(remaining != 0)); assert(!last_one_off || *dpos == '0'); dpos += last_one_off; length = end - dpos; ulength = length; prepend_sign = 0; if (!is_unsigned && value <= neg_one) { if (padding_char == ' ' || width <= length + 1) { *(--dpos) = '-'; ++length; } else { prepend_sign = 1; } ++ulength; } if (width > ulength) { ulength = width; } if (ulength == 1) { return PyUnicode_FromOrdinal(*dpos); } return __Pyx_PyUnicode_BuildFromAscii(ulength, dpos, (int) length, prepend_sign, padding_char); } /* JoinPyUnicode */ static PyObject* __Pyx_PyUnicode_Join(PyObject** values, Py_ssize_t value_count, Py_ssize_t result_ulength, Py_UCS4 max_char) { #if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS PyObject *result_uval; int result_ukind, kind_shift; Py_ssize_t i, char_pos; void *result_udata; if (max_char > 1114111) max_char = 1114111; result_uval = PyUnicode_New(result_ulength, max_char); if (unlikely(!result_uval)) return NULL; result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1; result_udata = PyUnicode_DATA(result_uval); assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0); if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - result_ulength < 0)) goto overflow; char_pos = 0; for (i=0; i < value_count; i++) { int ukind; Py_ssize_t ulength; void *udata; PyObject *uval = values[i]; #if !CYTHON_COMPILING_IN_LIMITED_API if (__Pyx_PyUnicode_READY(uval) == (-1)) goto bad; #endif ulength = __Pyx_PyUnicode_GET_LENGTH(uval); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(ulength < 0)) goto bad; #endif if (unlikely(!ulength)) continue; if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos)) goto overflow; ukind = __Pyx_PyUnicode_KIND(uval); udata = __Pyx_PyUnicode_DATA(uval); if (ukind == result_ukind) { memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift)); } else { #if PY_VERSION_HEX >= 0x030d0000 if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad; #elif CYTHON_COMPILING_IN_CPYTHON || defined(_PyUnicode_FastCopyCharacters) _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); #else Py_ssize_t j; for (j=0; j < ulength; j++) { Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); } #endif } char_pos += ulength; } return result_uval; overflow: PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); bad: Py_DECREF(result_uval); return NULL; #else Py_ssize_t i; PyObject *result = NULL; PyObject *value_tuple = PyTuple_New(value_count); if (unlikely(!value_tuple)) return NULL; CYTHON_UNUSED_VAR(max_char); CYTHON_UNUSED_VAR(result_ulength); for (i=0; i__pyx_empty_unicode, value_tuple); bad: Py_DECREF(value_tuple); return result; #endif } /* pybuiltin_invalid (used by pyint_simplify) */ static void __Pyx_PyBuiltin_Invalid(PyObject *obj, const char *type_name, const char *argname) { __Pyx_TypeName obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); if (argname) { PyErr_Format(PyExc_TypeError, "Argument '%.200s' has incorrect type (expected %.200s, got " __Pyx_FMT_TYPENAME ")", argname, type_name, obj_type_name ); } else { PyErr_Format(PyExc_TypeError, "Expected %.200s, got " __Pyx_FMT_TYPENAME, type_name, obj_type_name ); } __Pyx_DECREF_TypeName(obj_type_name); } /* pyint_simplify */ static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none) { PyObject *number = *number_var; if (likely((accept_none && number == Py_None) || PyLong_CheckExact(number))) { return 0; } PyObject *int_object; if (likely(PyNumber_Check(number))) { int_object = PyNumber_Long(number); if (unlikely(!int_object)) goto bad; } else { __Pyx_PyBuiltin_Invalid(number, "int", argname); goto bad; } *number_var = int_object; Py_DECREF(number); return 0; bad: *number_var = NULL; Py_DECREF(number); return -1; } /* ArgTypeTestFunc (used by ArgTypeTest) */ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) { __Pyx_TypeName type_name; __Pyx_TypeName obj_type_name; PyObject *extra_info = __pyx_mstate_global->__pyx_empty_unicode; int from_annotation_subclass = 0; if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } else if (!exact) { if (likely(__Pyx_TypeCheck(obj, type))) return 1; } else if (exact == 2) { if (__Pyx_TypeCheck(obj, type)) { from_annotation_subclass = 1; extra_info = __pyx_mstate_global->__pyx_kp_u_Note_that_Cython_is_deliberately; } } type_name = __Pyx_PyType_GetFullyQualifiedName(type); obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj)); PyErr_Format(PyExc_TypeError, "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME ", got " __Pyx_FMT_TYPENAME ")" #if __PYX_LIMITED_VERSION_HEX < 0x030C0000 "%s%U" #endif , name, type_name, obj_type_name #if __PYX_LIMITED_VERSION_HEX < 0x030C0000 , (from_annotation_subclass ? ". " : ""), extra_info #endif ); #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 if (exact == 2 && from_annotation_subclass) { PyObject *res; PyObject *vargs[2]; vargs[0] = PyErr_GetRaisedException(); vargs[1] = extra_info; res = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_kp_u_add_note, vargs, 2, NULL); Py_XDECREF(res); PyErr_SetRaisedException(vargs[0]); } #endif __Pyx_DECREF_TypeName(type_name); __Pyx_DECREF_TypeName(obj_type_name); return 0; } /* PyObjectFastCallMethod */ #if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000 static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) { PyObject *result; PyObject *attr = PyObject_GetAttr(args[0], name); if (unlikely(!attr)) return NULL; result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1); Py_DECREF(attr); return result; } #endif /* PyUnicode_Unicode */ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Unicode(PyObject *obj) { if (unlikely(obj == Py_None)) obj = __pyx_mstate_global->__pyx_kp_u_None; return __Pyx_NewRef(obj); } /* decode_c_bytes (used by decode_bytes) */ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { if (unlikely((start < 0) | (stop < 0))) { if (start < 0) { start += length; if (start < 0) start = 0; } if (stop < 0) stop += length; } if (stop > length) stop = length; if (unlikely(stop <= start)) return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_unicode); length = stop - start; cstring += start; if (decode_func) { return decode_func(cstring, length, errors); } else { return PyUnicode_Decode(cstring, length, encoding, errors); } } /* GetTopmostException (used by SaveResetException) */ #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate) { _PyErr_StackItem *exc_info = tstate->exc_info; while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && exc_info->previous_item != NULL) { exc_info = exc_info->previous_item; } return exc_info; } #endif /* SaveResetException */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); PyObject *exc_value = exc_info->exc_value; if (exc_value == NULL || exc_value == Py_None) { *value = NULL; *type = NULL; *tb = NULL; } else { *value = exc_value; Py_INCREF(*value); *type = (PyObject*) Py_TYPE(exc_value); Py_INCREF(*type); *tb = PyException_GetTraceback(exc_value); } #elif CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); *type = exc_info->exc_type; *value = exc_info->exc_value; *tb = exc_info->exc_traceback; Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); #else *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); #endif } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 _PyErr_StackItem *exc_info = tstate->exc_info; PyObject *tmp_value = exc_info->exc_value; exc_info->exc_value = value; Py_XDECREF(tmp_value); Py_XDECREF(type); Py_XDECREF(tb); #else PyObject *tmp_type, *tmp_value, *tmp_tb; #if CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = type; exc_info->exc_value = value; exc_info->exc_traceback = tb; #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = type; tstate->exc_value = value; tstate->exc_traceback = tb; #endif Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #endif } #endif /* GetException */ #if CYTHON_FAST_THREAD_STATE static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) #else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #endif { PyObject *local_type = NULL, *local_value, *local_tb = NULL; #if CYTHON_FAST_THREAD_STATE PyObject *tmp_type, *tmp_value, *tmp_tb; #if PY_VERSION_HEX >= 0x030C0000 local_value = tstate->current_exception; tstate->current_exception = 0; #else local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; #endif #elif __PYX_LIMITED_VERSION_HEX > 0x030C0000 local_value = PyErr_GetRaisedException(); #else PyErr_Fetch(&local_type, &local_value, &local_tb); #endif #if __PYX_LIMITED_VERSION_HEX > 0x030C0000 if (likely(local_value)) { local_type = (PyObject*) Py_TYPE(local_value); Py_INCREF(local_type); local_tb = PyException_GetTraceback(local_value); } #else PyErr_NormalizeException(&local_type, &local_value, &local_tb); #if CYTHON_FAST_THREAD_STATE if (unlikely(tstate->curexc_type)) #else if (unlikely(PyErr_Occurred())) #endif goto bad; if (local_tb) { if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) goto bad; } #endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000 Py_XINCREF(local_tb); Py_XINCREF(local_type); Py_XINCREF(local_value); *type = local_type; *value = local_value; *tb = local_tb; #if CYTHON_FAST_THREAD_STATE #if CYTHON_USE_EXC_INFO_STACK { _PyErr_StackItem *exc_info = tstate->exc_info; #if PY_VERSION_HEX >= 0x030B00a4 tmp_value = exc_info->exc_value; exc_info->exc_value = local_value; tmp_type = NULL; tmp_tb = NULL; Py_XDECREF(local_type); Py_XDECREF(local_tb); #else tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = local_type; exc_info->exc_value = local_value; exc_info->exc_traceback = local_tb; #endif } #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = local_type; tstate->exc_value = local_value; tstate->exc_traceback = local_tb; #endif Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000 PyErr_SetHandledException(local_value); Py_XDECREF(local_value); Py_XDECREF(local_type); Py_XDECREF(local_tb); #else PyErr_SetExcInfo(local_type, local_value, local_tb); #endif return 0; #if __PYX_LIMITED_VERSION_HEX <= 0x030C0000 bad: *type = 0; *value = 0; *tb = 0; Py_XDECREF(local_type); Py_XDECREF(local_value); Py_XDECREF(local_tb); return -1; #endif } /* SwapException */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 _PyErr_StackItem *exc_info = tstate->exc_info; tmp_value = exc_info->exc_value; exc_info->exc_value = *value; if (tmp_value == NULL || tmp_value == Py_None) { Py_XDECREF(tmp_value); tmp_value = NULL; tmp_type = NULL; tmp_tb = NULL; } else { tmp_type = (PyObject*) Py_TYPE(tmp_value); Py_INCREF(tmp_type); #if CYTHON_COMPILING_IN_CPYTHON tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback; Py_XINCREF(tmp_tb); #else tmp_tb = PyException_GetTraceback(tmp_value); #endif } #elif CYTHON_USE_EXC_INFO_STACK _PyErr_StackItem *exc_info = tstate->exc_info; tmp_type = exc_info->exc_type; tmp_value = exc_info->exc_value; tmp_tb = exc_info->exc_traceback; exc_info->exc_type = *type; exc_info->exc_value = *value; exc_info->exc_traceback = *tb; #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = *type; tstate->exc_value = *value; tstate->exc_traceback = *tb; #endif *type = tmp_type; *value = tmp_value; *tb = tmp_tb; } #else static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); PyErr_SetExcInfo(*type, *value, *tb); *type = tmp_type; *value = tmp_value; *tb = tmp_tb; } #endif /* AllocateExtensionType */ static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) { if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc); return alloc_func(t, 0); } else { newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc); #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 if (!tp_new) { PyObject *new_str = PyUnicode_FromString("__new__"); if (likely(new_str)) { PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL); Py_DECREF(new_str); return o; } else return NULL; } else #endif return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0); } } /* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */ #if CYTHON_COMPILING_IN_LIMITED_API static Py_ssize_t __Pyx_GetTypeDictOffset(void) { PyObject *tp_dictoffset_o; Py_ssize_t tp_dictoffset; tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__"); if (unlikely(!tp_dictoffset_o)) return -1; tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o); Py_DECREF(tp_dictoffset_o); if (unlikely(tp_dictoffset == 0)) { PyErr_SetString( PyExc_TypeError, "'type' doesn't have a dictoffset"); return -1; } else if (unlikely(tp_dictoffset < 0)) { PyErr_SetString( PyExc_TypeError, "'type' has an unexpected negative dictoffset. " "Please report this as Cython bug"); return -1; } return tp_dictoffset; } static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) { static Py_ssize_t tp_dictoffset = 0; if (unlikely(tp_dictoffset == 0)) { tp_dictoffset = __Pyx_GetTypeDictOffset(); if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) { tp_dictoffset = 0; // try again next time? return NULL; } } return *(PyObject**)((char*)tp + tp_dictoffset); } #endif /* SetItemOnTypeDict (used by FixUpExtensionType) */ static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) { int result; PyObject *tp_dict; #if CYTHON_COMPILING_IN_LIMITED_API tp_dict = __Pyx_GetTypeDict(tp); if (unlikely(!tp_dict)) return -1; #else tp_dict = tp->tp_dict; #endif result = PyDict_SetItem(tp_dict, k, v); if (likely(!result)) { PyType_Modified(tp); if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) { PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name, (PyObject *) tp, k, NULL); if (!setNameResult) return -1; Py_DECREF(setNameResult); } } return result; } /* FixUpExtensionType */ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { #if __PYX_LIMITED_VERSION_HEX > 0x030900B1 CYTHON_UNUSED_VAR(spec); CYTHON_UNUSED_VAR(type); CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); #else const PyType_Slot *slot = spec->slots; int changed = 0; #if !CYTHON_COMPILING_IN_LIMITED_API while (slot && slot->slot && slot->slot != Py_tp_members) slot++; if (slot && slot->slot == Py_tp_members) { #if !CYTHON_COMPILING_IN_CPYTHON const #endif // !CYTHON_COMPILING_IN_CPYTHON) PyMemberDef *memb = (PyMemberDef*) slot->pfunc; while (memb && memb->name) { if (memb->name[0] == '_' && memb->name[1] == '_') { if (strcmp(memb->name, "__weaklistoffset__") == 0) { assert(memb->type == T_PYSSIZET); assert(memb->flags == READONLY); type->tp_weaklistoffset = memb->offset; changed = 1; } else if (strcmp(memb->name, "__dictoffset__") == 0) { assert(memb->type == T_PYSSIZET); assert(memb->flags == READONLY); type->tp_dictoffset = memb->offset; changed = 1; } #if CYTHON_METH_FASTCALL else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { assert(memb->type == T_PYSSIZET); assert(memb->flags == READONLY); type->tp_vectorcall_offset = memb->offset; changed = 1; } #endif // CYTHON_METH_FASTCALL #if !CYTHON_COMPILING_IN_PYPY else if (strcmp(memb->name, "__module__") == 0) { PyObject *descr; assert(memb->type == T_OBJECT); assert(memb->flags == 0 || memb->flags == READONLY); descr = PyDescr_NewMember(type, memb); if (unlikely(!descr)) return -1; int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); Py_DECREF(descr); if (unlikely(set_item_result < 0)) { return -1; } changed = 1; } #endif // !CYTHON_COMPILING_IN_PYPY } memb++; } } #endif // !CYTHON_COMPILING_IN_LIMITED_API #if !CYTHON_COMPILING_IN_PYPY slot = spec->slots; while (slot && slot->slot && slot->slot != Py_tp_getset) slot++; if (slot && slot->slot == Py_tp_getset) { PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc; while (getset && getset->name) { if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) { PyObject *descr = PyDescr_NewGetSet(type, getset); if (unlikely(!descr)) return -1; #if CYTHON_COMPILING_IN_LIMITED_API PyObject *pyname = PyUnicode_FromString(getset->name); if (unlikely(!pyname)) { Py_DECREF(descr); return -1; } int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr); Py_DECREF(pyname); #else CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); #endif Py_DECREF(descr); if (unlikely(set_item_result < 0)) { return -1; } changed = 1; } ++getset; } } #else CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); #endif // !CYTHON_COMPILING_IN_PYPY if (changed) PyType_Modified(type); #endif // PY_VERSION_HEX > 0x030900B1 return 0; } /* PyObjectCallNoArg (used by PyObjectCallMethod0) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { PyObject *arg[2] = {NULL, NULL}; return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } /* PyObjectGetMethod (used by PyObjectCallMethod0) */ #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))) static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { PyObject *attr; #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP __Pyx_TypeName type_name; PyTypeObject *tp = Py_TYPE(obj); PyObject *descr; descrgetfunc f = NULL; PyObject **dictptr, *dict; int meth_found = 0; assert (*method == NULL); if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { attr = __Pyx_PyObject_GetAttrStr(obj, name); goto try_unpack; } if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { return 0; } descr = _PyType_Lookup(tp, name); if (likely(descr != NULL)) { Py_INCREF(descr); #if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) #else #ifdef __Pyx_CyFunction_USED if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) #else if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) #endif #endif { meth_found = 1; } else { f = Py_TYPE(descr)->tp_descr_get; if (f != NULL && PyDescr_IsData(descr)) { attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); Py_DECREF(descr); goto try_unpack; } } } dictptr = _PyObject_GetDictPtr(obj); if (dictptr != NULL && (dict = *dictptr) != NULL) { Py_INCREF(dict); attr = __Pyx_PyDict_GetItemStr(dict, name); if (attr != NULL) { Py_INCREF(attr); Py_DECREF(dict); Py_XDECREF(descr); goto try_unpack; } Py_DECREF(dict); } if (meth_found) { *method = descr; return 1; } if (f != NULL) { attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); Py_DECREF(descr); goto try_unpack; } if (likely(descr != NULL)) { *method = descr; return 0; } type_name = __Pyx_PyType_GetFullyQualifiedName(tp); PyErr_Format(PyExc_AttributeError, "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", type_name, name); __Pyx_DECREF_TypeName(type_name); return 0; #else attr = __Pyx_PyObject_GetAttrStr(obj, name); goto try_unpack; #endif try_unpack: #if CYTHON_UNPACK_METHODS if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { PyObject *function = PyMethod_GET_FUNCTION(attr); Py_INCREF(function); Py_DECREF(attr); *method = function; return 1; } #endif *method = attr; return 0; } #endif /* PyObjectCallMethod0 (used by PyType_Ready) */ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)) PyObject *args[1] = {obj}; (void) __Pyx_PyObject_CallOneArg; (void) __Pyx_PyObject_CallNoArg; return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); #else PyObject *method = NULL, *result = NULL; int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); if (likely(is_method)) { result = __Pyx_PyObject_CallOneArg(method, obj); Py_DECREF(method); return result; } if (unlikely(!method)) goto bad; result = __Pyx_PyObject_CallNoArg(method); Py_DECREF(method); bad: return result; #endif } /* ValidateBasesTuple (used by PyType_Ready) */ #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { Py_ssize_t i, n; #if CYTHON_ASSUME_SAFE_SIZE n = PyTuple_GET_SIZE(bases); #else n = PyTuple_Size(bases); if (unlikely(n < 0)) return -1; #endif for (i = 1; i < n; i++) { PyTypeObject *b; #if CYTHON_AVOID_BORROWED_REFS PyObject *b0 = PySequence_GetItem(bases, i); if (!b0) return -1; #elif CYTHON_ASSUME_SAFE_MACROS PyObject *b0 = PyTuple_GET_ITEM(bases, i); #else PyObject *b0 = PyTuple_GetItem(bases, i); if (!b0) return -1; #endif b = (PyTypeObject*) b0; if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) { __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b); PyErr_Format(PyExc_TypeError, "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); __Pyx_DECREF_TypeName(b_name); #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(b0); #endif return -1; } if (dictoffset == 0) { Py_ssize_t b_dictoffset = 0; #if CYTHON_USE_TYPE_SLOTS b_dictoffset = b->tp_dictoffset; #else PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__"); if (!py_b_dictoffset) goto dictoffset_return; b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset); Py_DECREF(py_b_dictoffset); if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return; #endif if (b_dictoffset) { { __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b); PyErr_Format(PyExc_TypeError, "extension type '%.200s' has no __dict__ slot, " "but base type '" __Pyx_FMT_TYPENAME "' has: " "either add 'cdef dict __dict__' to the extension type " "or add '__slots__ = [...]' to the base type", type_name, b_name); __Pyx_DECREF_TypeName(b_name); } #if !CYTHON_USE_TYPE_SLOTS dictoffset_return: #endif #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(b0); #endif return -1; } } #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(b0); #endif } return 0; } #endif /* PyType_Ready */ CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) { while (t) { PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); if (bases) { return 1; } t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*); } return 0; } static int __Pyx_PyType_Ready(PyTypeObject *t) { #if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION) (void)__Pyx_PyObject_CallMethod0; #if CYTHON_USE_TYPE_SPECS (void)__Pyx_validate_bases_tuple; #endif return PyType_Ready(t); #else int r; if (!__Pyx_PyType_HasMultipleInheritance(t)) { return PyType_Ready(t); } PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) return -1; #if !defined(PYSTON_MAJOR_VERSION) { int gc_was_enabled; #if PY_VERSION_HEX >= 0x030A00b1 gc_was_enabled = PyGC_Disable(); (void)__Pyx_PyObject_CallMethod0; #else PyObject *ret, *py_status; PyObject *gc = NULL; #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\ !CYTHON_COMPILING_IN_GRAAL gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc); #endif if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc); if (unlikely(!gc)) return -1; py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled); if (unlikely(!py_status)) { Py_DECREF(gc); return -1; } gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); Py_DECREF(py_status); if (gc_was_enabled > 0) { ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable); if (unlikely(!ret)) { Py_DECREF(gc); return -1; } Py_DECREF(ret); } else if (unlikely(gc_was_enabled == -1)) { Py_DECREF(gc); return -1; } #endif t->tp_flags |= Py_TPFLAGS_HEAPTYPE; #if PY_VERSION_HEX >= 0x030A0000 t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; #endif #else (void)__Pyx_PyObject_CallMethod0; #endif r = PyType_Ready(t); #if !defined(PYSTON_MAJOR_VERSION) t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; #if PY_VERSION_HEX >= 0x030A00b1 if (gc_was_enabled) PyGC_Enable(); #else if (gc_was_enabled) { PyObject *tp, *v, *tb; PyErr_Fetch(&tp, &v, &tb); ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable); if (likely(ret || r == -1)) { Py_XDECREF(ret); PyErr_Restore(tp, v, tb); } else { Py_XDECREF(tp); Py_XDECREF(v); Py_XDECREF(tb); r = -1; } } Py_DECREF(gc); #endif } #endif return r; #endif } /* DelItemOnTypeDict (used by SetupReduce) */ static int __Pyx__DelItemOnTypeDict(PyTypeObject *tp, PyObject *k) { int result; PyObject *tp_dict; #if CYTHON_COMPILING_IN_LIMITED_API tp_dict = __Pyx_GetTypeDict(tp); if (unlikely(!tp_dict)) return -1; #else tp_dict = tp->tp_dict; #endif result = PyDict_DelItem(tp_dict, k); if (likely(!result)) PyType_Modified(tp); return result; } /* SetupReduce */ static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; PyObject *name_attr; name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_mstate_global->__pyx_n_u_name); if (likely(name_attr)) { ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); } else { ret = -1; } if (unlikely(ret < 0)) { PyErr_Clear(); ret = 0; } Py_XDECREF(name_attr); return ret; } static int __Pyx_setup_reduce(PyObject* type_obj) { int ret = 0; PyObject *object_reduce = NULL; PyObject *object_getstate = NULL; PyObject *object_reduce_ex = NULL; PyObject *reduce = NULL; PyObject *reduce_ex = NULL; PyObject *reduce_cython = NULL; PyObject *setstate = NULL; PyObject *setstate_cython = NULL; PyObject *getstate = NULL; #if CYTHON_USE_PYTYPE_LOOKUP getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_getstate); #else getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_getstate); if (!getstate && PyErr_Occurred()) { goto __PYX_BAD; } #endif if (getstate) { #if CYTHON_USE_PYTYPE_LOOKUP object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate); #else object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_getstate); if (!object_getstate && PyErr_Occurred()) { goto __PYX_BAD; } #endif if (object_getstate != getstate) { goto __PYX_GOOD; } } #if CYTHON_USE_PYTYPE_LOOKUP object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; #else object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; #endif reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; if (reduce_ex == object_reduce_ex) { #if CYTHON_USE_PYTYPE_LOOKUP object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD; #else object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_mstate_global->__pyx_n_u_reduce); if (!object_reduce) goto __PYX_BAD; #endif reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_mstate_global->__pyx_n_u_reduce); if (unlikely(!reduce)) goto __PYX_BAD; if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_mstate_global->__pyx_n_u_reduce_cython)) { reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); if (likely(reduce_cython)) { ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; } else if (reduce == object_reduce || PyErr_Occurred()) { goto __PYX_BAD; } setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate); if (!setstate) PyErr_Clear(); if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_mstate_global->__pyx_n_u_setstate_cython)) { setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); if (likely(setstate_cython)) { ret = __Pyx_SetItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; ret = __Pyx_DelItemOnTypeDict((PyTypeObject*)type_obj, __pyx_mstate_global->__pyx_n_u_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; } else if (!setstate || PyErr_Occurred()) { goto __PYX_BAD; } } PyType_Modified((PyTypeObject*)type_obj); } } goto __PYX_GOOD; __PYX_BAD: if (!PyErr_Occurred()) { __Pyx_TypeName type_obj_name = __Pyx_PyType_GetFullyQualifiedName((PyTypeObject*)type_obj); PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); __Pyx_DECREF_TypeName(type_obj_name); } ret = -1; __PYX_GOOD: #if !CYTHON_USE_PYTYPE_LOOKUP Py_XDECREF(object_reduce); Py_XDECREF(object_reduce_ex); Py_XDECREF(object_getstate); Py_XDECREF(getstate); #endif Py_XDECREF(reduce); Py_XDECREF(reduce_ex); Py_XDECREF(reduce_cython); Py_XDECREF(setstate); Py_XDECREF(setstate_cython); return ret; } /* PxdImportShared (used by FunctionImport) */ #ifndef __PYX_HAVE_RT_ImportFromPxd_3_2_6 #define __PYX_HAVE_RT_ImportFromPxd_3_2_6 static int __Pyx_ImportFromPxd_3_2_6(PyObject *module, const char *name, void **p, const char *sig, const char *what) { PyObject *d = 0; PyObject *cobj = 0; d = PyObject_GetAttrString(module, "__pyx_capi__"); if (!d) goto bad; #if (defined(Py_LIMITED_API) && Py_LIMITED_API >= 0x030d0000) || (!defined(Py_LIMITED_API) && PY_VERSION_HEX >= 0x030d0000) PyDict_GetItemStringRef(d, name, &cobj); #else cobj = PyDict_GetItemString(d, name); Py_XINCREF(cobj); #endif if (!cobj) { PyErr_Format(PyExc_ImportError, "%.200s does not export expected C %.8s %.200s", PyModule_GetName(module), what, name); goto bad; } if (!PyCapsule_IsValid(cobj, sig)) { PyErr_Format(PyExc_TypeError, "C %.8s %.200s.%.200s has wrong signature (expected %.500s, got %.500s)", what, PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj)); goto bad; } *p = PyCapsule_GetPointer(cobj, sig); if (!(*p)) goto bad; Py_DECREF(d); Py_DECREF(cobj); return 0; bad: Py_XDECREF(d); Py_XDECREF(cobj); return -1; } #endif /* FunctionImport */ #ifndef __PYX_HAVE_RT_ImportFunction_3_2_6 #define __PYX_HAVE_RT_ImportFunction_3_2_6 static int __Pyx_ImportFunction_3_2_6(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { union { void (*fp)(void); void *p; } tmp; int result = __Pyx_ImportFromPxd_3_2_6(module, funcname, &tmp.p, sig, "function"); if (result == 0) { *f = tmp.fp; } return result; } #endif /* HasAttr (used by ImportImpl) */ #if __PYX_LIMITED_VERSION_HEX < 0x030d0000 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { PyObject *r; if (unlikely(!PyUnicode_Check(n))) { PyErr_SetString(PyExc_TypeError, "hasattr(): attribute name must be string"); return -1; } r = __Pyx_PyObject_GetAttrStrNoError(o, n); if (!r) { return (unlikely(PyErr_Occurred())) ? -1 : 0; } else { Py_DECREF(r); return 1; } } #endif /* ImportImpl (used by Import) */ static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) { PyObject *imported_module = PyImport_GetModule(qualname); if (unlikely(!imported_module)) { *module = NULL; if (PyErr_Occurred()) { return -1; } return 0; } *module = imported_module; return 1; } static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) { PyObject *imported_module; PyObject *top_level_package_name; Py_ssize_t i; int status, module_found; Py_ssize_t dot_index; module_found = __Pyx__Import_GetModule(qualname, &imported_module); if (unlikely(!module_found || module_found == -1)) { *module = NULL; return module_found; } if (imported_names) { for (i = 0; i < len_imported_names; i++) { PyObject *imported_name = imported_names[i]; #if __PYX_LIMITED_VERSION_HEX < 0x030d0000 int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name); #else int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name); if (unlikely(has_imported_attribute == -1)) goto error; #endif if (!has_imported_attribute) { goto not_found; } } *module = imported_module; return 1; } dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1); if (dot_index == -1) { *module = imported_module; return 1; } if (unlikely(dot_index == -2)) goto error; top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index); if (unlikely(!top_level_package_name)) goto error; Py_DECREF(imported_module); status = __Pyx__Import_GetModule(top_level_package_name, module); Py_DECREF(top_level_package_name); return status; error: Py_DECREF(imported_module); *module = NULL; return -1; not_found: Py_DECREF(imported_module); *module = NULL; return 0; } static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) { PyObject *module = 0; PyObject *empty_dict = 0; PyObject *from_list = 0; int module_found; if (!qualname) { qualname = name; } module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module); if (likely(module_found == 1)) { return module; } else if (unlikely(module_found == -1)) { return NULL; } empty_dict = PyDict_New(); if (unlikely(!empty_dict)) goto bad; if (imported_names) { #if CYTHON_COMPILING_IN_CPYTHON from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names); if (unlikely(!from_list)) goto bad; #else from_list = PyList_New(len_imported_names); if (unlikely(!from_list)) goto bad; for (Py_ssize_t i=0; i__pyx_d, level); } /* ImportFrom */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { const char* module_name_str = 0; PyObject* module_name = 0; PyObject* module_dot = 0; PyObject* full_name = 0; PyErr_Clear(); module_name_str = PyModule_GetName(module); if (unlikely(!module_name_str)) { goto modbad; } module_name = PyUnicode_FromString(module_name_str); if (unlikely(!module_name)) { goto modbad; } module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u_); if (unlikely(!module_dot)) { goto modbad; } full_name = PyUnicode_Concat(module_dot, name); if (unlikely(!full_name)) { goto modbad; } #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) ||\ CYTHON_COMPILING_IN_GRAAL { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) goto modbad; value = PyObject_GetItem(modules, full_name); } #else value = PyImport_GetModule(full_name); #endif modbad: Py_XDECREF(full_name); Py_XDECREF(module_dot); Py_XDECREF(module_name); } if (unlikely(!value)) { PyErr_Format(PyExc_ImportError, "cannot import name %S", name); } return value; } /* dict_setdefault (used by FetchCommonType) */ static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) { PyObject* value; #if __PYX_LIMITED_VERSION_HEX >= 0x030F0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4) PyDict_SetDefaultRef(d, key, default_value, &value); #elif CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000 PyObject *args[] = {d, key, default_value}; value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); #elif CYTHON_COMPILING_IN_LIMITED_API value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL); #else value = PyDict_SetDefault(d, key, default_value); if (unlikely(!value)) return NULL; Py_INCREF(value); #endif return value; } /* AddModuleRef (used by FetchSharedCythonModule) */ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) { PyObject *module_dict = PyImport_GetModuleDict(); PyObject *m; if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) { return NULL; } if (m != NULL && PyModule_Check(m)) { return m; } Py_XDECREF(m); m = PyModule_NewObject(name); if (m == NULL) return NULL; if (PyDict_CheckExact(module_dict)) { PyObject *new_m; (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m); Py_DECREF(m); return new_m; } else { if (PyObject_SetItem(module_dict, name, m) != 0) { Py_DECREF(m); return NULL; } return m; } } static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { PyObject *py_name = PyUnicode_FromString(name); if (!py_name) return NULL; PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name); Py_DECREF(py_name); return module; } #elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) #else static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { PyObject *module = PyImport_AddModule(name); Py_XINCREF(module); return module; } #endif /* FetchSharedCythonModule (used by FetchCommonType) */ static PyObject *__Pyx_FetchSharedCythonABIModule(void) { return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME); } /* FetchCommonType (used by CommonTypesMetaclass) */ #if __PYX_LIMITED_VERSION_HEX < 0x030C0000 static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases); if (result && metaclass) { PyObject *old_tp = (PyObject*)Py_TYPE(result); Py_INCREF((PyObject*)metaclass); #if __PYX_LIMITED_VERSION_HEX >= 0x03090000 Py_SET_TYPE(result, metaclass); #else result->ob_type = metaclass; #endif Py_DECREF(old_tp); } return result; } #else #define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b) #endif static int __Pyx_VerifyCachedType(PyObject *cached_type, const char *name, Py_ssize_t expected_basicsize) { Py_ssize_t basicsize; if (!PyType_Check(cached_type)) { PyErr_Format(PyExc_TypeError, "Shared Cython type %.200s is not a type object", name); return -1; } if (expected_basicsize == 0) { return 0; // size is inherited, nothing useful to check } #if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_basicsize; py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); if (unlikely(!py_basicsize)) return -1; basicsize = PyLong_AsSsize_t(py_basicsize); Py_DECREF(py_basicsize); py_basicsize = NULL; if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1; #else basicsize = ((PyTypeObject*) cached_type)->tp_basicsize; #endif if (basicsize != expected_basicsize) { PyErr_Format(PyExc_TypeError, "Shared Cython type %.200s has the wrong size, try recompiling", name); return -1; } return 0; } static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name; int get_item_ref_result; const char* object_name = strrchr(spec->name, '.'); object_name = object_name ? object_name+1 : spec->name; py_object_name = PyUnicode_FromString(object_name); if (!py_object_name) return NULL; abi_module = __Pyx_FetchSharedCythonABIModule(); if (!abi_module) goto done; abi_module_dict = PyModule_GetDict(abi_module); if (!abi_module_dict) goto done; get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type); if (get_item_ref_result == 1) { if (__Pyx_VerifyCachedType( cached_type, object_name, spec->basicsize) < 0) { goto bad; } goto done; } else if (unlikely(get_item_ref_result == -1)) { goto bad; } cached_type = __Pyx_PyType_FromMetaclass( metaclass, CYTHON_USE_MODULE_STATE ? module : abi_module, spec, bases); if (unlikely(!cached_type)) goto bad; if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type); if (unlikely(new_cached_type != cached_type)) { if (unlikely(!new_cached_type)) goto bad; Py_DECREF(cached_type); cached_type = new_cached_type; if (__Pyx_VerifyCachedType( cached_type, object_name, spec->basicsize) < 0) { goto bad; } goto done; } else { Py_DECREF(new_cached_type); } done: Py_XDECREF(abi_module); Py_DECREF(py_object_name); assert(cached_type == NULL || PyType_Check(cached_type)); return (PyTypeObject *) cached_type; bad: Py_XDECREF(cached_type); cached_type = NULL; goto done; } /* CommonTypesMetaclass (used by CythonFunctionShared) */ static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) { return PyUnicode_FromString(__PYX_ABI_MODULE_NAME); } #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) { PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types"); return NULL; } static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) { PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable"); return -1; } #endif static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = { {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL}, {0, 0, 0, 0, 0} }; static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = { {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset}, #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call}, {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call}, {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr}, #endif {0, 0} }; static PyType_Spec __pyx_CommonTypesMetaclass_spec = { __PYX_TYPE_MODULE_PREFIX "_common_types_metatype", 0, 0, Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | Py_TPFLAGS_DEFAULT, __pyx_CommonTypesMetaclass_slots }; static int __pyx_CommonTypesMetaclass_init(PyObject *module) { __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); PyObject *bases = PyTuple_Pack(1, &PyType_Type); if (unlikely(!bases)) { return -1; } mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases); Py_DECREF(bases); if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) { return -1; } return 0; } /* CallTypeTraverse (used by CythonFunctionShared) */ #if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) #else static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) { #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000 if (__Pyx_get_runtime_version() < 0x03090000) return 0; #endif if (!always_call) { PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*); unsigned long flags = PyType_GetFlags(base); if (flags & Py_TPFLAGS_HEAPTYPE) { return 0; } } Py_VISIT((PyObject*)Py_TYPE(o)); return 0; } #endif /* PyMethodNew (used by CythonFunctionShared) */ #if CYTHON_COMPILING_IN_LIMITED_API static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { PyObject *result; CYTHON_UNUSED_VAR(typ); if (!self) return __Pyx_NewRef(func); #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 { PyObject *args[] = {func, self}; result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL); } #else result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL); #endif return result; } #else static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { CYTHON_UNUSED_VAR(typ); if (!self) return __Pyx_NewRef(func); return PyMethod_New(func, self); } #endif /* PyVectorcallFastCallDict (used by CythonFunctionShared) */ #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) { PyObject *res = NULL; PyObject *kwnames; PyObject **newargs; PyObject **kwvalues; Py_ssize_t i; #if CYTHON_AVOID_BORROWED_REFS PyObject *pos; #else Py_ssize_t pos; #endif size_t j; PyObject *key, *value; unsigned long keys_are_strings; #if !CYTHON_ASSUME_SAFE_SIZE Py_ssize_t nkw = PyDict_Size(kw); if (unlikely(nkw == -1)) return NULL; #else Py_ssize_t nkw = PyDict_GET_SIZE(kw); #endif newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); if (unlikely(newargs == NULL)) { PyErr_NoMemory(); return NULL; } for (j = 0; j < nargs; j++) newargs[j] = args[j]; kwnames = PyTuple_New(nkw); if (unlikely(kwnames == NULL)) { PyMem_Free(newargs); return NULL; } kwvalues = newargs + nargs; pos = 0; i = 0; keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) { keys_are_strings &= #if CYTHON_COMPILING_IN_LIMITED_API PyType_GetFlags(Py_TYPE(key)); #else Py_TYPE(key)->tp_flags; #endif #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup; #else PyTuple_SET_ITEM(kwnames, i, key); #endif kwvalues[i] = value; i++; } if (unlikely(!keys_are_strings)) { PyErr_SetString(PyExc_TypeError, "keywords must be strings"); goto cleanup; } res = vc(func, newargs, nargs, kwnames); cleanup: #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(pos); #endif Py_DECREF(kwnames); for (i = 0; i < nkw; i++) Py_DECREF(kwvalues[i]); PyMem_Free(newargs); return res; } static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) { Py_ssize_t kw_size = likely(kw == NULL) ? 0 : #if !CYTHON_ASSUME_SAFE_SIZE PyDict_Size(kw); #else PyDict_GET_SIZE(kw); #endif if (kw_size == 0) { return vc(func, args, nargs, NULL); } #if !CYTHON_ASSUME_SAFE_SIZE else if (unlikely(kw_size == -1)) { return NULL; } #endif return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); } #endif /* CythonFunctionShared (used by CythonFunction) */ #if CYTHON_COMPILING_IN_LIMITED_API static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) { if (__Pyx_CyFunction_Check(func)) { return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc; } else if (PyCFunction_Check(func)) { return PyCFunction_GetFunction(func) == (PyCFunction) cfunc; } return 0; } static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) { int result; PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func); if (unlikely(!newFunc)) { PyErr_Clear(); // It's only an optimization, so don't throw an error return 0; } result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc); Py_DECREF(newFunc); return result; } return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc); } #else static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { if (PyMethod_Check(func)) { func = PyMethod_GET_FUNCTION(func); } return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; } #endif static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API __Pyx_Py_XDECREF_SET( __Pyx_CyFunction_GetClassObj(f), ((classobj) ? __Pyx_NewRef(classobj) : NULL)); #else __Pyx_Py_XDECREF_SET( ((PyCMethodObject *) (f))->mm_class, (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); #endif } static PyObject * __Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op) { if (unlikely(op->func_doc == NULL)) { #if CYTHON_COMPILING_IN_LIMITED_API op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); if (unlikely(!op->func_doc)) return NULL; #else if (((PyCFunctionObject*)op)->m_ml->ml_doc) { op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); if (unlikely(op->func_doc == NULL)) return NULL; } else { Py_INCREF(Py_None); return Py_None; } #endif } Py_INCREF(op->func_doc); return op->func_doc; } static PyObject * __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) { PyObject *result; CYTHON_UNUSED_VAR(closure); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_doc_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) { CYTHON_UNUSED_VAR(context); if (value == NULL) { value = Py_None; } Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->func_doc, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op) { if (unlikely(op->func_name == NULL)) { #if CYTHON_COMPILING_IN_LIMITED_API op->func_name = PyObject_GetAttrString(op->func, "__name__"); #else op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #endif if (unlikely(op->func_name == NULL)) return NULL; } Py_INCREF(op->func_name); return op->func_name; } static PyObject * __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) { PyObject *result = NULL; CYTHON_UNUSED_VAR(context); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_name_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) { CYTHON_UNUSED_VAR(context); if (unlikely(value == NULL || !PyUnicode_Check(value))) { PyErr_SetString(PyExc_TypeError, "__name__ must be set to a string object"); return -1; } Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->func_name, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(context); PyObject *result; __Pyx_BEGIN_CRITICAL_SECTION(op); Py_INCREF(op->func_qualname); result = op->func_qualname; __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) { CYTHON_UNUSED_VAR(context); if (unlikely(value == NULL || !PyUnicode_Check(value))) { PyErr_SetString(PyExc_TypeError, "__qualname__ must be set to a string object"); return -1; } Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->func_qualname, value); __Pyx_END_CRITICAL_SECTION(); return 0; } #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 static PyObject * __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(context); if (unlikely(op->func_dict == NULL)) { op->func_dict = PyDict_New(); if (unlikely(op->func_dict == NULL)) return NULL; } Py_INCREF(op->func_dict); return op->func_dict; } #endif static PyObject * __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(context); Py_INCREF(op->func_globals); return op->func_globals; } static PyObject * __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(op); CYTHON_UNUSED_VAR(context); Py_INCREF(Py_None); return Py_None; } static PyObject * __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) { PyObject* result = (op->func_code) ? op->func_code : Py_None; CYTHON_UNUSED_VAR(context); Py_INCREF(result); return result; } static int __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { int result = 0; PyObject *res = op->defaults_getter((PyObject *) op); if (unlikely(!res)) return -1; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS op->defaults_tuple = PyTuple_GET_ITEM(res, 0); Py_INCREF(op->defaults_tuple); op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); Py_INCREF(op->defaults_kwdict); #else op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); if (unlikely(!op->defaults_tuple)) result = -1; else { op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); if (unlikely(!op->defaults_kwdict)) result = -1; } #endif Py_DECREF(res); return result; } static int __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { PyErr_SetString(PyExc_TypeError, "__defaults__ must be set to a tuple object"); return -1; } PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " "currently affect the values used in function calls", 1); Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) { PyObject* result = op->defaults_tuple; if (unlikely(!result)) { if (op->defaults_getter) { if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_tuple; } else { result = Py_None; } } Py_INCREF(result); return result; } static PyObject * __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result = NULL; CYTHON_UNUSED_VAR(context); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_defaults_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; } else if (unlikely(value != Py_None && !PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__kwdefaults__ must be set to a dict object"); return -1; } PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " "currently affect the values used in function calls", 1); Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) { PyObject* result = op->defaults_kwdict; if (unlikely(!result)) { if (op->defaults_getter) { if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_kwdict; } else { result = Py_None; } } Py_INCREF(result); return result; } static PyObject * __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result; CYTHON_UNUSED_VAR(context); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_kwdefaults_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); if (!value || value == Py_None) { value = NULL; } else if (unlikely(!PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__annotations__ must be set to a dict object"); return -1; } Py_XINCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->func_annotations, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) { PyObject* result = op->func_annotations; if (unlikely(!result)) { result = PyDict_New(); if (unlikely(!result)) return NULL; op->func_annotations = result; } Py_INCREF(result); return result; } static PyObject * __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { PyObject *result; CYTHON_UNUSED_VAR(context); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_annotations_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static PyObject *__Pyx_CyFunction_annotate_impl(PyObject *self, PyObject *args) { CYTHON_UNUSED_VAR(args); if (unlikely(!self)) { PyErr_SetString(PyExc_SystemError, "cython __annotate__ called without 'self' argument"); } Py_XINCREF(self); return self; } static PyMethodDef __Pyx_CyFunction_annotate_method = { "__annotate__", (PyCFunction)(void (*)(void))__Pyx_CyFunction_annotate_impl, METH_VARARGS, "Placeholder __annotate__ function to allow 'functools.wraps' to work " "on Cython functions." }; static PyObject * __Pyx_CyFunction_get_annotate(PyObject *op_in, void *context) { CYTHON_UNUSED_VAR(context); PyObject *annotations = __Pyx_CyFunction_get_annotations((__pyx_CyFunctionObject *) op_in, NULL); if (unlikely(!annotations)) return NULL; PyObject *method = PyCFunction_New( &__Pyx_CyFunction_annotate_method, annotations); Py_DECREF(annotations); return method; } static int __Pyx_CyFunction_set_annotate(PyObject *op_in, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); if (value == NULL) { PyErr_SetString(PyExc_TypeError, "__annotate__ cannot be deleted"); return -1; } if (value == Py_None) { return 0; } PyObject *annotations = PyObject_CallObject(value, NULL); if (!annotations) return -1; int result = __Pyx_CyFunction_set_annotations((__pyx_CyFunctionObject *) op_in, annotations, NULL); Py_DECREF(annotations); return result; } static PyObject * __Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) { int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; if (is_coroutine) { PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine; fromlist = PyList_New(1); if (unlikely(!fromlist)) return NULL; Py_INCREF(marker); #if CYTHON_ASSUME_SAFE_MACROS PyList_SET_ITEM(fromlist, 0, marker); #else if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { Py_DECREF(fromlist); return NULL; } #endif module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0); Py_DECREF(fromlist); if (unlikely(!module)) goto ignore; is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker); Py_DECREF(module); if (likely(is_coroutine_value)) { return is_coroutine_value; } ignore: PyErr_Clear(); } return __Pyx_PyBool_FromLong(is_coroutine); } static PyObject * __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { PyObject *result; CYTHON_UNUSED_VAR(context); if (op->func_is_coroutine) { return __Pyx_NewRef(op->func_is_coroutine); } result = __Pyx_CyFunction_get_is_coroutine_value(op); if (unlikely(!result)) return NULL; __Pyx_BEGIN_CRITICAL_SECTION(op); if (op->func_is_coroutine) { Py_DECREF(result); result = __Pyx_NewRef(op->func_is_coroutine); } else { op->func_is_coroutine = __Pyx_NewRef(result); } __Pyx_END_CRITICAL_SECTION(); return result; } static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) { #if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); if (!py_name) return; PyErr_Format(PyExc_TypeError, "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", py_name, message, size); Py_DECREF(py_name); #else const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; PyErr_Format(PyExc_TypeError, "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", name, message, size); #endif } static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) { #if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); if (!py_name) return; PyErr_Format(PyExc_TypeError, "%.200S() %s", py_name, message); Py_DECREF(py_name); #else const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; PyErr_Format(PyExc_TypeError, "%.200s() %s", name, message); #endif } #if CYTHON_COMPILING_IN_LIMITED_API static PyObject * __Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(context); return PyObject_GetAttrString(op->func, "__module__"); } static int __Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); return PyObject_SetAttrString(op->func, "__module__", value); } #endif static PyGetSetDef __pyx_CyFunction_getsets[] = { {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, #else {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, #endif {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, {"__annotate__", (getter)__Pyx_CyFunction_get_annotate, (setter)__Pyx_CyFunction_set_annotate, 0, 0}, {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, #if CYTHON_COMPILING_IN_LIMITED_API {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, #endif {0, 0, 0, 0, 0} }; static PyMemberDef __pyx_CyFunction_members[] = { #if !CYTHON_COMPILING_IN_LIMITED_API {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, #endif #if CYTHON_METH_FASTCALL #if CYTHON_COMPILING_IN_LIMITED_API {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, #else {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, #endif #if CYTHON_COMPILING_IN_LIMITED_API {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, #else {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, #endif #endif {0, 0, 0, 0, 0} }; static PyObject * __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) { PyObject *result = NULL; CYTHON_UNUSED_VAR(args); __Pyx_BEGIN_CRITICAL_SECTION(m); Py_INCREF(m->func_qualname); result = m->func_qualname; __Pyx_END_CRITICAL_SECTION(); return result; } static PyMethodDef __pyx_CyFunction_methods[] = { {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, {0, 0, 0, 0} }; #if CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) #else #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) #endif static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { #if !CYTHON_COMPILING_IN_LIMITED_API PyCFunctionObject *cf = (PyCFunctionObject*) op; #endif if (unlikely(op == NULL)) return NULL; #if CYTHON_COMPILING_IN_LIMITED_API op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); if (unlikely(!op->func)) return NULL; #endif op->flags = flags; __Pyx_CyFunction_weakreflist(op) = NULL; #if !CYTHON_COMPILING_IN_LIMITED_API cf->m_ml = ml; cf->m_self = (PyObject *) op; #endif Py_XINCREF(closure); op->func_closure = closure; #if !CYTHON_COMPILING_IN_LIMITED_API Py_XINCREF(module); cf->m_module = module; #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API op->func_dict = NULL; #endif op->func_name = NULL; Py_INCREF(qualname); op->func_qualname = qualname; op->func_doc = NULL; #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API op->func_classobj = NULL; #else ((PyCMethodObject*)op)->mm_class = NULL; #endif op->func_globals = globals; Py_INCREF(op->func_globals); Py_XINCREF(code); op->func_code = code; op->defaults = NULL; op->defaults_tuple = NULL; op->defaults_kwdict = NULL; op->defaults_getter = NULL; op->func_annotations = NULL; op->func_is_coroutine = NULL; #if CYTHON_METH_FASTCALL switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { case METH_NOARGS: __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; break; case METH_O: __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; break; case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; break; case METH_FASTCALL | METH_KEYWORDS: __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; break; case METH_VARARGS | METH_KEYWORDS: __Pyx_CyFunction_func_vectorcall(op) = NULL; break; default: PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); Py_DECREF(op); return NULL; } #endif return (PyObject *) op; } static int __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) { Py_CLEAR(m->func_closure); #if CYTHON_COMPILING_IN_LIMITED_API Py_CLEAR(m->func); #else Py_CLEAR(((PyCFunctionObject*)m)->m_module); #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API Py_CLEAR(m->func_dict); #elif PY_VERSION_HEX < 0x030d0000 _PyObject_ClearManagedDict((PyObject*)m); #else PyObject_ClearManagedDict((PyObject*)m); #endif Py_CLEAR(m->func_name); Py_CLEAR(m->func_qualname); Py_CLEAR(m->func_doc); Py_CLEAR(m->func_globals); Py_CLEAR(m->func_code); #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); #else { PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; ((PyCMethodObject *) (m))->mm_class = NULL; Py_XDECREF(cls); } #endif Py_CLEAR(m->defaults_tuple); Py_CLEAR(m->defaults_kwdict); Py_CLEAR(m->func_annotations); Py_CLEAR(m->func_is_coroutine); Py_CLEAR(m->defaults); return 0; } static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) { if (__Pyx_CyFunction_weakreflist(m) != NULL) PyObject_ClearWeakRefs((PyObject *) m); __Pyx_CyFunction_clear(m); __Pyx_PyHeapTypeObject_GC_Del(m); } static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) { PyObject_GC_UnTrack(m); __Pyx__CyFunction_dealloc(m); } static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) { { int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg); if (e) return e; } Py_VISIT(m->func_closure); #if CYTHON_COMPILING_IN_LIMITED_API Py_VISIT(m->func); #else Py_VISIT(((PyCFunctionObject*)m)->m_module); #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API Py_VISIT(m->func_dict); #else { int e = #if PY_VERSION_HEX < 0x030d0000 _PyObject_VisitManagedDict #else PyObject_VisitManagedDict #endif ((PyObject*)m, visit, arg); if (e != 0) return e; } #endif __Pyx_VISIT_CONST(m->func_name); __Pyx_VISIT_CONST(m->func_qualname); Py_VISIT(m->func_doc); Py_VISIT(m->func_globals); __Pyx_VISIT_CONST(m->func_code); Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); Py_VISIT(m->defaults_tuple); Py_VISIT(m->defaults_kwdict); Py_VISIT(m->func_annotations); Py_VISIT(m->func_is_coroutine); Py_VISIT(m->defaults); return 0; } static PyObject* __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) { PyObject *repr; __Pyx_BEGIN_CRITICAL_SECTION(op); repr = PyUnicode_FromFormat("", op->func_qualname, (void *)op); __Pyx_END_CRITICAL_SECTION(); return repr; } static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { #if CYTHON_COMPILING_IN_LIMITED_API PyObject *f = ((__pyx_CyFunctionObject*)func)->func; PyCFunction meth; int flags; meth = PyCFunction_GetFunction(f); if (unlikely(!meth)) return NULL; flags = PyCFunction_GetFlags(f); if (unlikely(flags < 0)) return NULL; #else PyCFunctionObject* f = (PyCFunctionObject*)func; PyCFunction meth = f->m_ml->ml_meth; int flags = f->m_ml->ml_flags; #endif Py_ssize_t size; switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { case METH_VARARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) return (*meth)(self, arg); break; case METH_VARARGS | METH_KEYWORDS: return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw); case METH_NOARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { #if CYTHON_ASSUME_SAFE_SIZE size = PyTuple_GET_SIZE(arg); #else size = PyTuple_Size(arg); if (unlikely(size < 0)) return NULL; #endif if (likely(size == 0)) return (*meth)(self, NULL); __Pyx_CyFunction_raise_argument_count_error( (__pyx_CyFunctionObject*)func, "takes no arguments", size); return NULL; } break; case METH_O: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { #if CYTHON_ASSUME_SAFE_SIZE size = PyTuple_GET_SIZE(arg); #else size = PyTuple_Size(arg); if (unlikely(size < 0)) return NULL; #endif if (likely(size == 1)) { PyObject *result, *arg0; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS arg0 = PyTuple_GET_ITEM(arg, 0); #else arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; #endif result = (*meth)(self, arg0); #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) Py_DECREF(arg0); #endif return result; } __Pyx_CyFunction_raise_argument_count_error( (__pyx_CyFunctionObject*)func, "takes exactly one argument", size); return NULL; } break; default: PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); return NULL; } __Pyx_CyFunction_raise_type_error( (__pyx_CyFunctionObject*)func, "takes no keyword arguments"); return NULL; } static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *self, *result; #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)func)->m_self; #endif result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); return result; } static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { PyObject *result; __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); if (vc) { #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); #else (void) &__Pyx_PyVectorcall_FastCallDict; return PyVectorcall_Call(func, args, kw); #endif } #endif if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { Py_ssize_t argc; PyObject *new_args; PyObject *self; #if CYTHON_ASSUME_SAFE_SIZE argc = PyTuple_GET_SIZE(args); #else argc = PyTuple_Size(args); if (unlikely(argc < 0)) return NULL; #endif new_args = PyTuple_GetSlice(args, 1, argc); if (unlikely(!new_args)) return NULL; self = PyTuple_GetItem(args, 0); if (unlikely(!self)) { Py_DECREF(new_args); PyErr_Format(PyExc_TypeError, "unbound method %.200S() needs an argument", cyfunc->func_qualname); return NULL; } result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); Py_DECREF(new_args); } else { result = __Pyx_CyFunction_Call(func, args, kw); } return result; } #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) { int ret = 0; if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { if (unlikely(nargs < 1)) { __Pyx_CyFunction_raise_type_error( cyfunc, "needs an argument"); return -1; } ret = 1; } if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) { __Pyx_CyFunction_raise_type_error( cyfunc, "takes no keyword arguments"); return -1; } return ret; } static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) { __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); PyObject *self; #if CYTHON_COMPILING_IN_LIMITED_API PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); if (unlikely(!meth)) return NULL; #else PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; #endif switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { case 1: self = args[0]; args += 1; nargs -= 1; break; case 0: #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)cyfunc)->m_self; #endif break; default: return NULL; } if (unlikely(nargs != 0)) { __Pyx_CyFunction_raise_argument_count_error( cyfunc, "takes no arguments", nargs); return NULL; } return meth(self, NULL); } static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) { __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); PyObject *self; #if CYTHON_COMPILING_IN_LIMITED_API PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); if (unlikely(!meth)) return NULL; #else PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; #endif switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { case 1: self = args[0]; args += 1; nargs -= 1; break; case 0: #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)cyfunc)->m_self; #endif break; default: return NULL; } if (unlikely(nargs != 1)) { __Pyx_CyFunction_raise_argument_count_error( cyfunc, "takes exactly one argument", nargs); return NULL; } return meth(self, args[0]); } static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) { __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); PyObject *self; #if CYTHON_COMPILING_IN_LIMITED_API PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); if (unlikely(!meth)) return NULL; #else PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; #endif switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { case 1: self = args[0]; args += 1; nargs -= 1; break; case 0: #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)cyfunc)->m_self; #endif break; default: return NULL; } return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames); } static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) { __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); PyObject *self; #if CYTHON_COMPILING_IN_LIMITED_API PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); if (unlikely(!meth)) return NULL; #else PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; #endif switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { case 1: self = args[0]; args += 1; nargs -= 1; break; case 0: #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)cyfunc)->m_self; #endif break; default: return NULL; } #if PY_VERSION_HEX < 0x030e00A6 size_t nargs_value = (size_t) nargs; #else Py_ssize_t nargs_value = nargs; #endif return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames); } #endif static PyType_Slot __pyx_CyFunctionType_slots[] = { {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, {Py_tp_methods, (void *)__pyx_CyFunction_methods}, {Py_tp_members, (void *)__pyx_CyFunction_members}, {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, {0, 0}, }; static PyType_Spec __pyx_CyFunctionType_spec = { __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", sizeof(__pyx_CyFunctionObject), 0, #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR Py_TPFLAGS_METHOD_DESCRIPTOR | #endif #if CYTHON_METH_FASTCALL #if defined(Py_TPFLAGS_HAVE_VECTORCALL) Py_TPFLAGS_HAVE_VECTORCALL | #elif defined(_Py_TPFLAGS_HAVE_VECTORCALL) _Py_TPFLAGS_HAVE_VECTORCALL | #endif #endif // CYTHON_METH_FASTCALL #if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API Py_TPFLAGS_MANAGED_DICT | #endif Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, __pyx_CyFunctionType_slots }; static int __pyx_CyFunction_init(PyObject *module) { __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec( mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL); if (unlikely(mstate->__pyx_CyFunctionType == NULL)) { return -1; } return 0; } static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type); if (unlikely(!m->defaults)) return NULL; return m->defaults; } static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults_tuple = tuple; Py_INCREF(tuple); } static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults_kwdict = dict; Py_INCREF(dict); } static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->func_annotations = dict; Py_INCREF(dict); } /* CythonFunction */ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { PyObject *op = __Pyx_CyFunction_Init( PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType), ml, flags, qualname, closure, module, globals, code ); if (likely(op)) { PyObject_GC_Track(op); } return op; } /* CLineInTraceback (used by AddTraceback) */ #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 #define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o)) #elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL); #else PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) { PyObject **dict_ptr = _PyObject_GetDictPtr(o); return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL; } #endif static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline = NULL; PyObject *ptype, *pvalue, *ptraceback; PyObject *cython_runtime_dict; CYTHON_MAYBE_UNUSED_VAR(tstate); if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) { return c_line; } __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime); if (likely(cython_runtime_dict)) { __PYX_PY_DICT_LOOKUP_IF_MODIFIED( use_cline, cython_runtime_dict, __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False)) } if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; } Py_XDECREF(use_cline); Py_XDECREF(cython_runtime_dict); __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); return c_line; } #endif /* CodeObjectCache (used by AddTraceback) */ 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 __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) { __Pyx_CachedCodeObjectType* code_object; int pos; if (unlikely(!code_line) || unlikely(!code_cache->entries)) { return NULL; } pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) { return NULL; } code_object = code_cache->entries[pos].code_object; Py_INCREF(code_object); return code_object; } static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS (void)__pyx__find_code_object; return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss. #else struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count); if (old_count < 0) { __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); return NULL; } #endif __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line); #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); #endif return result; #endif } static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = code_cache->entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { code_cache->entries = entries; code_cache->max_count = 64; 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(code_cache->entries, code_cache->count, code_line); if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) { __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_INCREF(code_object); Py_DECREF(tmp); return; } if (code_cache->count == code_cache->max_count) { int new_max = code_cache->max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } code_cache->entries = entries; code_cache->max_count = new_max; } for (i=code_cache->count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; code_cache->count++; Py_INCREF(code_object); } static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS (void)__pyx__insert_code_object; return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail. #else struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_nonatomic_int_type expected = 0; if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) { return; } #endif __pyx__insert_code_object(code_cache, code_line, code_object); #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN); #endif #endif } /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif #if CYTHON_COMPILING_IN_LIMITED_API static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, PyObject *firstlineno, PyObject *name) { PyObject *replace = NULL; if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; replace = PyObject_GetAttrString(code, "replace"); if (likely(replace)) { PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict); Py_DECREF(replace); return result; } PyErr_Clear(); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; PyObject *replace = NULL, *getframe = NULL, *frame = NULL; PyObject *exc_type, *exc_value, *exc_traceback; int success = 0; if (c_line) { c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); } PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); code_object = __pyx_find_code_object(c_line ? -c_line : py_line); if (!code_object) { code_object = Py_CompileString("_getframe()", filename, Py_eval_input); if (unlikely(!code_object)) goto bad; py_py_line = PyLong_FromLong(py_line); if (unlikely(!py_py_line)) goto bad; if (c_line) { py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); } else { py_funcname = PyUnicode_FromString(funcname); } if (unlikely(!py_funcname)) goto bad; dict = PyDict_New(); if (unlikely(!dict)) goto bad; { PyObject *old_code_object = code_object; code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); Py_DECREF(old_code_object); } if (unlikely(!code_object)) goto bad; __pyx_insert_code_object(c_line ? -c_line : py_line, code_object); } else { dict = PyDict_New(); } getframe = PySys_GetObject("_getframe"); if (unlikely(!getframe)) goto bad; if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; frame = PyEval_EvalCode(code_object, dict, dict); if (unlikely(!frame) || frame == Py_None) goto bad; success = 1; bad: PyErr_Restore(exc_type, exc_value, exc_traceback); Py_XDECREF(code_object); Py_XDECREF(py_py_line); Py_XDECREF(py_funcname); Py_XDECREF(dict); Py_XDECREF(replace); if (success) { PyTraceBack_Here( (struct _frame*)frame); } Py_XDECREF(frame); } #else static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = NULL; PyObject *py_funcname = NULL; if (c_line) { py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); if (!py_funcname) goto bad; funcname = PyUnicode_AsUTF8(py_funcname); if (!funcname) goto bad; } py_code = PyCode_NewEmpty(filename, funcname, py_line); Py_XDECREF(py_funcname); return py_code; bad: 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; PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject *ptype, *pvalue, *ptraceback; if (c_line) { c_line = __Pyx_CLineForTraceback(tstate, c_line); } py_code = __pyx_find_code_object(c_line ? -c_line : py_line); if (!py_code) { __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) { /* If the code object creation fails, then we should clear the fetched exception references and propagate the new exception */ Py_XDECREF(ptype); Py_XDECREF(pvalue); Py_XDECREF(ptraceback); goto bad; } __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } py_frame = PyFrame_New( tstate, /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ __pyx_mstate_global->__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); } #endif /* 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 int __Pyx_PyLong_As_int(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const int neg_one = (int) -1, const_zero = (int) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (unlikely(!PyLong_Check(x))) { int val; PyObject *tmp = __Pyx_PyNumber_Long(x); if (!tmp) return (int) -1; val = __Pyx_PyLong_As_int(tmp); Py_DECREF(tmp); return val; } if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS if (unlikely(__Pyx_PyLong_IsNeg(x))) { goto raise_neg_overflow; } else if (__Pyx_PyLong_IsCompact(x)) { __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_DigitCount(x)) { 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 && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (int) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if ((sizeof(int) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_USE_PYLONG_INTERNALS if (__Pyx_PyLong_IsCompact(x)) { __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_SignedDigitCount(x)) { case -2: if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 2: if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -3: if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 3: if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -4: if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 4: if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; } } #endif if ((sizeof(int) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { int val; int ret = -1; #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API Py_ssize_t bytes_copied = PyLong_AsNativeBytes( x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); if (unlikely(bytes_copied == -1)) { } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { goto raise_overflow; } else { ret = 0; } #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; ret = _PyLong_AsByteArray((PyLongObject *)x, bytes, sizeof(val), is_little, !is_unsigned); #else PyObject *v; PyObject *stepval = NULL, *mask = NULL, *shift = NULL; int bits, remaining_bits, is_negative = 0; int chunk_size = (sizeof(long) < 8) ? 30 : 62; if (likely(PyLong_CheckExact(x))) { v = __Pyx_NewRef(x); } else { v = PyNumber_Long(x); if (unlikely(!v)) return (int) -1; assert(PyLong_CheckExact(v)); } { int result = PyObject_RichCompareBool(v, Py_False, Py_LT); if (unlikely(result < 0)) { Py_DECREF(v); return (int) -1; } is_negative = result == 1; } if (is_unsigned && unlikely(is_negative)) { Py_DECREF(v); goto raise_neg_overflow; } else if (is_negative) { stepval = PyNumber_Invert(v); Py_DECREF(v); if (unlikely(!stepval)) return (int) -1; } else { stepval = v; } v = NULL; val = (int) 0; mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { PyObject *tmp, *digit; long idigit; digit = PyNumber_And(stepval, mask); if (unlikely(!digit)) goto done; idigit = PyLong_AsLong(digit); Py_DECREF(digit); if (unlikely(idigit < 0)) goto done; val |= ((int) idigit) << bits; tmp = PyNumber_Rshift(stepval, shift); if (unlikely(!tmp)) goto done; Py_DECREF(stepval); stepval = tmp; } Py_DECREF(shift); shift = NULL; Py_DECREF(mask); mask = NULL; { long idigit = PyLong_AsLong(stepval); if (unlikely(idigit < 0)) goto done; remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); if (unlikely(idigit >= (1L << remaining_bits))) goto raise_overflow; val |= ((int) idigit) << bits; } if (!is_unsigned) { if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) goto raise_overflow; if (is_negative) val = ~val; } ret = 0; done: Py_XDECREF(shift); Py_XDECREF(mask); Py_XDECREF(stepval); #endif if (unlikely(ret)) return (int) -1; return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); return (int) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to int"); return (int) -1; } /* CIntFromPy */ static CYTHON_INLINE unsigned int __Pyx_PyLong_As_unsigned_int(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (unlikely(!PyLong_Check(x))) { unsigned int val; PyObject *tmp = __Pyx_PyNumber_Long(x); if (!tmp) return (unsigned int) -1; val = __Pyx_PyLong_As_unsigned_int(tmp); Py_DECREF(tmp); return val; } if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS if (unlikely(__Pyx_PyLong_IsNeg(x))) { goto raise_neg_overflow; } else if (__Pyx_PyLong_IsCompact(x)) { __PYX_VERIFY_RETURN_INT(unsigned int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_DigitCount(x)) { case 2: if ((8 * sizeof(unsigned int) > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT)) { return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); } } break; case 3: if ((8 * sizeof(unsigned int) > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT)) { return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); } } break; case 4: if ((8 * sizeof(unsigned int) > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(unsigned int) >= 4 * PyLong_SHIFT)) { return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); } } break; } } #endif #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (unsigned int) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if ((sizeof(unsigned int) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x)) } else if ((sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_USE_PYLONG_INTERNALS if (__Pyx_PyLong_IsCompact(x)) { __PYX_VERIFY_RETURN_INT(unsigned int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_SignedDigitCount(x)) { case -2: if ((8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) { return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); } } break; case 2: if ((8 * sizeof(unsigned int) > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) { return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); } } break; case -3: if ((8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) { return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); } } break; case 3: if ((8 * sizeof(unsigned int) > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) { return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); } } break; case -4: if ((8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT)) { return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); } } break; case 4: if ((8 * sizeof(unsigned int) > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT)) { return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); } } break; } } #endif if ((sizeof(unsigned int) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x)) } else if ((sizeof(unsigned int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { unsigned int val; int ret = -1; #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API Py_ssize_t bytes_copied = PyLong_AsNativeBytes( x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); if (unlikely(bytes_copied == -1)) { } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { goto raise_overflow; } else { ret = 0; } #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; ret = _PyLong_AsByteArray((PyLongObject *)x, bytes, sizeof(val), is_little, !is_unsigned); #else PyObject *v; PyObject *stepval = NULL, *mask = NULL, *shift = NULL; int bits, remaining_bits, is_negative = 0; int chunk_size = (sizeof(long) < 8) ? 30 : 62; if (likely(PyLong_CheckExact(x))) { v = __Pyx_NewRef(x); } else { v = PyNumber_Long(x); if (unlikely(!v)) return (unsigned int) -1; assert(PyLong_CheckExact(v)); } { int result = PyObject_RichCompareBool(v, Py_False, Py_LT); if (unlikely(result < 0)) { Py_DECREF(v); return (unsigned int) -1; } is_negative = result == 1; } if (is_unsigned && unlikely(is_negative)) { Py_DECREF(v); goto raise_neg_overflow; } else if (is_negative) { stepval = PyNumber_Invert(v); Py_DECREF(v); if (unlikely(!stepval)) return (unsigned int) -1; } else { stepval = v; } v = NULL; val = (unsigned int) 0; mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; for (bits = 0; bits < (int) sizeof(unsigned int) * 8 - chunk_size; bits += chunk_size) { PyObject *tmp, *digit; long idigit; digit = PyNumber_And(stepval, mask); if (unlikely(!digit)) goto done; idigit = PyLong_AsLong(digit); Py_DECREF(digit); if (unlikely(idigit < 0)) goto done; val |= ((unsigned int) idigit) << bits; tmp = PyNumber_Rshift(stepval, shift); if (unlikely(!tmp)) goto done; Py_DECREF(stepval); stepval = tmp; } Py_DECREF(shift); shift = NULL; Py_DECREF(mask); mask = NULL; { long idigit = PyLong_AsLong(stepval); if (unlikely(idigit < 0)) goto done; remaining_bits = ((int) sizeof(unsigned int) * 8) - bits - (is_unsigned ? 0 : 1); if (unlikely(idigit >= (1L << remaining_bits))) goto raise_overflow; val |= ((unsigned int) idigit) << bits; } if (!is_unsigned) { if (unlikely(val & (((unsigned int) 1) << (sizeof(unsigned int) * 8 - 1)))) goto raise_overflow; if (is_negative) val = ~val; } ret = 0; done: Py_XDECREF(shift); Py_XDECREF(mask); Py_XDECREF(stepval); #endif if (unlikely(ret)) return (unsigned int) -1; return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned int"); return (unsigned int) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned int"); return (unsigned int) -1; } /* PyObjectVectorCallKwBuilder (used by CIntToPy) */ #if CYTHON_VECTORCALL static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { (void)__Pyx_PyObject_FastCallDict; Py_INCREF(key); if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; args[n] = value; return 0; } CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { (void)__Pyx_VectorcallBuilder_AddArgStr; if (unlikely(!PyUnicode_Check(key))) { PyErr_SetString(PyExc_TypeError, "keywords must be strings"); return -1; } return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n); } static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) { PyObject *pyKey = PyUnicode_FromString(key); if (!pyKey) return -1; return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n); } #else // CYTHON_VECTORCALL CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) { if (unlikely(!PyUnicode_Check(key))) { PyErr_SetString(PyExc_TypeError, "keywords must be strings"); return -1; } return PyDict_SetItem(builder, key, value); } #endif /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const int neg_one = (int) -1, const_zero = (int) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(int) < sizeof(long)) { return PyLong_FromLong((long) value); } else if (sizeof(int) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #if !CYTHON_COMPILING_IN_PYPY } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(int) <= sizeof(long)) { return PyLong_FromLong((long) value); } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); } } { unsigned char *bytes = (unsigned char *)&value; #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 if (is_unsigned) { return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); } else { return PyLong_FromNativeBytes(bytes, sizeof(value), -1); } #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 int one = 1; int little = (int)*(unsigned char *)&one; return _PyLong_FromByteArray(bytes, sizeof(int), little, !is_unsigned); #else int one = 1; int little = (int)*(unsigned char *)&one; PyObject *from_bytes, *result = NULL, *kwds = NULL; PyObject *py_bytes = NULL, *order_str = NULL; from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); if (!from_bytes) return NULL; py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); if (!py_bytes) goto limited_bad; order_str = PyUnicode_FromString(little ? "little" : "big"); if (!order_str) goto limited_bad; { PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; if (!is_unsigned) { kwds = __Pyx_MakeVectorcallBuilderKwds(1); if (!kwds) goto limited_bad; if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; } result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); } limited_bad: Py_XDECREF(kwds); Py_XDECREF(order_str); Py_XDECREF(py_bytes); Py_XDECREF(from_bytes); return result; #endif } } /* FormatTypeName */ #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp) { PyObject *module = NULL, *name = NULL, *result = NULL; #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, __pyx_mstate_global->__pyx_n_u_qualname); #else name = PyType_GetQualName(tp); #endif if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad; module = __Pyx_PyObject_GetAttrStr((PyObject *)tp, __pyx_mstate_global->__pyx_n_u_module); if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad; if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) { result = name; name = NULL; goto done; } result = PyUnicode_FromFormat("%U.%U", module, name); if (unlikely(result == NULL)) goto bad; done: Py_XDECREF(name); Py_XDECREF(module); return result; bad: PyErr_Clear(); if (name) { result = name; name = NULL; } else { result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__4); } goto done; } #endif /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const long neg_one = (long) -1, const_zero = (long) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(long) < sizeof(long)) { return PyLong_FromLong((long) value); } else if (sizeof(long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #if !CYTHON_COMPILING_IN_PYPY } 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 PyLong_FromLong((long) value); } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); } } { unsigned char *bytes = (unsigned char *)&value; #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 if (is_unsigned) { return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); } else { return PyLong_FromNativeBytes(bytes, sizeof(value), -1); } #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 int one = 1; int little = (int)*(unsigned char *)&one; return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); #else int one = 1; int little = (int)*(unsigned char *)&one; PyObject *from_bytes, *result = NULL, *kwds = NULL; PyObject *py_bytes = NULL, *order_str = NULL; from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); if (!from_bytes) return NULL; py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); if (!py_bytes) goto limited_bad; order_str = PyUnicode_FromString(little ? "little" : "big"); if (!order_str) goto limited_bad; { PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; if (!is_unsigned) { kwds = __Pyx_MakeVectorcallBuilderKwds(1); if (!kwds) goto limited_bad; if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; } result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); } limited_bad: Py_XDECREF(kwds); Py_XDECREF(order_str); Py_XDECREF(py_bytes); Py_XDECREF(from_bytes); return result; #endif } } /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const long neg_one = (long) -1, const_zero = (long) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (unlikely(!PyLong_Check(x))) { long val; PyObject *tmp = __Pyx_PyNumber_Long(x); if (!tmp) return (long) -1; val = __Pyx_PyLong_As_long(tmp); Py_DECREF(tmp); return val; } if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS if (unlikely(__Pyx_PyLong_IsNeg(x))) { goto raise_neg_overflow; } else if (__Pyx_PyLong_IsCompact(x)) { __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_DigitCount(x)) { 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 && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (long) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if ((sizeof(long) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_USE_PYLONG_INTERNALS if (__Pyx_PyLong_IsCompact(x)) { __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_SignedDigitCount(x)) { case -2: if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 2: if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -3: if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 3: if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -4: if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 4: if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; } } #endif if ((sizeof(long) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { long val; int ret = -1; #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API Py_ssize_t bytes_copied = PyLong_AsNativeBytes( x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); if (unlikely(bytes_copied == -1)) { } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { goto raise_overflow; } else { ret = 0; } #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; ret = _PyLong_AsByteArray((PyLongObject *)x, bytes, sizeof(val), is_little, !is_unsigned); #else PyObject *v; PyObject *stepval = NULL, *mask = NULL, *shift = NULL; int bits, remaining_bits, is_negative = 0; int chunk_size = (sizeof(long) < 8) ? 30 : 62; if (likely(PyLong_CheckExact(x))) { v = __Pyx_NewRef(x); } else { v = PyNumber_Long(x); if (unlikely(!v)) return (long) -1; assert(PyLong_CheckExact(v)); } { int result = PyObject_RichCompareBool(v, Py_False, Py_LT); if (unlikely(result < 0)) { Py_DECREF(v); return (long) -1; } is_negative = result == 1; } if (is_unsigned && unlikely(is_negative)) { Py_DECREF(v); goto raise_neg_overflow; } else if (is_negative) { stepval = PyNumber_Invert(v); Py_DECREF(v); if (unlikely(!stepval)) return (long) -1; } else { stepval = v; } v = NULL; val = (long) 0; mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { PyObject *tmp, *digit; long idigit; digit = PyNumber_And(stepval, mask); if (unlikely(!digit)) goto done; idigit = PyLong_AsLong(digit); Py_DECREF(digit); if (unlikely(idigit < 0)) goto done; val |= ((long) idigit) << bits; tmp = PyNumber_Rshift(stepval, shift); if (unlikely(!tmp)) goto done; Py_DECREF(stepval); stepval = tmp; } Py_DECREF(shift); shift = NULL; Py_DECREF(mask); mask = NULL; { long idigit = PyLong_AsLong(stepval); if (unlikely(idigit < 0)) goto done; remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); if (unlikely(idigit >= (1L << remaining_bits))) goto raise_overflow; val |= ((long) idigit) << bits; } if (!is_unsigned) { if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) goto raise_overflow; if (is_negative) val = ~val; } ret = 0; done: Py_XDECREF(shift); Py_XDECREF(mask); Py_XDECREF(stepval); #endif if (unlikely(ret)) return (long) -1; return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); return (long) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long) -1; } /* FastTypeChecks */ #if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); if (a == b) return 1; } return b == &PyBaseObject_Type; } static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { PyObject *mro; if (a == b) return 1; mro = a->tp_mro; if (likely(mro)) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(mro); for (i = 0; i < n; i++) { if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) return 1; } return 0; } return __Pyx_InBases(a, b); } static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { PyObject *mro; if (cls == a || cls == b) return 1; mro = cls->tp_mro; if (likely(mro)) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(mro); for (i = 0; i < n; i++) { PyObject *base = PyTuple_GET_ITEM(mro, i); if (base == (PyObject *)a || base == (PyObject *)b) return 1; } return 0; } return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); } static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { if (exc_type1) { return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); } else { return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); } } static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { Py_ssize_t i, n; assert(PyExceptionClass_Check(exc_type)); n = PyTuple_GET_SIZE(tuple); for (i=0; i>= 8; ++i; } __Pyx_cached_runtime_version = version; } } #endif static unsigned long __Pyx_get_runtime_version(void) { #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 return Py_Version & ~0xFFUL; #else return __Pyx_cached_runtime_version; #endif } /* CheckBinaryVersion */ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) { const unsigned long MAJOR_MINOR = 0xFFFF0000UL; if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR)) return 0; if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR))) return 1; { char message[200]; PyOS_snprintf(message, sizeof(message), "compile time Python version %d.%d " "of module '%.100s' " "%s " "runtime version %d.%d", (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF), __Pyx_MODULE_NAME, (allow_newer) ? "was newer than" : "does not match", (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF) ); return PyErr_WarnEx(NULL, message, 1); } } /* NewCodeObj */ #if CYTHON_COMPILING_IN_LIMITED_API static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { PyObject *exception_table = NULL; PyObject *types_module=NULL, *code_type=NULL, *result=NULL; #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 PyObject *version_info; PyObject *py_minor_version = NULL; #endif long minor_version = 0; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 minor_version = 11; #else if (!(version_info = PySys_GetObject("version_info"))) goto end; if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; minor_version = PyLong_AsLong(py_minor_version); Py_DECREF(py_minor_version); if (minor_version == -1 && PyErr_Occurred()) goto end; #endif if (!(types_module = PyImport_ImportModule("types"))) goto end; if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; if (minor_version <= 7) { (void)p; result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code, c, n, v, fn, name, fline, lnos, fv, cell); } else if (minor_version <= 10) { result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code, c, n, v, fn, name, fline, lnos, fv, cell); } else { if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code, c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); } end: Py_XDECREF(code_type); Py_XDECREF(exception_table); Py_XDECREF(types_module); if (type) { PyErr_Restore(type, value, traceback); } return result; } #elif PY_VERSION_HEX >= 0x030B0000 static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { PyCodeObject *result; result = #if PY_VERSION_HEX >= 0x030C0000 PyUnstable_Code_NewWithPosOnlyArgs #else PyCode_NewWithPosOnlyArgs #endif (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1 if (likely(result)) result->_co_firsttraceable = 0; #endif return result; } #elif !CYTHON_COMPILING_IN_PYPY #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif static PyObject* __Pyx_PyCode_New( const __Pyx_PyCode_New_function_description descr, PyObject * const *varnames, PyObject *filename, PyObject *funcname, PyObject *line_table, PyObject *tuple_dedup_map ) { PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL; Py_ssize_t var_count = (Py_ssize_t) descr.nlocals; PyObject *varnames_tuple = PyTuple_New(var_count); if (unlikely(!varnames_tuple)) return NULL; for (Py_ssize_t i=0; i < var_count; i++) { Py_INCREF(varnames[i]); if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done; } #if CYTHON_COMPILING_IN_LIMITED_API varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple); if (!varnames_tuple_dedup) { if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done; varnames_tuple_dedup = varnames_tuple; } #else varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple); if (unlikely(!varnames_tuple_dedup)) goto done; #endif #if CYTHON_AVOID_BORROWED_REFS Py_INCREF(varnames_tuple_dedup); #endif if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) { Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(line_table_length == -1)) goto done; #endif Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL; code_bytes = PyBytes_FromStringAndSize(NULL, code_len); if (unlikely(!code_bytes)) goto done; char* c_code_bytes = PyBytes_AsString(code_bytes); if (unlikely(!c_code_bytes)) goto done; memset(c_code_bytes, 0, (size_t) code_len); } code_obj = (PyObject*) __Pyx__PyCode_New( (int) descr.argcount, (int) descr.num_posonly_args, (int) descr.num_kwonly_args, (int) descr.nlocals, 0, (int) descr.flags, code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes, __pyx_mstate_global->__pyx_empty_tuple, __pyx_mstate_global->__pyx_empty_tuple, varnames_tuple_dedup, __pyx_mstate_global->__pyx_empty_tuple, __pyx_mstate_global->__pyx_empty_tuple, filename, funcname, (int) descr.first_line, (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes ); done: Py_XDECREF(code_bytes); #if CYTHON_AVOID_BORROWED_REFS Py_XDECREF(varnames_tuple_dedup); #endif Py_DECREF(varnames_tuple); return code_obj; } /* DecompressString */ static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) { PyObject *module = NULL, *decompress, *compressed_bytes, *decompressed; const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib"; PyObject *methodname = PyUnicode_FromString("decompress"); if (unlikely(!methodname)) return NULL; #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000 if (algo == 3) { PyObject *fromlist = Py_BuildValue("[O]", methodname); if (unlikely(!fromlist)) goto bad; module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0); Py_DECREF(fromlist); } else #endif module = PyImport_ImportModule(module_name); if (unlikely(!module)) goto import_failed; decompress = PyObject_GetAttr(module, methodname); if (unlikely(!decompress)) goto import_failed; { #ifdef __cplusplus char *memview_bytes = const_cast(s); #else #if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wcast-qual" #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-qual" #endif char *memview_bytes = (char*) s; #if defined(__clang__) #pragma clang diagnostic pop #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) #pragma GCC diagnostic pop #endif #endif #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ) int memview_flags = 0x100; #else int memview_flags = PyBUF_READ; #endif compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags); } if (unlikely(!compressed_bytes)) { Py_DECREF(decompress); goto bad; } decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL); Py_DECREF(compressed_bytes); Py_DECREF(decompress); Py_DECREF(module); Py_DECREF(methodname); return decompressed; import_failed: PyErr_Format(PyExc_ImportError, "Failed to import '%.20s.decompress' - cannot initialise module strings. " "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.", module_name, algo); bad: Py_XDECREF(module); Py_DECREF(methodname); return NULL; } #include static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { size_t len = strlen(s); if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) { PyErr_SetString(PyExc_OverflowError, "byte string is too long"); return -1; } return (Py_ssize_t) len; } static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { Py_ssize_t len = __Pyx_ssize_strlen(c_str); if (unlikely(len < 0)) return NULL; return __Pyx_PyUnicode_FromStringAndSize(c_str, len); } static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) { Py_ssize_t len = __Pyx_ssize_strlen(c_str); if (unlikely(len < 0)) return NULL; return PyByteArray_FromStringAndSize(c_str, len); } static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; #if CYTHON_COMPILING_IN_LIMITED_API { const char* result; Py_ssize_t unicode_length; CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL; #else result = PyUnicode_AsUTF8AndSize(o, length); #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII unicode_length = PyUnicode_GetLength(o); if (unlikely(unicode_length < 0)) return NULL; if (unlikely(unicode_length != *length)) { PyUnicode_AsASCIIString(o); return NULL; } #endif return result; } #else #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (likely(PyUnicode_IS_ASCII(o))) { *length = PyUnicode_GET_LENGTH(o); return PyUnicode_AsUTF8(o); } else { PyUnicode_AsASCIIString(o); return NULL; } #else return PyUnicode_AsUTF8AndSize(o, length); #endif #endif } #endif static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 if (PyUnicode_Check(o)) { return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif if (PyByteArray_Check(o)) { #if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))) *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); #else *length = PyByteArray_Size(o); if (*length == -1) return NULL; return PyByteArray_AsString(o); #endif } else { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); if (unlikely(r < 0)) { return NULL; } else { return result; } } } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { int retval; if (unlikely(!x)) return -1; retval = __Pyx_PyObject_IsTrue(x); Py_DECREF(x); return retval; } static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) { __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result)); if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " "The ability to return an instance of a strict subclass of int is deprecated, " "and may be removed in a future version of Python.", result_type_name)) { __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } __Pyx_DECREF_TypeName(result_type_name); return result; } PyErr_Format(PyExc_TypeError, "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")", result_type_name); __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) { #if CYTHON_USE_TYPE_SLOTS PyNumberMethods *m; #endif PyObject *res = NULL; if (likely(PyLong_Check(x))) return __Pyx_NewRef(x); #if CYTHON_USE_TYPE_SLOTS m = Py_TYPE(x)->tp_as_number; if (likely(m && m->nb_int)) { res = m->nb_int(x); } #else if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { res = PyNumber_Long(x); } #endif if (likely(res)) { if (unlikely(!PyLong_CheckExact(res))) { return __Pyx_PyNumber_LongWrongResultType(res); } } 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 (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS if (likely(__Pyx_PyLong_IsCompact(b))) { return __Pyx_PyLong_CompactValue(b); } else { const digit* digits = __Pyx_PyLong_Digits(b); const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); 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 = PyLong_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); } else { Py_ssize_t ival; PyObject *x; x = PyNumber_Index(o); if (!x) return -1; ival = PyLong_AsLong(x); Py_DECREF(x); return ival; } } static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) { CYTHON_UNUSED_VAR(b); return __Pyx_NewRef(Py_None); } static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return __Pyx_NewRef(b ? Py_True: Py_False); } static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) { return PyLong_FromSize_t(ival); } /* MultiPhaseInitModuleState */ #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE #ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE #if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000) #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1 #else #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0 #endif #endif #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS #error "Module state with PEP489 requires atomics. Currently that's one of\ C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics" #endif #if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE #define __Pyx_ModuleStateLookup_Lock() #define __Pyx_ModuleStateLookup_Unlock() #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 static PyMutex __Pyx_ModuleStateLookup_mutex = {0}; #define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex) #define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex) #elif defined(__cplusplus) && __cplusplus >= 201103L #include static std::mutex __Pyx_ModuleStateLookup_mutex; #define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock() #define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock() #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__) #include static mtx_t __Pyx_ModuleStateLookup_mutex; static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT; static void __Pyx_ModuleStateLookup_initialize_mutex(void) { mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain); } #define __Pyx_ModuleStateLookup_Lock()\ call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\ mtx_lock(&__Pyx_ModuleStateLookup_mutex) #define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex) #elif defined(HAVE_PTHREAD_H) #include static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER; #define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex) #define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex) #elif defined(_WIN32) #include // synchapi.h on its own doesn't work static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT; #define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) #define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) #else #error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\ Requires C standard >= C11, or C++ standard >= C++11,\ or pthreads, or the Windows 32 API, or Python >= 3.13." #endif typedef struct { int64_t id; PyObject *module; } __Pyx_InterpreterIdAndModule; typedef struct { char interpreter_id_as_index; Py_ssize_t count; Py_ssize_t allocated; __Pyx_InterpreterIdAndModule table[1]; } __Pyx_ModuleStateLookupData; #define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32 #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0; #endif #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0; #else static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL; #endif static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound( __Pyx_InterpreterIdAndModule* table, Py_ssize_t count, int64_t interpreterId) { __Pyx_InterpreterIdAndModule* begin = table; __Pyx_InterpreterIdAndModule* end = begin + count; if (begin->id == interpreterId) { return begin; } while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2; if (halfway->id == interpreterId) { return halfway; } if (halfway->id < interpreterId) { begin = halfway; } else { end = halfway; } } for (; begin < end; ++begin) { if (begin->id >= interpreterId) return begin; } return begin; } static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) { int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); if (interpreter_id == -1) return NULL; #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); { __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); if (likely(data)) { __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data); if (likely(data == new_data)) { goto read_finished; } } __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); __Pyx_ModuleStateLookup_Lock(); __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter); data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); __Pyx_ModuleStateLookup_Unlock(); } read_finished:; #else __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data; #endif __Pyx_InterpreterIdAndModule* found = NULL; if (unlikely(!data)) goto end; if (data->interpreter_id_as_index) { if (interpreter_id < data->count) { found = data->table+interpreter_id; } } else { found = __Pyx_State_FindModuleStateLookupTableLowerBound( data->table, data->count, interpreter_id); } end: { PyObject *result=NULL; if (found && found->id == interpreter_id) { result = found->module; } #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); #endif return result; } } #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) { while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0); } #else #define __Pyx_ModuleStateLookup_wait_until_no_readers() #endif static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) { Py_ssize_t to_allocate = (*old_data)->allocated; while (to_allocate <= interpreter_id) { if (to_allocate == 0) to_allocate = 1; else to_allocate *= 2; } __Pyx_ModuleStateLookupData *new_data = *old_data; if (to_allocate != (*old_data)->allocated) { new_data = (__Pyx_ModuleStateLookupData *)realloc( *old_data, sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); if (!new_data) { PyErr_NoMemory(); return -1; } for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) { new_data->table[i].id = i; new_data->table[i].module = NULL; } new_data->allocated = to_allocate; } new_data->table[interpreter_id].module = module; if (new_data->count < interpreter_id+1) { new_data->count = interpreter_id+1; } *old_data = new_data; return 0; } static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) { __Pyx_InterpreterIdAndModule *read = data->table; __Pyx_InterpreterIdAndModule *write = data->table; __Pyx_InterpreterIdAndModule *end = read + data->count; for (; readmodule) { write->id = read->id; write->module = read->module; ++write; } } data->count = write - data->table; for (; writeid = 0; write->module = NULL; } data->interpreter_id_as_index = 0; } static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) { int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); if (interpreter_id == -1) return -1; int result = 0; __Pyx_ModuleStateLookup_Lock(); #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *) __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); #else __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data; #endif __Pyx_ModuleStateLookupData *new_data = old_data; if (!new_data) { new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData)); if (!new_data) { result = -1; PyErr_NoMemory(); goto end; } new_data->allocated = 1; new_data->interpreter_id_as_index = 1; } __Pyx_ModuleStateLookup_wait_until_no_readers(); if (new_data->interpreter_id_as_index) { if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id); goto end; } __Pyx_State_ConvertFromInterpIdAsIndex(new_data); } { Py_ssize_t insert_at = 0; { __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( new_data->table, new_data->count, interpreter_id); assert(lower_bound); insert_at = lower_bound - new_data->table; if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) { lower_bound->module = module; goto end; // already in table, nothing more to do } } if (new_data->count+1 >= new_data->allocated) { Py_ssize_t to_allocate = (new_data->count+1)*2; new_data = (__Pyx_ModuleStateLookupData*)realloc( new_data, sizeof(__Pyx_ModuleStateLookupData) + (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); if (!new_data) { result = -1; new_data = old_data; PyErr_NoMemory(); goto end; } new_data->allocated = to_allocate; } ++new_data->count; int64_t last_id = interpreter_id; PyObject *last_module = module; for (Py_ssize_t i=insert_at; icount; ++i) { int64_t current_id = new_data->table[i].id; new_data->table[i].id = last_id; last_id = current_id; PyObject *current_module = new_data->table[i].module; new_data->table[i].module = last_module; last_module = current_module; } } end: #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data); #else __Pyx_ModuleStateLookup_data = new_data; #endif __Pyx_ModuleStateLookup_Unlock(); return result; } static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) { int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); if (interpreter_id == -1) return -1; __Pyx_ModuleStateLookup_Lock(); #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *) __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); #else __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data; #endif if (data->interpreter_id_as_index) { if (interpreter_id < data->count) { data->table[interpreter_id].module = NULL; } goto done; } { __Pyx_ModuleStateLookup_wait_until_no_readers(); __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( data->table, data->count, interpreter_id); if (!lower_bound) goto done; if (lower_bound->id != interpreter_id) goto done; __Pyx_InterpreterIdAndModule *end = data->table+data->count; for (;lower_boundid = (lower_bound+1)->id; lower_bound->module = (lower_bound+1)->module; } } --data->count; if (data->count == 0) { free(data); data = NULL; } done: #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data); #else __Pyx_ModuleStateLookup_data = data; #endif __Pyx_ModuleStateLookup_Unlock(); return 0; } #endif /* #### Code section: utility_code_pragmas_end ### */ #ifdef _MSC_VER #pragma warning( pop ) #endif /* #### Code section: end ### */ #endif /* Py_PYTHON_H */ graph-algorithms-planarity-08d7b51/planarity/full/graph.pxd000066400000000000000000000006601522057144000241040ustar00rootroot00000000000000"""Definition file for Graph extension type This definition file corresponds to the graph.pyx implementation file, and allows other Cython modules access to the Graph extension type. N.B. Please see Cython documentation: https://cython.readthedocs.io/en/latest/src/userguide/sharing_declarations.html#sharing-extension-types """ from planarity.full cimport graphLib cdef class Graph: cdef graphLib.graphP _theGraph graph-algorithms-planarity-08d7b51/planarity/full/graph.pyx000066400000000000000000002537071522057144000241450ustar00rootroot00000000000000#!/usr/bin/env python # cython: embedsignature=True """ Cython wrapper for the Edge Addition Planarity Suite Graph Library Wraps a graphP struct using a Cython class and wraps functions and macros that operate over graphP structs. """ from libc.stdlib cimport free from planarity.full cimport graphLib from planarity.full import graphLib OK = graphLib.OK NONEMBEDDABLE = graphLib.NONEMBEDDABLE NOTOK = graphLib.NOTOK TRUE = graphLib.TRUE FALSE = graphLib.FALSE NIL = graphLib.NIL EDGE_TYPE_CHILD = graphLib.EDGE_TYPE_CHILD EDGE_TYPE_FORWARD = graphLib.EDGE_TYPE_FORWARD EDGE_TYPE_PARENT = graphLib.EDGE_TYPE_PARENT EDGE_TYPE_BACK = graphLib.EDGE_TYPE_BACK EDGE_TYPE_TREE = graphLib.EDGE_TYPE_TREE EDGE_TYPE_NOTDEFINED = graphLib.EDGE_TYPE_NOTDEFINED EDGEFLAG_DIRECTION_INONLY = graphLib.EDGEFLAG_DIRECTION_INONLY EDGEFLAG_DIRECTION_OUTONLY = graphLib.EDGEFLAG_DIRECTION_OUTONLY AT_EDGE_CAPACITY_LIMIT = graphLib.AT_EDGE_CAPACITY_LIMIT WRITE_ADJLIST = graphLib.WRITE_ADJLIST WRITE_ADJMATRIX = graphLib.WRITE_ADJMATRIX WRITE_G6 = graphLib.WRITE_G6 EMBEDFLAGS_PLANAR = graphLib.EMBEDFLAGS_PLANAR EMBEDFLAGS_DRAWPLANAR = graphLib.EMBEDFLAGS_DRAWPLANAR EMBEDFLAGS_OUTERPLANAR = graphLib.EMBEDFLAGS_OUTERPLANAR EMBEDFLAGS_SEARCHFORK23 = graphLib.EMBEDFLAGS_SEARCHFORK23 EMBEDFLAGS_SEARCHFORK33 = graphLib.EMBEDFLAGS_SEARCHFORK33 EMBEDFLAGS_SEARCHFORK4 = graphLib.EMBEDFLAGS_SEARCHFORK4 cdef class Graph: def __cinit__(self): """Allocates the underlying graph structure with gp_New(). Raises: MemoryError if C graphlib version of gp_New() failed. """ global global_id_count self._theGraph = graphLib.gp_New() if self._theGraph == NULL: raise MemoryError("gp_New() failed.") def __dealloc__(self): """Frees the underlying graph structure with gp_Free().""" if self._theGraph != NULL: graphLib.gp_Free(&self._theGraph) def gp_EnsureVertexCapacity(self, int N) -> None: """Allocates memory needed for storage of graph data, especially N vertices, N virtual vertices, and space for either 3N edges or the amount set by gp_EnsureEdgeCapacity(). This method does not currently support being called more than once to increase vertex capacity beyond the initial setting for N. Args: N: The number of vertices Raises: RuntimeError if C graphlib version of this function failed. """ # Parameter validation done by the C layer function result = graphLib.gp_EnsureVertexCapacity(self._theGraph, N) if result != OK: raise RuntimeError( f"gp_EnsureVertexCapacity() failed for given order {N}." ) def gp_EnsureEdgeCapacity(self, int requiredEdgeCapacity) -> None: """Ensures that the graph has or will have space for at least requiredEdgeCapacity edges. This method can be called multiple times to increase edge capacity as needed. If the graph already has at least requiredEdgeCapacity edges, then this method simply returns (edge capacity is not reduced). Args: requiredEdgeCapacity: The required edge capacity Raises: RuntimeError if C graphlib version of this function failed. """ # Parameter validation done by the C layer function result = graphLib.gp_EnsureEdgeCapacity(self._theGraph, requiredEdgeCapacity) if result != OK: raise RuntimeError( "gp_EnsureEdgeCapacity() failed to set edge capacity to " f"{requiredEdgeCapacity}.") def gp_ResetGraphStorage(self) -> None: """Resets graph storage (including 'subclass' extension data).""" graphLib.gp_ResetGraphStorage(self._theGraph) def gp_GetN(self) -> int: """Getter for the number of vertices in the graph. Returns: The number of vertices in the graph. """ return graphLib.gp_GetN(self._theGraph) def gp_GetNV(self) -> int: """Getter for the number of virtual vertices available in the graph. Returns: The number of virtual vertices available in the graph. """ return graphLib.gp_GetNV(self._theGraph) def gp_GetM(self) -> int: """Getter for number of edges in the graph, M. Returns: The number of edges in the graph. """ return graphLib.gp_GetM(self._theGraph) def gp_GetEdgeCapacity(self) -> int: """Getter for the edge capacity of the graph. Returns: The edge capacity of the graph. """ return graphLib.gp_GetEdgeCapacity(self._theGraph) def gp_CopyGraph(self, Graph srcGraph) -> None: """Copies src_graph into the destination Graph referred to by self. Args: srcGraph: the Graph wrapping the graphP you wish to to copy into the current Graph's graphP. Raises: RuntimeError if C graphlib version of this function failed. """ # Parameter validation done by the C layer function result = graphLib.gp_CopyGraph(self._theGraph, srcGraph._theGraph) if result != OK: raise RuntimeError(f"gp_CopyGraph() failed.") def gp_DupGraph(self) -> Graph: """Creates a Graph wrapping a copy of the current Graph's graphP. Returns: A new Graph containing a duplicate of the current Graph's graphP. Raises: MemoryError if gp_DupGraph() failed to duplicate this Graph's graphP """ cdef graphLib.graphP theGraph_dup = graphLib.gp_DupGraph(self._theGraph) if theGraph_dup == NULL: raise MemoryError("gp_DupGraph() failed.") cdef Graph new_graph = Graph() graphLib.gp_Free(&new_graph._theGraph) new_graph._theGraph = theGraph_dup return new_graph def gp_CopyAdjacencyLists(self, Graph srcGraph) -> None: """Copies adjacency lists of src_graph into current Graph's graphP. Args: srcGraph: a Graph that wraps the graphP whose adjacency lists you wish to copy into the self's graphP. Raises: RuntimeError if C graphlib version of this function failed. """ result = graphLib.gp_CopyAdjacencyLists(self._theGraph, srcGraph._theGraph) if result != OK: raise RuntimeError( "Unable to copy adjacency lists from to this graph." ) def gp_CreateRandomGraph(self) -> None: """Creates a simple connected graph with a random number of edges, up to the limit of the graph's edge capacity. Raises: RuntimeError if C graphlib version of this function failed. """ result = graphLib.gp_CreateRandomGraph(self._theGraph) if result != OK: raise RuntimeError("Unable to create random graph.") def gp_CreateRandomGraphEx(self, int numEdges) -> None: """Creates a simple connected graph with numEdges edges. If numEdges does not exceed 3N-6, then the generated graph will be planar. Args: numEdges: the desired number of edges for the generated graph Raises: RuntimeError if C graphlib version of this function failed. """ # Parameter validation is done by the C layer function result = graphLib.gp_CreateRandomGraphEx(self._theGraph, numEdges) if result != OK: raise RuntimeError( f"Unable to create random graph with num_edges = {numEdges}." ) def gp_IsNeighbor(self, int u, int v) -> int: """Checks if a vertex or virtual vertex is a neighbor of another vertex or virtual vertex in the graph. Args: u: index of a vertex or virtual vertices in the graph v: index of another vertex or virtual vertex in the graph Returns: TRUE if u and v are neighbors, FALSE otherwise """ # Parameter validation is done by the C layer function return graphLib.gp_IsNeighbor(self._theGraph, u, v) def gp_FindEdge(self, int u, int v) -> int: """Find index of edge between u and v if it exists in graph. Args: u: index of a vertex in graph v: index of another vertex in graph Returns: NIL if edge not found, or the index e of the edge between u and v """ # Parameter validation is done by the C layer function return graphLib.gp_FindEdge(self._theGraph, u, v) def gp_GetVertexDegree(self, int v) -> int: """Gets the number of incident edges of the vertex with given index. Args: v: index of a vertex in the graph Returns: The degree of vertex v in the graph """ # Parameter validation is done by the C layer function return graphLib.gp_GetVertexDegree(self._theGraph, v) def gp_IsNeighborDirected(self, int u, int v, unsigned direction) -> int: """Checks if edge exists in a given direction between two vertices. Args: u: index of a vertex in graph v: index of another vertex in graph direction: EDGEFLAG_DIRECTION_INONLY or EDGEFLAG_DIRECTION_OUTONLY Returns: TRUE if u and v are neighbors (the edge is undirected or matches the given direction, FALSE otherwise """ # Parameter validation is done by the C layer function return graphLib.gp_IsNeighborDirected(self._theGraph, u, v, direction) def gp_FindDirectedEdge(self, int u, int v, unsigned direction) -> int: """Find directed index of edge between u and v if it exists in graph. Args: u: index of a vertex in graph v: index of another vertex in graph direction: EDGEFLAG_DIRECTION_INONLY or EDGEFLAG_DIRECTION_OUTONLY Returns: NIL if edge not found, or the index e of the directed edge between u and v """ # Parameter validation is done by the C layer function return graphLib.gp_FindDirectedEdge(self._theGraph, u, v, direction) def gp_GetVertexInDegree(self, int v) -> int: """Gets in-degree of v, including undirected edges Args: v: index of a vertex in graph Returns: The in-degree of the vertex with index v """ # Parameter validation is done by the C layer function return graphLib.gp_GetVertexInDegree(self._theGraph, v) def gp_GetVertexOutDegree(self, int v) -> int: """Gets out-degree of v, including undirected edges. Args: v: index of a vertex in graph Returns: The out-degree of the vertex with index v """ # Parameter validation is done by the C layer function return graphLib.gp_GetVertexOutDegree(self._theGraph, v) def gp_AddEdge(self, int u, int ulink, int v, int vlink) -> int: """Adds edge between two vertices (if sufficient edge capacity). Args: u: index of a vertex in graph ulink: either 0 or 1; indicates whether the edge record to v in u's list should become adjacent to u by its 0 or 1 link v: index of another vertex in graph vlink: either 0 or 1; indicates whether the edge record to u in v's list should become adjacent to v by its 0 or 1 link Returns: Returns OK on success, or AT_EDGE_CAPACITY_LIMIT if adding the edge would exceed the graph's edge capacity (the caller can use gp_DynamicAddEdge()). Raises: ValueError if ulink or vlink are anything other than 0 or 1 RuntimeError if gp_AddEdge() returned anything other than OK or AT_EDGE_CAPACITY_LIMIT, i.e., returned NOTOK """ # These have to be checked until the C API checks them. if ulink != 0 and ulink != 1: raise ValueError( f"Invalid link index for ulink: '{ulink}'." ) if vlink != 0 and vlink != 1: raise ValueError( f"Invalid link index for vlink: '{vlink}'." ) # Parameter validation is done by the C layer function result = graphLib.gp_AddEdge(self._theGraph, u, ulink, v, vlink) if result != OK and result != AT_EDGE_CAPACITY_LIMIT: raise RuntimeError( f"gp_AddEdge() failed: unable to add edge (u, v) = ({u}, {v}) " f"with ulink = {ulink} and vlink = {vlink}." ) return result def gp_DynamicAddEdge(self, int u, int ulink, int v, int vlink) -> None: """Adds edge between two vertices, resizing structures if necessessary. Args: u: index of a vertex in graph ulink: either 0 or 1; indicates whether the edge record to v in u's list should become adjacent to u by its 0 or 1 link v: index of another vertex in graph vlink: either 0 or 1; indicates whether the edge record to u in v's list should become adjacent to v by its 0 or 1 link Raises: ValueError ulink or vlink are anything other than 0 or 1 RuntimeError if C graphlib version of this function failed. """ # These have to be checked until the C API checks them. if ulink != 0 and ulink != 1: raise ValueError( f"Invalid link index for ulink: '{ulink}'." ) if vlink != 0 and vlink != 1: raise ValueError( f"Invalid link index for vlink: '{vlink}'." ) # Parameter validation is done by the C layer function result = graphLib.gp_DynamicAddEdge(self._theGraph, u, ulink, v, vlink) if result != OK: raise RuntimeError( "gp_DynamicAddEdge() failed: unable to add edge (u, v) = " f"({u}, {v}) with ulink = {ulink} and vlink = {vlink}." ) def gp_InsertEdge(self, int u, int e_u, int e_ulink, int v, int e_v, int e_vlink) -> int: """Insert edge between u and v in specific positions of adjacency lists. Args: u: index of a vertex in graph e_u: new edge is added next to this edge in u's adjacency list e_ulink: 0 or 1; which side of e_u to add new edge (or which side of the adjacency list of u if e_u is NIL) v: index of a vertex in graph e_v: new edge is added next to this edge in v's adjacency list e_vlink: 0 or 1; which side of e_v to add new edge (or which side of the adjacency list of v if e_v is NIL) Returns: OK on success, or AT_EDGE_CAPACITY_LIMIT if adding the edge would exceed the graph's edge capacity (gp_EnsureEdgeCapacity() can be called before this method). Raises: RuntimeError if gp_InsertEdge() returned anything other than OK or AT_EDGE_CAPACITY_LIMIT """ # Parameter validation is done by the C layer function result = graphLib.gp_InsertEdge(self._theGraph, u, e_u, e_ulink, v, e_v, e_vlink) if result != OK and result != AT_EDGE_CAPACITY_LIMIT: raise RuntimeError( "gp_InsertEdge() failed: unable to insert edge (u, v) = " f"({u}, {v}) adjacent to e_u = {e_u} by e_ulink = {e_ulink} in " f"u's adjacency list and adjacent to e_v = {e_v} by e_vlink = " f"{e_vlink} in v's adjacency list." ) return result def gp_DeleteEdge(self, int e) -> None: """Deletes edge with index e from the graph. Args: e: index of edge in graph to delete Raises: RuntimeError if C graphlib version of this function failed. """ # Parameter validation is done by the C layer function result = graphLib.gp_DeleteEdge(self._theGraph, e) if result != OK: raise RuntimeError( f"gp_DeleteEdge() failed: unable to delete edge e = {e}" ) def gp_HideEdge(self, int e) -> None: """Hides edge with index e within the graph. The edge still exists in edge storage but has been unhooked from the adjacency lists of its endpoint vertices. See gp_RestoreEdge() Args: e: index of edge in graph to hide """ # Parameter validation is done by the C layer function graphLib.gp_HideEdge(self._theGraph, e) def gp_RestoreEdge(self, int e) -> None: """Restore edge to adjacency lists from which it was previously hidden. Args: e: index of edge in graph to restore """ # Parameter validation is done by the C layer function graphLib.gp_RestoreEdge(self._theGraph, e) def gp_HideVertex(self, int vertex) -> None: """Hides vertex within the graph by hiding its edges and storing additional internal information that enables the vertex to be restored by gp_RestoreVertex() if and only if vertices are restored in the exact opposite order in which they were hidden. Args: vertex: index of vertex in graph to hide Raises: RuntimeError if C graphlib version of this function failed. """ # Parameter validation is done by the C layer function result = graphLib.gp_HideVertex(self._theGraph, vertex) if result != OK: raise RuntimeError( f"gp_HideVertex() failed: unable to hide vertex {vertex}." ) def gp_RestoreVertex(self) -> None: """Restore the last vertex hidden by gp_HideVertex(). If the vertex was hidden as part of an edge contraction or vertex identification, then its adjacency list is extricated from the vertex with which it was merged. Raises: RuntimeError if C graphlib version of this function failed. """ # Parameter validation is done by the C layer function result = graphLib.gp_RestoreVertex(self._theGraph) if result != OK: raise RuntimeError( f"gp_RestoreVertex() failed: unable to restore vertex." ) def gp_ContractEdge(self, int e) -> None: """Contracts the edge e = (u, v) by hiding e and identifying v with u. Args: e: index of edge in graph to contract Raises: RuntimeError if C graphlib version of this function failed. """ # Parameter validation is done by the C layer function result = graphLib.gp_ContractEdge(self._theGraph, e) if result != OK: raise RuntimeError( f"gp_ContractEdge() failed: unable to contract edge e = {e}" ) def gp_IdentifyVertices(self, int u, int v, int eBefore) -> None: """Identify vertex v with u by transferring all adjacencies from v to u. Args: u: index of vertex in graph to which v will be identified v: index of vertex in graph to identify with u eBefore: the index in u's adjacency list before which v's adjacencies should be inserted, or NIL to append the edges to u's list Raises: RuntimeError if C graphlib version of this function failed. """ # Parameter validation is done by the C layer function result = graphLib.gp_IdentifyVertices(self._theGraph, u, v, eBefore) if result != OK: raise RuntimeError( f"gp_IdentifyVertices() failed: unable to identify v = {v} " f"with u = {u}" ) def gp_RestoreVertices(self) -> None: """Restores all vertices hidden during a series of hide vertex, edge contraction or vertex identification operations. Raises: RuntimeError if C graphlib version of this function failed. """ # Parameter validation is done by the C layer function result = graphLib.gp_RestoreVertices(self._theGraph) if result != OK: raise RuntimeError( "gp_RestoreVertices() failed: unable to restores all vertices " "hidden during an edge contraction or vertex identification." ) def gp_GetGraphFlags(self) -> int: """Returns flags set on the Graph's graphP Returns: An integer representing the flags set on the graphP """ return graphLib.gp_GetGraphFlags(self._theGraph) def gp_GetFirstEdge(self, int v) -> int: """Get index of first edge incident to vertex v. Args: v: index of a vertex in the graph Returns: The index of the first edge in v's adjacency list Raises: ValueError if v is not a valid vertex index """ if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): raise ValueError( f"gp_GetFirstEdge() failed: invalid vertex index '{v}'." ) return graphLib.gp_GetFirstEdge(self._theGraph, v) def gp_GetLastEdge(self, int v) -> int: """Get index of last edge incident to vertex v. Args: v: index of a vertex in the graph Returns: The index of the last edge in v's adjacency list Raises: ValueError if v is not a valid vertex index """ if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): raise ValueError( f"gp_GetLastEdge() failed: invalid vertex index v = {v}" ) return graphLib.gp_GetLastEdge(self._theGraph, v) def gp_GetEdgeByLink(self, int v, int theLink) -> int: """Get the first or last edge in the adjacency list of v, indicated by theLink Args: v: index of a vertex in the graph theLink: the direction of adjacency for the edge to return, either first (0) or last (1) Returns: The index of the first or last edge in V's adjacency list Raises: ValueError if v is not a valid vertex index or theLink is an invalid direction indicator (0 or 1) """ if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): raise ValueError( f"gp_GetEdgeByLink() failed: invalid vertex index v = {v}" ) if theLink != 0 and theLink != 1: raise ValueError( "gp_GetEdgeByLink() failed: invalid value for theLink = " f"{theLink}" ) return graphLib.gp_GetEdgeByLink(self._theGraph, v, theLink) def gp_SetFirstEdge(self, int v, int newFirstEdge) -> None: """Sets the first edge in v's adjacency list to newFirstEdge Args: v: index of a vertex in the graph newFirstEdge: the index of an edge to set as the first edge in v's adjacency list Raises: ValueError for invalid vertex v or edge newFirstEdge """ if not self.gp_IsVertex(v) and not self.gp_IsVirtualVertex(v): raise ValueError( f"gp_SetFirstEdge() failed: invalid vertex index v = {v}" ) if self.gp_IsNotEdge(newFirstEdge) or self.gp_EdgeNotInUse(newFirstEdge): raise ValueError( f"gp_SetFirstEdge() failed: newFirstEdge = {newFirstEdge} " "is not a valid edge index." ) graphLib.gp_SetFirstEdge(self._theGraph, v, newFirstEdge) def gp_SetLastEdge(self, int v, int newLastEdge) -> None: """Sets the last edge in v's adjacency list to newLastEdge. Args: v: index of vertex in graph for which you wish to set the last edge in its adjacency list newLastEdge: the index of an edge in the edge array that you wish to set as the last edge in v's adjacency list Raises: ValueError for invalid vertex v or edge newLastEdge """ if not self.gp_IsVertex(v): raise ValueError( f"gp_SetLastEdge() failed: invalid vertex index v = {v}" ) if self.gp_IsNotEdge(newLastEdge) or self.gp_EdgeNotInUse(newLastEdge): raise ValueError( f"gp_SetLastEdge() failed: newLastEdge = {newLastEdge} " "is not a valid edge index." ) graphLib.gp_SetLastEdge(self._theGraph, v, newLastEdge) def gp_SetEdgeByLink(self, int v, int theLink, int newEdge) -> None: """Set the first or last edge in v's adjacency list, indicated by theLink. Args: v: index of a vertex in the graph theLink: the direction of adjacency for which edge to set, either first (0) or last (1) newEdge: the index of an edge to set as the first or last edge in v's adjacency list Raises: ValueError if v is not a valid vertex, if theLink is not 0 nor 1, or invalid newEdge """ if not self.gp_IsVertex(v): raise ValueError( f"gp_SetEdgeByLink() failed: invalid vertex index v = {v}" ) if self.gp_IsNotEdge(newEdge) or self.gp_EdgeNotInUse(newEdge): raise ValueError( f"gp_SetEdgeByLink() failed: newEdge = {newEdge} " "is not a valid edge." ) if theLink != 0 and theLink != 1: raise ValueError( "gp_SetEdgeByLink() failed: invalid value for theLink = " f"{theLink}" ) graphLib.gp_SetEdgeByLink(self._theGraph, v, theLink, newEdge) def gp_LowerBoundVertices(self) -> int: """Get the lower bound of the graph's vertex indices. Returns: The lower bound of the vertex indices """ return graphLib.gp_LowerBoundVertices(self._theGraph) def gp_UpperBoundVertices(self) -> int: """Get the upper bound of the graph's vertex indices. Returns: The upper bound of the vertex indices """ return graphLib.gp_UpperBoundVertices(self._theGraph) def gp_LowerBoundVirtualVertices(self) -> int: """Get the lower bound of the graph's virtual vertex indices. Returns: The lower bound of the virtual vertex indices. """ return graphLib.gp_LowerBoundVirtualVertices(self._theGraph) def gp_UpperBoundVirtualVertices(self) -> int: """Get the upper bound of the graph's virtual vertex indices. Returns: The upper bound of the virtual vertex indices """ return graphLib.gp_UpperBoundVirtualVertices(self._theGraph) def gp_LowerBoundVertexStorage(self) -> int: """Get lower bound of graph's storage for non-virtual and virtual vertices. Use gp_LowerBoundVertices() unless you know why you're using this. Returns: The lower bound for all non-virtual and virtual vertices, to be used for some types of iteration. """ return graphLib.gp_LowerBoundVertexStorage(self._theGraph) def gp_UpperBoundVertexStorage(self) -> int: """Get upper bound of graph's storage for non-virtual and virtual vertices. Use gp_UpperBoundVertices() unless you know why you're using this. Returns: The upper bound for all non-virtual and virtual vertices, to be used for some types of iteration. """ return graphLib.gp_UpperBoundVertexStorage(self._theGraph) def gp_IsVertex(self, int v) -> int: """Determine if index v corresponds to a non-virtual vertex. Args: v: candidate index of a non-virtual vertex in the graph Returns: TRUE if v is within the allowed bounds for vertices and if the value returned by the C-layer call to gp_IsVertex() is truthy, otherwise FALSE. """ if ( (v >= self.gp_LowerBoundVertices()) and (v < self.gp_UpperBoundVertices()) and graphLib.gp_IsVertex(self._theGraph, v) ): return TRUE return FALSE def gp_IsVirtualVertex(self, int v) -> int: """Determine if index v corresponds to a virtual vertex Args: v: candidate index of a virtual vertex in the graph Returns: TRUE if v is within the allowed bounds for virtual vertices and if the value returned by the C-layer call to gp_IsVirtualVertex() is truthy, otherwise FALSE. """ if ( (v >= self.gp_LowerBoundVirtualVertices()) and (v < self.gp_UpperBoundVirtualVertices()) and graphLib.gp_IsVirtualVertex(self._theGraph, v) ): return TRUE return FALSE def gp_IsNotVertex(self, int v) -> int: """Determine if index v does not correspond to a non-virtual vertex Args: v: candidate index of a non-virtual vertex in the graph Returns: TRUE if v is not within the allowed bounds for non-virtual vertices, or if the value returned by the C-layer call to gp_IsNotVertex() is truthy, otherwise FALSE. """ if ( (v < self.gp_LowerBoundVertices()) or (v >= self.gp_UpperBoundlVertices()) or graphLib.gp_IsNotVertex(self._theGraph, v) ): return TRUE return FALSE def gp_IsNotVirtualVertex(self, int v) -> int: """Determine if index v does not correspond to a virtual vertex Args: v: candidate index of a virtual vertex in the graph Returns: TRUE if v is not within the allowed bounds for virtual vertices or if the value returned by the C-layer call to gp_IsNotVirtualVertex() is truthy, otherwise FALSE. """ if ( (v < self.gp_LowerBoundVirtualVertices()) or (v >= self.gp_UpperBoundVirtualVertices()) or graphLib.gp_IsNotVirtualVertex(self._theGraph, v) ): return TRUE return FALSE def gp_VirtualVertexInUse(self, int virtualVertex) -> int: """Determines if virtualVertex corresponds to a virtual vertex in use. A virtual vertex is in use if it has any incident edges. Args: virtualVertex: candidate virtual vertex to test Returns: TRUE if virtualVertex is a valid virtual vertex and is in use, otherwise FALSE. """ if ( self.gp_IsVirtualVertex(virtualVertex) and graphLib.gp_VirtualVertexInUse(self._theGraph, virtualVertex) ): return TRUE return FALSE def gp_VirtualVertexNotInUse(self, int virtualVertex) -> int: """Determines if virtualVertex corresponds to a virtual vertex not in use. Args: virtualVertex: candidate virtual vertex to test Returns: TRUE if virtualVertex is a valid virtual vertex and is not in use, FALSE if virtualVertex is not a valid virtual vertex or if it is a virtual vertex but is in use. """ if ( self.gp_IsVirtualVertex(virtualVertex) and graphLib.gp_VirtualVertexNotInUse(self._theGraph, virtualVertex) ): return TRUE return FALSE def gp_GetIndex(self, int v) -> int: """Get the index data member value of vertex v Args: v: the vertex in the graph whose index field to get Returns: The value of the index field of the vertex record corresponding to v Raises: ValueError if v doesn't correspond to a non-virtual or virtual vertex. """ if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): raise ValueError( f"gp_GetIndex() failed: invalid vertex v = {v}" ) return graphLib.gp_GetIndex(self._theGraph, v) def gp_SetIndex(self, int v, int theIndex) -> None: """Set the index data member of vertex v to theIndex Args: v: the vertex in the graph whose index to set to theIndex theIndex: new value you wish to assign to the vertex's index field Raises: ValueError if v or theIndex don't correspond to a non-virtual or virtual vertex. """ if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): raise ValueError( f"gp_SetIndex() failed: invalid vertex v = {v}" ) if not (self.gp_IsVertex(theIndex) or self.gp_IsVirtualVertex(theIndex)): raise ValueError( f"gp_SetIndex() failed: invalid value theIndex = {theIndex} to " "which you wish to set the index of v = {v}" ) graphLib.gp_SetIndex(self._theGraph, v, theIndex) def gp_InitFlags(self, int v) -> None: """Resets (clears) all flags for a given vertex. Args: v: index of vertex in graph whose flags you wish to clear Raises: ValueError if v is not a non-virtual nor virtual vertex. """ if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): raise ValueError( f"gp_InitFlags() failed: invalid vertex v = {v}" ) graphLib.gp_InitFlags(self._theGraph, v) def gp_GetVisited(self, int v) -> int: """Gets the visited flag of vertex v. Args: v: index of vertex in graph whose visited flag you wish to get Returns: The visited flag for v, i.e., 0 (falsy) or VERTEX_VISITED_MASK (truthy) Raises: ValueError if v is neither a non-virtual nor a virtual vertex """ if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): raise ValueError( f"gp_GetVisited() failed: invalid vertex v = {v}" ) return graphLib.gp_GetVisited(self._theGraph, v) def gp_ClearVisited(self, int v) -> None: """Clears the visited flag of vertex v. Args: v: index of vertex in graph whose visited flag you wish to clear Raises: ValueError if v is neither a non-virtual nor a virtual vertex """ if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): raise ValueError( f"gp_ClearVisited() failed: invalid vertex v = {v}" ) graphLib.gp_ClearVisited(self._theGraph, v) def gp_SetVisited(self, int v) -> None: """Sets the visited flag of vertex v. Args: v: index of vertex in graph whose visited flag you wish to set Raises: ValueError if v is neither a non-virtual nor a virtual vertex """ if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): raise ValueError( f"gp_SetVisited() failed: invalid vertex v = {v}" ) graphLib.gp_SetVisited(self._theGraph, v) def gp_GetMarked(self, int v) -> int: """Gets the marked flag of vertex v. Args: v: vertex whose marked flag you wish to get Returns: The marked flag for v, i.e., 0 (falsy) or VERTEX_MARKED_MASK (truthy) Raises: ValueError if v is neither a non-virtual nor a virtual vertex """ if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): raise ValueError( f"gp_GetMarked() failed: invalid vertex v = {v}" ) return graphLib.gp_GetMarked(self._theGraph, v) def gp_ClearMarked(self, int v) -> None: """Clears the marked flag of vertex v. Args: v: vertex whose marked flag you wish to clear Raises: ValueError if v is neither a non-virtual nor a virtual vertex """ if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): raise ValueError( f"gp_ClearMarked() failed: invalid vertex v = {v}" ) graphLib.gp_ClearMarked(self._theGraph, v) def gp_SetMarked(self, int v) -> None: """Sets the marked flag of vertex v. Args: v: vertex whose marked flag you wish to set Raises: ValueError if v is neither a non-virtual nor a virtual vertex """ if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): raise ValueError( f"gp_SetMarked() failed: invalid vertex v = {v}" ) graphLib.gp_SetMarked(self._theGraph, v) def gp_GetTwin(self, int e) -> int: """Get the twin edge record of the edge record indicated by e, enabling constant-time navigation between the two halves of the data structure representing an edge. Args: e: edge whose twin edge record you wish to get Returns: The index of the twin edge record of e Raises: ValueError if e is not a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_GetTwin() failed: invalid edge e = {e}" ) return graphLib.gp_GetTwin(self._theGraph, e) def gp_GetNextEdge(self, int e) -> int: """Get the next edge after e in the adjacency list containing e. Args: e: edge for which you wish to get next edge Returns: The next edge after e, or NIL if e is the last in the list Raises: ValueError if e is not a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_GetNextEdge() failed: invalid edge index e = {e}" ) return graphLib.gp_GetNextEdge(self._theGraph, e) def gp_GetPrevEdge(self, int e) -> int: """Get the previous edge before e in the adjacency list containing e. Args: e: edge for which you wish to get previous edge Returns: The previous edge before e, or NIL if e is the first Raises: ValueError if e is not a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_GetPrevEdge() failed: invalid edge index e = {e}" ) return graphLib.gp_GetPrevEdge(self._theGraph, e) def gp_GetAdjacentEdge(self, int e, int theLink) -> int: """Get the edge adjacent to e in direction indicated by theLink. Args: e: edge for which you wish to get edge adjacent in direction theLink theLink: either 0 for next edge or 1 for previous edge Returns: The edge adjacent to e in direction theLink, or NIL if e is the last in the direction given by theLink Raises: ValueError if e is not a valid in-use edge or if theLink is neither 0 nor 1 """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_GetAdjacentEdge() failed: invalid edge e = {e}" ) if theLink != 0 and theLink != 1: raise ValueError( "gp_GetAdjacentEdge() failed: invalid value for theLink = " f"{theLink}" ) return graphLib.gp_GetAdjacentEdge(self._theGraph, e, theLink) def gp_SetNextEdge(self, int e, int newNextEdge) -> None: """Set the next edge after e to newNextEdge. Args: e: edge for which you wish to set the next edge newNextEdge: the next edge for e, or NIL Raises: ValueError if e is not a valid in-use edge, or if newNextEdge is neither NIL nor a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_SetNextEdge() failed: invalid edge e = {e}" ) if newNextEdge != NIL and not self.gp_EdgeInUse(newNextEdge): raise ValueError( "gp_SetNextEdge() failed: invalid edge newNextEdge = " f"{newNextEdge}" ) graphLib.gp_SetNextEdge(self._theGraph, e, newNextEdge) def gp_SetPrevEdge(self, int e, int newPrevEdge) -> None: """Set the previous edge before e to newPrevEdge. Args: e: edge for which you wish to set previous edge newPrevEdge: the previous edge for e, or NIL Raises: ValueError if e is not a valid in-use edge, or if newPrevEdge is neither NIL nor a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_SetPrevEdge() failed: invalid edge e = {e}" ) if newPrevEdge != NIL and not self.gp_EdgeInUse(newPrevEdge): raise ValueError( "gp_SetPrevEdge() failed: invalid edge newPrevEdge = " f"{newPrevEdge}" ) graphLib.gp_SetPrevEdge(self._theGraph, e, newPrevEdge) def gp_SetAdjacentEdge(self, int e, int theLink, int newEdge) -> None: """Set the edge adjacent to e in direction indicated by theLink. Args: e: edge for which you wish to set edge adjacent in direction theLink theLink: either 0 for the next edge or 1 for the previous edge newEdge: the next or previous edge for e, or NIL Raises: ValueError if e is not a valid in-use edge, or if newEdge is neither NIL nor a valid in-use edge, or if theLink is neither 0 nor 1 """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_SetAdjacentEdge() failed: invalid edge e = {e}" ) if theLink != 0 and theLink != 1: raise ValueError( "gp_SetAdjacentEdge() failed: invalid value for theLink = " f"{theLink}" ) if newEdge != NIL and not self.gp_EdgeInUse(newEdge): raise ValueError( "gp_SetAdjacentEdge() failed: invalid edge newEdge = " f"{newEdge}" ) graphLib.gp_SetAdjacentEdge(self._theGraph, e, theLink, newEdge) def gp_IsEdge(self, int e) -> int: """Check if e corresponds to an edge location in the edge storage of the graph. Args: e: candidate edge to verify is an edge location in the graph Returns: TRUE if e is a valid edge and the value returned by C-layer gp_IsEdge() is truthy, FALSE otherwise. """ if ( (e >= self.gp_LowerBoundEdgeStorage()) and (e < self.gp_UpperBoundEdgeStorage()) and graphLib.gp_IsEdge(self._theGraph, e) ): return TRUE return FALSE def gp_IsNotEdge(self, int e) -> int: """Check if e does not correspond to an edge location in the edge storage of the graph. Args: e: candidate edge to verify is not an edge location in the graph Returns: TRUE if e is not a valid edge or the value returned by C-layer gp_IsNotEdge() is truthy, FALSE otherwise. """ if ( (e < self.gp_LowerBoundEdgeStorage()) or (e >= self.gp_UpperBoundEdgeStorage()) or graphLib.gp_IsNotEdge(self._theGraph, e) ): return TRUE return FALSE def gp_GetNeighbor(self, int e) -> int: """Get the neighbor vertex indicated by an in-use edge e. Args: e: an in-use edge in the adjacency list of a vertex v Returns: The vertex that e indicates is a neighbor of vertex v Raises: ValueError if e is not a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_GetNeighbor() failed: invalid edge e = {e}" ) return graphLib.gp_GetNeighbor(self._theGraph, e) def gp_SetNeighbor(self, int e, int v) -> None: """Set the neighbor vertex of an in-use edge e to v. Args: e: an in-use edge whose neighbor vertex you wish to set v: the vertex you wish to set as the neighbor of edge e Raises: ValueError if e is not a valid in-use edge, or if v is not a non-virtual nor a virtual vertex. """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_SetNeighbor() failed: invalid edge e = {e}" ) if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): raise ValueError( f"gp_SetNeighbor() failed: invalid vertex v = {v}" ) graphLib.gp_SetNeighbor(self._theGraph, e, v) def gp_InitEdgeFlags(self, int e) -> None: """Initialize the edge flags of an in-use edge e. Args: e: an in-use edge whose edge flags you wish to initialize Raises: ValueError if e is not a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_InitEdgeFlags() failed: invalid edge e = {e}" ) graphLib.gp_InitEdgeFlags(self._theGraph, e) def gp_GetEdgeVisited(self, int e) -> int: """Get the edge visited flag of an in-use edge e. Args: e: an in-use edge whose edge visited flag you wish to get Returns: The edge visited flag for e, i.e., 0 (falsy) or EDGE_VISITED_MASK (truthy) Raises: ValueError if e is not a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_GetEdgeVisited() failed: invalid edge e = {e}" ) return graphLib.gp_GetEdgeVisited(self._theGraph, e) def gp_ClearEdgeVisited(self, int e) -> None: """Clears the edge visited flag of an in-use edge e. Args: e: an in-use edge whose edge visited flag you wish to clear Raises: ValueError if e is not a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_ClearEdgeVisited() failed: invalid edge e = {e}" ) graphLib.gp_ClearEdgeVisited(self._theGraph, e) def gp_SetEdgeVisited(self, int e) -> None: """Set the edge visited flag of an in-use edge e. Args: e: an in-use edge whose edge visited flag you wish to set Raises: ValueError if e is not a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_SetEdgeVisited() failed: invalid edge e = {e}" ) graphLib.gp_SetEdgeVisited(self._theGraph, e) def gp_GetEdgeMarked(self, int e) -> int: """Get the edge marked flag of an in-use edge e. Args: e: an in-use edge whose edge marked flag you wish to get Returns: The edge visited flag for e, i.e., 0 (falsy) or EDGE_MARKED_MASK (truthy) Raises: ValueError if e is not a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_GetEdgeMarked() failed: invalid edge e = {e}" ) return graphLib.gp_GetEdgeMarked(self._theGraph, e) def gp_ClearEdgeMarked(self, int e) -> None: """Clears the edge marked flag of an in-use edge e. Args: e: an in-use edge whose edge marked flag you wish to clear Raises: ValueError if e is not a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_ClearEdgeMarked() failed: invalid edge e = {e}" ) graphLib.gp_ClearEdgeMarked(self._theGraph, e) def gp_SetEdgeMarked(self, int e) -> None: """Set the edge marked flag of an in-use edge e. Args: e: an in-use edge whose edge marked flag you wish to set Raises: ValueError if e is not a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_SetEdgeMarked() failed: invalid edge e = {e}" ) graphLib.gp_SetEdgeMarked(self._theGraph, e) def gp_GetEdgeType(self, int e) -> int: """Get the edge type of an in-use edge e. Args: e: an in-use edge whose edge type you wish to get Returns: The edge type of e if set, i.e., EDGE_TYPE_NOTDEFINED, EDGE_TYPE_CHILD, EDGE_TYPE_FORWARD, EDGE_TYPE_PARENT, EDGE_TYPE_BACK, or EDGE_TYPE_TREE Raises: ValueError if e is not a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_GetEdgeType() failed: invalid edge e = {e}" ) return graphLib.gp_GetEdgeType(self._theGraph, e) def gp_ClearEdgeType(self, int e) -> None: """Clears the edge type of an in-use edge e. Args: e: an in-use edge whose edge type you wish to clear Raises: ValueError if e is not a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_ClearEdgeType() failed: invalid edge e = {e}" ) graphLib.gp_ClearEdgeType(self._theGraph, e) def gp_SetEdgeType(self, int e, int type) -> None: """Sets the edge type of an in-use edge e to type for the first time. To change the type after setting the first time, use gp_ClearEdgeType() first, or use gp_ResetEdgeType(). Args: e: an in-use edge whose edge type you wish to set for the first time to the given type type: one of EDGE_TYPE_CHILD, EDGE_TYPE_FORWARD, EDGE_TYPE_PARENT, EDGE_TYPE_BACK, or EDGE_TYPE_TREE Raises: ValueError if e is not a valid in-use edge or if type is not a valid edge type """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_SetEdgeType() failed: invalid edge e = {e}" ) if type not in (EDGE_TYPE_CHILD, EDGE_TYPE_FORWARD, EDGE_TYPE_PARENT, EDGE_TYPE_BACK, EDGE_TYPE_TREE): raise ValueError( f"gp_SetEdgeType() failed: invalid edge type = {type}" ) graphLib.gp_SetEdgeType(self._theGraph, e, type) def gp_ResetEdgeType(self, int e, int type) -> None: """Reset the edge type of in-use edge e to type, clearing the previous type. Args: e: an in-use edge whose edge type you wish to reset to type type: one of EDGE_TYPE_CHILD, EDGE_TYPE_FORWARD, EDGE_TYPE_PARENT, EDGE_TYPE_BACK, or EDGE_TYPE_TREE Raises: ValueError if e is not a valid in-use edge or if type is not a valid edge type """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_ResetEdgeType() failed: invalid edge e = {e}" ) if type not in (EDGE_TYPE_CHILD, EDGE_TYPE_FORWARD, EDGE_TYPE_PARENT, EDGE_TYPE_BACK, EDGE_TYPE_TREE): raise ValueError( f"gp_ResetEdgeType() failed: invalid edge type = {type}" ) graphLib.gp_ResetEdgeType(self._theGraph, e, type) def gp_GetEdgeFlagInverted(self, int e) -> int: """Get the edge inverted flag of an in-use edge e. Args: e: an in-use edge for which you wish to get the edge inverted flag Returns: The edge inverted flag of e Raises: ValueError if e is not a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_GetEdgeFlagInverted() failed: invalid edge e = {e}" ) return graphLib.gp_GetEdgeFlagInverted(self._theGraph, e) def gp_SetEdgeFlagInverted(self, int e) -> None: """Set the edge inverted flag of an in-use edge e. Args: e: an in-use edge for which you wish to set the edge inverted flag Raises: ValueError if e is not a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_SetEdgeFlagInverted() failed: invalid edge e = {e}" ) graphLib.gp_SetEdgeFlagInverted(self._theGraph, e) def gp_ClearEdgeFlagInverted(self, int e) -> None: """Clear the edge inverted flag of an in-use edge e. Args: e: an in-use edge for which you wish to clear the edge inverted flag Raises: ValueError if e is not a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_ClearEdgeFlagInverted() failed: invalid edge e = {e}" ) graphLib.gp_ClearEdgeFlagInverted(self._theGraph, e) def gp_XorEdgeFlagInverted(self, int e) -> None: """Toggle the edge inverted flag of an in-use edge e. Args: e: an in-use edge for which you wish to toggle the edge inverted flag Raises: ValueError if e is not a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_XorEdgeFlagInverted() failed: invalid edge e = {e}" ) graphLib.gp_XorEdgeFlagInverted(self._theGraph, e) def gp_GetDirection(self, int e) -> int: """Get the direction flag of an in-use edge e. Args: e: an in-use edge for which you wish to determine the direction Returns: The direction of the edge e Raises: ValueError if e is not a valid in-use edge """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_GetDirection() failed: invalid edge e = {e}" ) return graphLib.gp_GetDirection(self._theGraph, e) def gp_SetDirection(self, int e, int direction) -> None: """Set the direction flag of an in-use edge e. Args: e: an in-use edge for which you wish to set the direction direction: either 0 (undirected), EDGEFLAG_DIRECTION_INONLY, or EDGEFLAG_DIRECTION_OUTONLY Raises: ValueError if e is not a valid in-use edge, or direction is invalid """ # The Cython-level gp_EdgeInUse() checks gp_IsEdge() if not self.gp_EdgeInUse(e): raise ValueError( f"gp_SetDirection() failed: invalid edge e = {e}" ) if direction not in (0, EDGEFLAG_DIRECTION_INONLY, EDGEFLAG_DIRECTION_OUTONLY): raise ValueError( f"gp_SetDirection() failed: invalid direction = {direction}" ) graphLib.gp_SetDirection(self._theGraph, e, direction) def gp_LowerBoundEdges(self) -> int: """Get the lower bound for edges. Returns: The lower bound for edges """ return graphLib.gp_LowerBoundEdges(self._theGraph) def gp_UpperBoundEdges(self) -> int: """Get the upper bound for edges (the lower bound + M + numEdgeHoles). Returns: The upper bound for edges """ return graphLib.gp_UpperBoundEdges(self._theGraph) def gp_EdgeInUse(self, int e) -> int: """Determines if an edge is in-use, i.e., if the neighbor vertex is set. Args: e: candidate edge to test Returns: TRUE if the edge is valid and in-use, FALSE otherwise """ if self.gp_IsEdge(e) and graphLib.gp_EdgeInUse(self._theGraph, e): return TRUE return FALSE def gp_EdgeNotInUse(self, int e) -> int: """Determines if an edge is not in-use. Args: e: candidate edge to test Returns: TRUE if edge is either invalid or valid but not in-use, FALSE otherwise """ if self.gp_EdgeInUse(e): return FALSE return TRUE #if not self.gp_IsEdge(e): # return TRUE; #if graphLib.gp_EdgeNotInUse(self._theGraph, e): # return TRUE #return FALSE def gp_LowerBoundEdgeStorage(self) -> int: """Get the lower bound for edge storage; for iterating over all edge storage. Returns: The lower bound for edge storage """ return graphLib.gp_LowerBoundEdgeStorage(self._theGraph) def gp_UpperBoundEdgeStorage(self) -> int: """Get the upper bound for edge storage; for iterating over all edge storage. Note that this value depends on the edge capacity, and possibly extends past the current number of in-use edges. Returns: The upper bound for edge storage """ return graphLib.gp_UpperBoundEdgeStorage(self._theGraph) def gp_Read(self, str fileName) -> None: """Reads the graph from the file named fileName. Args: fileName: a string containing the name of the file to read from Raises: RuntimeError if C graphlib version of this function failed. """ # Convert Python str to UTF-8 encoded bytes, and then to const char * cdef bytes encoded = fileName.encode('utf-8') cdef const char *encodedFileName = encoded result = graphLib.gp_Read(self._theGraph, encodedFileName) if result != OK: raise RuntimeError( f"gp_Read() failed for infile '{fileName}'." ) def gp_ReadFromString(self, str inputStr) -> None: """Reads the graph from the given input string. Args: inputStr: a string containing the graph to read. Raises: RuntimeError if C graphlib version of this function failed. """ cdef bytes encoded = inputStr.encode('utf-8') cdef const char *encodedInputString = encoded if graphLib.gp_ReadFromString(self._theGraph, encodedInputString) != OK: raise RuntimeError( "gp_ReadFromString() failed: unable to read from input string." ) def gp_Write(self, str fileName, int writeMode) -> None: """Writes the graph to the file named fileName in the writeMode format. Args: fileName: a string containing the name of the file to which to write writeMode: the desired output format, i.e., WRITE_ADJLIST, WRITE_ADJMATRIX, or WRITE_G6 Raises: ValueError if writeMode is not WRITE_ADJLIST, WRITE_ADJMATRIX, or WRITE_G6 RuntimeError if C graphlib version of this function failed. """ if writeMode not in (WRITE_ADJLIST, WRITE_ADJMATRIX, WRITE_G6): raise ValueError( f"gp_Write() failed: invalid writeMode = {writeMode}" ) # Convert Python str to UTF-8 encoded bytes, and then to const char * cdef bytes encoded = fileName.encode('utf-8') cdef const char *encodedFileName = encoded result = graphLib.gp_Write(self._theGraph, encodedFileName, writeMode) if result != OK: raise RuntimeError( f"gp_Write() of graph to '{fileName}' failed." ) def gp_WriteToString(self, int writeMode) -> str: """Writes the graph to a string in the writeMode format. Args: writeMode: the desired output format, i.e., WRITE_ADJLIST, WRITE_ADJMATRIX, or WRITE_G6 Returns: A Python string containing the graph serialized into the chosen format. Raises: ValueError if writeMode is not WRITE_ADJLIST, WRITE_ADJMATRIX, or WRITE_G6 RuntimeError if C graphlib version of this function failed, if the outputString is NULL, or if decoding the bytes to produce the Python string failed. """ if writeMode not in (WRITE_ADJLIST, WRITE_ADJMATRIX, WRITE_G6): raise ValueError( f"gp_WriteToString() failed: invalid writeMode = {writeMode}" ) cdef char *outputString = NULL if graphLib.gp_WriteToString(self._theGraph, &outputString, writeMode) != OK: if outputString != NULL: free(outputString) outputString = NULL raise RuntimeError( "gp_WriteToString() failed: unable to write graph to string." ) if outputString == NULL: raise RuntimeError( "gp_WriteToString() failed: outputString is NULL" ) output_bytes = outputString[:] free(outputString) outputString = NULL try: return output_bytes.decode('UTF-8') except Exception as string_conversion_error: raise RuntimeError( "gp_WriteToString() failed: failed to convert C string to " "Python string." ) from string_conversion_error def gp_ExtendWith_DFSUtils(self) -> None: """Dynamically subclasses the graph with the DFSUtils extension, which adds the data structures and methods necessary for performing DFS-related operations. Raises: RuntimeError if C graphlib version of this function failed. """ if graphLib.gp_ExtendWith_DFSUtils(self._theGraph) != OK: raise RuntimeError( "gp_ExtendWith_DFSUtils() failed: unable to extend graph with " "DFSUtils structures" ) def gp_DepthFirstSearch(self) -> None: """Performs a depth-first search (DFS) to give vertices values for their depth first indices (DFIs) and DFS parents and give edges value for their types. See gp_GetParent(), gp_GetIndex(), and gp_GetEdgeType(). This method also sets GRAPHFLAGS_DFSNUMBERED. This method performs gp_ExtendWith_DFSUtils() if not already done. Raises: RuntimeError if C graphlib version of this function failed. """ if graphLib.gp_DepthFirstSearch(self._theGraph) != OK: raise RuntimeError( "gp_DepthFirstSearch() failed: unable to perform DFS on graph." ) def gp_SortVertices(self) -> None: """Sort vertices in ascending order according to their DFIs. This method invokes gp_DepthFirstSearch(), if it has not already been done. This method sets GRAPHFLAGS_SORTEDBYDFI. A second invocation of this method restores vertices to their original order and clears GRAPHFLAGS_SORTEDBYDFI. When GRAPHFLAGS_SORTEDBYDFI is set, the index values of all vertices are changed from their DFIs to their original index positions in vertex storage. Raises: RuntimeError if C graphlib version of this function failed. """ if graphLib.gp_SortVertices(self._theGraph) != OK: raise RuntimeError( "gp_SortVertices() failed." ) def gp_ComputeLowpoints(self) -> None: """Computes lowpoints and least ancestors for all vertices. This method first performs gp_DepthFirstSearch() and gp_SortVertices() if they have not already been done. Raises: RuntimeError if C graphlib version of this function failed. """ if graphLib.gp_ComputeLowpoints(self._theGraph) != OK: raise RuntimeError( "gp_ComputeLowpoints() failed." ) def gp_ComputeLeastAncestors(self) -> None: """Computes least ancestor values for all vertices. This method first performs gp_DepthFirstSearch() and gp_SortVertices() if they have not already been done. Raises: RuntimeError if C graphlib version of this function failed. """ if graphLib.gp_ComputeLeastAncestors(self._theGraph) != OK: raise RuntimeError( "gp_ComputeLeastAncestors() failed." ) def gp_GetParent(self, int v) -> int: """Get DFS parent of vertex v, once gp_DepthFirstSearch() has been called. Args: v: a vertex in the graph whose DFS parent you wish to obtain Returns: The DFS parent of v in the graph, or NIL if v is the root of the DFS tree (or if gp_DepthFirstSearch() has not been called). Raises: ValueError if v is not a valid vertex """ if not self.gp_IsVertex(v): raise ValueError( f"gp_GetParent() failed: invalid vertex v = {v}" ) return graphLib.gp_GetParent(self._theGraph, v) def gp_GetLeastAncestor(self, int v) -> int: """Get least ancestor of vertex v, after least ancestors are computed. Args: v: a vertex in the graph whose least ancestor you wish to obtain Returns: The least ancestor of v, or NIL if least ancestor values have not yet been computed. Raises: ValueError if v is not a valid vertex. """ if not self.gp_IsVertex(v): raise ValueError( f"gp_GetLeastAncestor() failed: invalid vertex v = {v}" ) return graphLib.gp_GetLeastAncestor(self._theGraph, v) def gp_GetLowpoint(self, int v) -> int: """Get lowpoint value of vertex v, after lowpoint values are computed. Args: v: a vertex in the graph whose lowpoint value you wish to obtain Returns: The lowpoint of v, or NIL if lowpoints have not yet been computed. Raises: ValueError if v is not a valid vertex. """ if not self.gp_IsVertex(v): raise ValueError( f"gp_GetLowpoint() failed: invalid vertex v = {v}" ) return graphLib.gp_GetLowpoint(self._theGraph, v) def gp_IsDFSTreeRoot(self, int v) -> int: """Determine if vertex v corresponds to DFS tree root (if DFS parent is NIL). This method assumes that gp_DepthFirstSearch() has been called. Args: v: a vertex in the graph you wish to determine is the DFS tree root Returns: TRUE if v is the DFS tree root, FALSE otherwise Raises: ValueError if v is not a valid vertex """ if not self.gp_IsVertex(v): raise ValueError( f"gp_IsDFSTreeRoot() failed: invalid vertex v = {v}" ) # FIXME: This EAPS macro call private gp_GetVertexParent() rather than # public gp_GetParent(), so we implement it at this level for now and # should switch to the commented-out call-through once it is fixed. # # if graphLib.gp_IsDFSTreeRoot(self._theGraph, v): # return TRUE # # return FALSE if self.gp_IsNotVertex(self.gp_GetParent(v)): return TRUE return FALSE def gp_IsNotDFSTreeRoot(self, int v) -> int: """Determine if vertex v is not the DFS roo (if DFS parent is not NIL). This method assumes that gp_DepthFirstSearch() has been called. Args: v: a vertex in the graph you wish to determine is not the DFS tree root Returns: TRUE if v is not the DFS tree root, FALSE otherwise Raises: ValueError if v is not a valid vertex """ if not self.gp_IsVertex(v): raise ValueError( f"gp_IsNotDFSTreeRoot() failed: invalid vertex v = {v}" ) # FIXME: This EAPS macro call private gp_GetVertexParent() rather than # public gp_GetParent(), so we implement it at this level for now and # should switch to the commented-out call-through once it is fixed. # # if graphLib.gp_IsNotDFSTreeRoot(self._theGraph, v): # return TRUE # # return FALSE if not self.gp_IsDFSTreeRoot(v): return TRUE return FALSE def gp_GetBicompRootFromDFSChild(self, int c) -> int: """Given a DFS child c of a vertex v, this method returns the biconneced component (bicomp) root of v associated with c. The bicomp root is a virtual vertex. Args: c: DFS child for which you wish to determine the root of the bicomp containing c Returns: The root of the bicomp containing c Raises: ValueError if c is not a valid vertex """ if not self.gp_IsVertex(c): raise ValueError( f"gp_GetBicompRootFromDFSChild() failed: invalid vertex c = {c}" ) return graphLib.gp_GetBicompRootFromDFSChild(self._theGraph, c) def gp_GetDFSChildFromBicompRoot(self, int R) -> int: """Given a biconnected component root R (a virtual vertex), this method returns the DFS child c of a vertex v that R represents. Args: R: root of a bicomp for which you wish to determine the DFS child Returns: The DFS child of v that is within the bicomp rooted by R Raises: ValueError if R is not a virtual vertex """ if not self.gp_IsVirtualVertex(R): raise ValueError( "gp_GetDFSChildFromBicompRoot() failed: invalid virtual vertex " f"R = {R} for bicomp root." ) return graphLib.gp_GetDFSChildFromBicompRoot(self._theGraph, R) def gp_GetVertexFromBicompRoot(self, int R) -> int: """Given a biconnected component root R (a virtual vertex), this method returns the vertex v that R represents. Args: R: virtual vertex representing the root of a child bicomp of v Returns: The vertex v corresponding to the root R of a child bicomp Raises: ValueError if R is not a valid virtual vertex """ if not self.gp_IsVirtualVertex(R): raise ValueError( "gp_GetVertexFromBicompRoot() failed: invalid virtual vertex " f"R = {R} for bicomp root." ) # FIXME: This EAPS macro call private gp_GetVertexParent() rather than # public gp_GetParent(), so we implement it at this level for now and # should switch to the commented-out call-through once it is fixed. # return graphLib.gp_GetVertexFromBicompRoot(self._theGraph, R) c = self.gp_GetDFSChildFromBicompRoot(R) if not self.gp_IsVertex(c): raise RuntimeError( "gp_GetVertexFromBicompRoot() failed: invalid DFS child c = " f"{c} for bicomp root R = {R}" ) bicomp_root = self.gp_GetParent(c) if bicomp_root == NIL: raise RuntimeError( f"gp_GetVertexFromBicompRoot() failed: c = {c} should not be " "the root of the DFS tree." ) return bicomp_root def gp_IsBicompRoot(self, int v) -> int: """Determines whether a given non-virtual or virtual vertex is a biconnected component root. This method essentially just returns whether v is a virtual vertex; it may not be in use in a separate biconnected component. To test if a bicomp root is in use, please see gp_VirtualVertexInUse(). Args: v: a vertex in the graph which you wish to determine is the root of a bicomp Returns: TRUE if v is a bicomp root, FALSE otherwise Raises: ValueError if v is not a valid non-virtual nor virtual vertex """ if not (self.gp_IsVertex(v) or self.gp_IsVirtualVertex(v)): raise ValueError( "gp_IsBicompRoot() failed: invalid candidate bicomp root v = " f"{v}" ) if graphLib.gp_IsBicompRoot(self._theGraph, v): return TRUE return FALSE def gp_IsSeparatedDFSChild(self, int theChild) -> int: """Determines whether a given vertex (theChild) is in a separate biconnected component from its DFS parent, v. Args: theChild: a vertex in the graph Returns: TRUE if theChild is in a separate bicomp from its DFS parent, v; FALSE otherwise Raises: ValueError if theChild is not a valid vertex """ if not self.gp_IsVertex(theChild): raise ValueError( "gp_IsSeparatedDFSChild() failed: invalid vertex theChild = " f"{theChild}" ) if graphLib.gp_IsSeparatedDFSChild(self._theGraph, theChild): return TRUE return FALSE def gp_IsNotSeparatedDFSChild(self, int theChild) -> int: """Determines whether a given vertex (theChild) is not in a separate biconnected component from its DFS parent, v. Args: theChild: a vertex in the graph. Returns: FALSE if theChild is in a separate bicomp from its DFS parent, v; TRUE otherwise Raises: ValueError if theChild is not a valid vertex """ if not self.gp_IsVertex(theChild): raise ValueError( "gp_IsNotSeparatedDFSChild() failed: invalid vertex theChild = " f"{theChild}" ) if graphLib.gp_IsNotSeparatedDFSChild(self._theGraph, theChild): return TRUE return FALSE def gp_ExtendWith_Planarity(self) -> None: """Dynamically subclasses the graph with the Planarity extension, which adds the data structures and methods necessary for planar graph embedding minimal planarity-obstructing subgraph isolation. Returns: OK if graph successfully extended with the Planarity extension Raises: RuntimeError if C graphlib version of this function failed. """ result = graphLib.gp_ExtendWith_Planarity(self._theGraph) if result != OK: raise RuntimeError( "Failed to extend graph with Planarity structures." ) def gp_Embed(self, int embedFlags) -> int: """Modifies the graph to be either an embedding of the original graph or a minimal subgraph obstructing embedding. The type of embedding or obstruction depends on the setting of embedFlags. With graphlib.EMBEDFLAGS_PLANAR, the graph is modified to either contain a planar embedding (an adjacency list rotation scheme) of the graph or a subgraph homeomorphic to K_{3,3} or K_5. Args: embedFlags: graphlib.EMBEDFLAGS_* value indicating the embedding algorithm to run. Returns: OK if an embedding was created (if a desired homeomorphic subgraph was not found). NONEMBEDDABE if a minimal obstructing subgraph (or the desired homeomorphic subgraph) was found. Raises: RuntimeError if C graphlib version of this function failed. """ embed_result = graphLib.gp_Embed(self._theGraph, embedFlags) if embed_result != OK and embed_result != NONEMBEDDABLE: raise RuntimeError("Failed to perform embed operation.") return embed_result def gp_TestEmbedResultIntegrity(self, Graph origGraph, int embedResult) -> int: """Tests whether the graph has valid content based on the embedding algorithm performed by gp_Embed(), a copy of the original graph input to it, and the result it returned. Args: origGraph: a copy of the graph before gp_Embed() embedResult: the result returned by gp_Embed() Returns: OK or NONEMBEDDABLE on success (matching embedResult) Raises: RuntimeError if C graphlib version of this function failed. """ check_result = graphLib.gp_TestEmbedResultIntegrity( self._theGraph, origGraph._theGraph, embedResult ) if check_result != OK and check_result != NONEMBEDDABLE: raise RuntimeError("Failed embed result integrity check.") return check_result def gp_ExtendWith_Outerplanarity(self) -> None: """Dynamically subclasses the graph with the Outerplanarity extension, which adds the data structures and methods necessary for outerplanar graph embedding minimal outerplanarity-obstructing subgraph isolation. Returns: OK if graph successfully extended with Outerplanarity extension Raises: RuntimeError if C graphlib version of this function failed. """ result = graphLib.gp_ExtendWith_Outerplanarity(self._theGraph) if result != OK: raise RuntimeError( "Failed to extend graph with Outerplanarity structures." ) def gp_ExtendWith_DrawPlanar(self) -> int: """Dynamically subclasses the graph with the DrawPlanar extension, which adds the data structures and methods necessary for embedding and then drawing an ASCII rendition of a planar graph and for generating a visibility representation of the planar graph embedding.. Returns: OK if graph successfully extended with DrawPlanar extension Raises: RuntimeError if C graphlib version of this function failed. """ result = graphLib.gp_ExtendWith_DrawPlanar(self._theGraph) if result != OK: raise RuntimeError( "Failed to extend graph with DrawPlanar structures." ) return result def gp_DrawPlanar_RenderToFile(self, str theFileName) -> None: """Draws into a file an ASCII rendition of a planar graph embedding created by gp_Embed(). Args: theFileName: the name of the file in which to place the ASCII rendition of the planar graph embedding Raises: RuntimeError if C graphlib version of this function failed. """ # Convert Python str to UTF-8 encoded bytes, and then to const char * cdef bytes encoded = theFileName.encode('utf-8') cdef const char *encodedFileName = encoded result = graphLib.gp_DrawPlanar_RenderToFile(self._theGraph, encodedFileName) if result != OK: raise RuntimeError( f"Failed to render embedding to file '{theFileName}'." ) def gp_DrawPlanar_RenderToString(self) -> str: """Draws into a string an ASCII rendition of a planar graph embedding created by gp_Embed(). Returns: The string containing the ASCII rendition Raises: RuntimeError if C graphlib version of this function failed. """ cdef char* renditionString = NULL result = graphLib.gp_DrawPlanar_RenderToString(self._theGraph, &renditionString) if result != OK: raise RuntimeError(f"Failed to render embedding to C string.") rendition_bytes = renditionString[:] free(renditionString) try: return rendition_bytes.decode('ascii') except Exception as string_conversion_error: raise RuntimeError( "Failed to convert C string to Python string." ) from string_conversion_error def gp_DrawPlanar_GetVertexPosition(self, int v) -> int: """Get the vertical position of a vertex v. Args: v: a vertex for which you wish to get the vertical position Returns: The vertical position value for v Raises: RuntimeError if C graphlib version of this function failed. """ # Parameter validation is done by the C layer function result = graphLib.gp_DrawPlanar_GetVertexPosition(self._theGraph, v) if result < 0: raise RuntimeError( "Underlying gp_DrawPlanar_GetVertexPosition() reported failure." ) return result def gp_DrawPlanar_GetVertexStart(self, int v) -> int: """Get the horizontal start position of a vertex v. Args: v: a vertex for which you wish to get the horizontal start position Returns: The horizontal start position value for v Raises: RuntimeError if C graphlib version of this function failed. """ # Parameter validation is done by the C layer function result = graphLib.gp_DrawPlanar_GetVertexStart(self._theGraph, v) if result < 0: raise RuntimeError( "Underlying gp_DrawPlanar_GetVertexStart() reported failure." ) return result def gp_DrawPlanar_GetVertexEnd(self, int v) -> int: """Get the horizontal end position of a vertex v. Args: v: a vertex for which you wish to get the horizontal end position Returns: The horizontal end position value for v Raises: RuntimeError if C graphlib version of this function failed. """ # Parameter validation is done by the C layer function result = graphLib.gp_DrawPlanar_GetVertexEnd(self._theGraph, v) if result < 0: raise RuntimeError( "Underlying gp_DrawPlanar_GetVertexEnd() reported failure." ) return result def gp_DrawPlanar_GetEdgePosition(self, int e) -> int: """Get the horizontal position of an edge e. Args: e: an edge for which you wish to get the horizontal position Returns: The horizontal position value for e Raises: RuntimeError if C graphlib version of this function failed. """ # Parameter validation is done by the C layer function result = graphLib.gp_DrawPlanar_GetEdgePosition(self._theGraph, e) if result < 0: raise RuntimeError( "Underlying gp_DrawPlanar_GetEdgePosition() reported failure." ) return result def gp_DrawPlanar_GetEdgeStart(self, int e) -> int: """Get the vertical start position of an edge e. Args: e: an edge for which you wish to get the vertical start position Returns: The vertical start position value for e Raises: RuntimeError if C graphlib version of this function failed. """ # Parameter validation is done by the C layer function result = graphLib.gp_DrawPlanar_GetEdgeStart(self._theGraph, e) if result < 0: raise RuntimeError( "Underlying gp_DrawPlanar_GetEdgeStart() reported failure." ) return result def gp_DrawPlanar_GetEdgeEnd(self, int e) -> int: """Get the vertical end position of an edge e. Args: e: an edge for which you wish to get the vertical end position Returns: The vertical end position value for e Raises: RuntimeError if C graphlib version of this function failed. """ # Parameter validation is done by the C layer function result = graphLib.gp_DrawPlanar_GetEdgeEnd(self._theGraph, e) if result < 0: raise RuntimeError( "Underlying gp_DrawPlanar_GetEdgeEnd() reported failure." ) return result def gp_ExtendWith_K23Search(self) -> None: """Dynamically subclasses the graph with the K23Search extension, which adds the data structures and methods necessary to search for a subgraph homeomorphic to K_{2, 3}. Raises: RuntimeError if C graphlib version of this function failed. """ result = graphLib.gp_ExtendWith_K23Search(self._theGraph) if result != OK: raise RuntimeError( "Failed to extend graph with K23Search structures." ) def gp_ExtendWith_K33Search(self) -> None: """Dynamically subclasses the graph with the K33Search extension, which adds the data structures and methods necessary to search for a subgraph homeomorphic to K_{3, 3}. Raises: RuntimeError if C graphlib version of this function failed. """ result = graphLib.gp_ExtendWith_K33Search(self._theGraph) if result != OK: raise RuntimeError( "Failed to extend graph with K33Search structures." ) def gp_ExtendWith_K4Search(self) -> None: """Dynamically subclasses the graph with the K4Search extension, which adds the data structures and methods necessary to search for a subgraph homeomorphic to K_4. Raises: RuntimeError if C graphlib version of this function failed. """ result = graphLib.gp_ExtendWith_K4Search(self._theGraph) if result != OK: raise RuntimeError( "Failed to extend graph with K4Search structures." ) graph-algorithms-planarity-08d7b51/planarity/full/graphLib.c000066400000000000000000020212061522057144000241630ustar00rootroot00000000000000/* Generated by Cython 3.2.6 */ /* BEGIN: Cython Metadata { "distutils": { "depends": [ "planarity/c/graphLib/graph.h", "planarity/c/graphLib/graphDFSUtils.h", "planarity/c/graphLib/graphLib.h", "planarity/c/graphLib/homeomorphSearch/graphK23Search.h", "planarity/c/graphLib/homeomorphSearch/graphK33Search.h", "planarity/c/graphLib/homeomorphSearch/graphK4Search.h", "planarity/c/graphLib/io/g6-read-iterator.h", "planarity/c/graphLib/io/g6-write-iterator.h", "planarity/c/graphLib/io/graphIO.h", "planarity/c/graphLib/lowLevelUtils/apiutils.h", "planarity/c/graphLib/lowLevelUtils/appconst.h", "planarity/c/graphLib/planarityRelated/graphDrawPlanar.h", "planarity/c/graphLib/planarityRelated/graphOuterplanarity.h", "planarity/c/graphLib/planarityRelated/graphPlanarity.h" ], "include_dirs": [ "planarity/full", "planarity/c/graphLib" ], "name": "planarity.full.graphLib", "sources": [ "planarity/full/graphLib.pyx", "planarity/c/graphLib/graphDFSUtils.c", "planarity/c/graphLib/graphLib.c", "planarity/c/graphLib/graph.c", "planarity/c/graphLib/io/g6-api-utilities.c", "planarity/c/graphLib/io/g6-read-iterator.c", "planarity/c/graphLib/io/strOrFile.c", "planarity/c/graphLib/io/g6-write-iterator.c", "planarity/c/graphLib/io/strbuf.c", "planarity/c/graphLib/io/graphIO.c", "planarity/c/graphLib/extensionSystem/graphExtensions.c", "planarity/c/graphLib/homeomorphSearch/graphK23Search_Extensions.c", "planarity/c/graphLib/homeomorphSearch/graphK33Search_Extensions.c", "planarity/c/graphLib/homeomorphSearch/graphK4Search.c", "planarity/c/graphLib/homeomorphSearch/graphK4Search_Extensions.c", "planarity/c/graphLib/homeomorphSearch/graphK33Search.c", "planarity/c/graphLib/homeomorphSearch/graphK23Search.c", "planarity/c/graphLib/planarityRelated/graphTests.c", "planarity/c/graphLib/planarityRelated/graphPlanarity_Extensions.c", "planarity/c/graphLib/planarityRelated/graphEmbed.c", "planarity/c/graphLib/planarityRelated/graphOuterplanarObstruction.c", "planarity/c/graphLib/planarityRelated/graphNonplanar.c", "planarity/c/graphLib/planarityRelated/graphIsolator.c", "planarity/c/graphLib/planarityRelated/graphOuterplanarity_Extensions.c", "planarity/c/graphLib/planarityRelated/graphDrawPlanar.c", "planarity/c/graphLib/planarityRelated/graphDrawPlanar_Extensions.c", "planarity/c/graphLib/lowLevelUtils/stack.c", "planarity/c/graphLib/lowLevelUtils/apiutils.c", "planarity/c/graphLib/lowLevelUtils/listcoll.c" ] }, "module_name": "planarity.full.graphLib" } END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ /* InitLimitedAPI */ #if defined(Py_LIMITED_API) #if !defined(CYTHON_LIMITED_API) #define CYTHON_LIMITED_API 1 #endif #elif defined(CYTHON_LIMITED_API) #ifdef _MSC_VER #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.") #else #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead. #endif #endif #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 < 0x03080000 #error Cython requires Python 3.8+. #else #define __PYX_ABI_VERSION "3_2_6" #define CYTHON_HEX_VERSION 0x030206F0 #define CYTHON_FUTURE_DIVISION 1 /* CModulePreamble */ #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #define __PYX_COMMA , #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX #if defined(GRAALVM_PYTHON) /* For very preliminary testing purposes. Most variables are set the same as PyPy. The existence of this section does not imply that anything works or is even tested */ #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 #define CYTHON_COMPILING_IN_LIMITED_API 0 #define CYTHON_COMPILING_IN_GRAAL 1 #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 #undef CYTHON_USE_TYPE_SPECS #define CYTHON_USE_TYPE_SPECS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 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_AVOID_THREAD_UNSAFE_BORROWED_REFS #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 #undef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 0 #undef CYTHON_ASSUME_SAFE_SIZE #define CYTHON_ASSUME_SAFE_SIZE 0 #undef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_GIL #define CYTHON_FAST_GIL 0 #undef CYTHON_METH_FASTCALL #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #ifndef CYTHON_PEP487_INIT_SUBCLASS #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #undef CYTHON_USE_MODULE_STATE #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_SYS_MONITORING #define CYTHON_USE_SYS_MONITORING 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_AM_SEND #define CYTHON_USE_AM_SEND 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 1 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif #undef CYTHON_USE_FREELISTS #define CYTHON_USE_FREELISTS 0 #undef CYTHON_IMMORTAL_CONSTANTS #define CYTHON_IMMORTAL_CONSTANTS 0 #elif defined(PYPY_VERSION) #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #define CYTHON_COMPILING_IN_LIMITED_API 0 #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #ifndef CYTHON_USE_TYPE_SPECS #define CYTHON_USE_TYPE_SPECS 0 #endif #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 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_AVOID_THREAD_UNSAFE_BORROWED_REFS #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 #undef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 0 #ifndef CYTHON_ASSUME_SAFE_SIZE #define CYTHON_ASSUME_SAFE_SIZE 1 #endif #undef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_GIL #define CYTHON_FAST_GIL 0 #undef CYTHON_METH_FASTCALL #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #ifndef CYTHON_PEP487_INIT_SUBCLASS #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif #if PY_VERSION_HEX < 0x03090000 #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 0 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif #undef CYTHON_USE_MODULE_STATE #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_SYS_MONITORING #define CYTHON_USE_SYS_MONITORING 0 #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00) #endif #undef CYTHON_USE_AM_SEND #define CYTHON_USE_AM_SEND 0 #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100) #endif #undef CYTHON_USE_FREELISTS #define CYTHON_USE_FREELISTS 0 #undef CYTHON_IMMORTAL_CONSTANTS #define CYTHON_IMMORTAL_CONSTANTS 0 #elif defined(CYTHON_LIMITED_API) #ifdef Py_LIMITED_API #undef __PYX_LIMITED_VERSION_HEX #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API #endif #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 #define CYTHON_COMPILING_IN_LIMITED_API 1 #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 #undef CYTHON_USE_TYPE_SPECS #define CYTHON_USE_TYPE_SPECS 1 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #undef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 0 #ifndef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #endif #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_AVOID_THREAD_UNSAFE_BORROWED_REFS #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 #endif #undef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 0 #undef CYTHON_ASSUME_SAFE_SIZE #define CYTHON_ASSUME_SAFE_SIZE 0 #undef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_GIL #define CYTHON_FAST_GIL 0 #undef CYTHON_METH_FASTCALL #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #ifndef CYTHON_PEP487_INIT_SUBCLASS #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif #ifndef CYTHON_USE_MODULE_STATE #define CYTHON_USE_MODULE_STATE 0 #endif #undef CYTHON_USE_SYS_MONITORING #define CYTHON_USE_SYS_MONITORING 0 #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #endif #ifndef CYTHON_USE_AM_SEND #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000) #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif #ifndef CYTHON_USE_FREELISTS #define CYTHON_USE_FREELISTS 1 #endif #undef CYTHON_IMMORTAL_CONSTANTS #define CYTHON_IMMORTAL_CONSTANTS 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #define CYTHON_COMPILING_IN_LIMITED_API 0 #define CYTHON_COMPILING_IN_GRAAL 0 #ifdef Py_GIL_DISABLED #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1 #else #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0 #endif #if PY_VERSION_HEX < 0x030A0000 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #elif !defined(CYTHON_USE_TYPE_SLOTS) #define CYTHON_USE_TYPE_SLOTS 1 #endif #ifndef CYTHON_USE_TYPE_SPECS #define CYTHON_USE_TYPE_SPECS 0 #endif #ifndef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #ifndef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #elif !defined(CYTHON_USE_PYLIST_INTERNALS) #define CYTHON_USE_PYLIST_INTERNALS 1 #endif #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) #define CYTHON_USE_UNICODE_WRITER 1 #endif #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1 #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS) #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0 #endif #ifndef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 1 #endif #ifndef CYTHON_ASSUME_SAFE_SIZE #define CYTHON_ASSUME_SAFE_SIZE 1 #endif #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #undef CYTHON_FAST_GIL #define CYTHON_FAST_GIL 0 #elif !defined(CYTHON_FAST_GIL) #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6) #endif #ifndef CYTHON_METH_FASTCALL #define CYTHON_METH_FASTCALL 1 #endif #ifndef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 1 #endif #ifndef CYTHON_PEP487_INIT_SUBCLASS #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 1 #endif #ifndef CYTHON_USE_MODULE_STATE #define CYTHON_USE_MODULE_STATE 0 #endif #ifndef CYTHON_USE_SYS_MONITORING #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1) #endif #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 1 #endif #ifndef CYTHON_USE_AM_SEND #define CYTHON_USE_AM_SEND 1 #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #elif !defined(CYTHON_USE_DICT_VERSIONS) #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE) #endif #ifndef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 1 #endif #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 #endif #ifndef CYTHON_USE_FREELISTS #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) #endif #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000 #undef CYTHON_IMMORTAL_CONSTANTS #define CYTHON_IMMORTAL_CONSTANTS 0 // definitely won't work #elif !defined(CYTHON_IMMORTAL_CONSTANTS) #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) #endif #endif #ifndef CYTHON_COMPRESS_STRINGS #define CYTHON_COMPRESS_STRINGS 1 #endif #ifndef CYTHON_FAST_PYCCALL #define CYTHON_FAST_PYCCALL CYTHON_FAST_PYCALL #endif #ifndef CYTHON_VECTORCALL #if CYTHON_COMPILING_IN_LIMITED_API #define CYTHON_VECTORCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000) #else #define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL) #endif #endif #if CYTHON_USE_PYLONG_INTERNALS #undef SHIFT #undef BASE #undef MASK #ifdef SIZEOF_VOID_P enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; #endif #endif #ifndef __has_attribute #define __has_attribute(x) 0 #endif #ifndef __has_cpp_attribute #define __has_cpp_attribute(x) 0 #endif #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict #else #define CYTHON_RESTRICT #endif #endif #ifndef CYTHON_UNUSED #if defined(__cplusplus) /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 * but leads to warnings with -pedantic, since it is a C++17 feature */ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) #if __has_cpp_attribute(maybe_unused) #define CYTHON_UNUSED [[maybe_unused]] #endif #endif #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_UNUSED_VAR # if defined(__cplusplus) template void CYTHON_UNUSED_VAR( const T& ) { } # else # define CYTHON_UNUSED_VAR(x) (void)(x) # endif #endif #ifndef CYTHON_MAYBE_UNUSED_VAR #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) #endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING # define CYTHON_NCP_UNUSED # else # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif #ifndef CYTHON_USE_CPP_STD_MOVE #if defined(__cplusplus) && (\ __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) #define CYTHON_USE_CPP_STD_MOVE 1 #else #define CYTHON_USE_CPP_STD_MOVE 0 #endif #endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #include typedef uintptr_t __pyx_uintptr_t; #ifndef CYTHON_FALLTHROUGH #if defined(__cplusplus) /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 * but leads to warnings with -pedantic, since it is a C++17 feature */ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) #if __has_cpp_attribute(fallthrough) #define CYTHON_FALLTHROUGH [[fallthrough]] #endif #endif #ifndef CYTHON_FALLTHROUGH #if __has_cpp_attribute(clang::fallthrough) #define CYTHON_FALLTHROUGH [[clang::fallthrough]] #elif __has_cpp_attribute(gnu::fallthrough) #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] #endif #endif #endif #ifndef CYTHON_FALLTHROUGH #if __has_attribute(fallthrough) #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) #else #define CYTHON_FALLTHROUGH #endif #endif #if defined(__clang__) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif #ifndef Py_UNREACHABLE #define Py_UNREACHABLE() assert(0); abort() #endif #ifdef __cplusplus template struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) #else #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) #endif #if CYTHON_COMPILING_IN_PYPY == 1 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x030A0000) #else #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x03090000) #endif #define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) /* CInitCode */ #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 /* PythonCompatibility */ #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_DefaultClassType PyType_Type #if CYTHON_COMPILING_IN_LIMITED_API #ifndef CO_OPTIMIZED static int CO_OPTIMIZED; #endif #ifndef CO_NEWLOCALS static int CO_NEWLOCALS; #endif #ifndef CO_VARARGS static int CO_VARARGS; #endif #ifndef CO_VARKEYWORDS static int CO_VARKEYWORDS; #endif #ifndef CO_ASYNC_GENERATOR static int CO_ASYNC_GENERATOR; #endif #ifndef CO_GENERATOR static int CO_GENERATOR; #endif #ifndef CO_COROUTINE static int CO_COROUTINE; #endif #else #ifndef CO_COROUTINE #define CO_COROUTINE 0x80 #endif #ifndef CO_ASYNC_GENERATOR #define CO_ASYNC_GENERATOR 0x200 #endif #endif static int __Pyx_init_co_variables(void); #if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) #else #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) #endif #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) #define __Pyx_Py_Is(x, y) Py_Is(x, y) #else #define __Pyx_Py_Is(x, y) ((x) == (y)) #endif #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) #else #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) #endif #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) #else #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) #endif #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) #else #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) #endif #define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) #else #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) #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 Py_TPFLAGS_SEQUENCE #define Py_TPFLAGS_SEQUENCE 0 #endif #ifndef Py_TPFLAGS_MAPPING #define Py_TPFLAGS_MAPPING 0 #endif #ifndef Py_TPFLAGS_IMMUTABLETYPE #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8) #endif #ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7) #endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif #ifndef METH_FASTCALL #ifndef METH_FASTCALL #define METH_FASTCALL 0x80 #endif typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames); #else #if PY_VERSION_HEX >= 0x030d00A4 # define __Pyx_PyCFunctionFast PyCFunctionFast # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords #else # define __Pyx_PyCFunctionFast _PyCFunctionFast # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif #endif #if CYTHON_METH_FASTCALL #define __Pyx_METH_FASTCALL METH_FASTCALL #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords #else #define __Pyx_METH_FASTCALL METH_VARARGS #define __Pyx_PyCFunction_FastCall PyCFunction #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords #endif #if CYTHON_VECTORCALL #define __pyx_vectorcallfunc vectorcallfunc #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) #else #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) #endif #if PY_VERSION_HEX >= 0x030900B1 #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func) #else #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func) #endif #define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func) #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth) #elif !CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func) #endif #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags) static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) { return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self; } #endif static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) { #if CYTHON_COMPILING_IN_LIMITED_API return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc; #else return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; #endif } #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc) #if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000) #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); #else #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) #define __Pyx_PyCMethod PyCMethod #endif #ifndef METH_METHOD #define METH_METHOD 0x200 #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_LIMITED_API #define __Pyx_PyFrame_SetLineNumber(frame, lineno) #elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno)) #elif CYTHON_COMPILING_IN_GRAAL #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno)) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif #if CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_PyThreadState_Current PyThreadState_Get() #elif !CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_Current PyThreadState_GET() #elif PY_VERSION_HEX >= 0x030d00A1 #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked() #else #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() #endif #if CYTHON_USE_MODULE_STATE static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op) { void *result; result = PyModule_GetState(op); if (!result) Py_FatalError("Couldn't find the module state"); return result; } #define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o) #else #define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global) #endif #define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype) #define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype) #define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype) #define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype) #if CYTHON_USE_TYPE_SLOTS #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype) #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL) #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) #else #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\ ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\ (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\ __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL) #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype) #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype) #endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else #define __Pyx_PyDict_NewPresized(n) PyDict_New() #endif #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS #define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); if (res == NULL) PyErr_Clear(); return res; } #elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000 #define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError #define __Pyx_PyDict_GetItemStr PyDict_GetItem #else static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { #if CYTHON_COMPILING_IN_PYPY return PyDict_GetItem(dict, name); #else PyDictEntry *ep; PyDictObject *mp = (PyDictObject*) dict; long hash = ((PyStringObject *) name)->ob_shash; assert(hash != -1); ep = (mp->ma_lookup)(mp, name, hash); if (ep == NULL) { return NULL; } return ep->me_value; #endif } #define __Pyx_PyDict_GetItemStr PyDict_GetItem #endif #if CYTHON_USE_TYPE_SLOTS #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) #else #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) #endif #define __Pyx_PyObject_GetIterNextFunc(iterator) __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc) #if CYTHON_USE_TYPE_SPECS #define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ PyTypeObject *type = Py_TYPE((PyObject*)obj);\ assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ PyObject_GC_Del(obj);\ Py_DECREF(type);\ } #else #define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) #endif #if CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) #define __Pyx_PyUnicode_DATA(u) ((void*)u) #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) #else #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_READY(op) (0) #else #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) #endif #define __Pyx_PyUnicode_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) ((int)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, (Py_UCS4) ch) #if PY_VERSION_HEX >= 0x030C0000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) #else #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) #endif #endif #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 #if !defined(PyUnicode_DecodeUnicodeEscape) #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) #endif #if !defined(PyUnicode_Contains) #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) #endif #if !defined(PyByteArray_Check) #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) #endif #if !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif #endif #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 #define __Pyx_PySequence_ListKeepNew(obj)\ (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj)) #elif CYTHON_COMPILING_IN_CPYTHON #define __Pyx_PySequence_ListKeepNew(obj)\ (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) #else #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) #endif #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) #else #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) #endif enum __Pyx_ReferenceSharing { __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check __Pyx_ReferenceSharing_OwnStrongReference, __Pyx_ReferenceSharing_FunctionArgument, __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar }; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000 #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\ (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\ (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\ (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0))) #elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1) #else #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0) #endif #if CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) #else #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i) #endif #elif CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i) #else #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i)) #endif #else #define __Pyx_PyList_GetItemRef(o, i) __Pyx_NewRef(PyList_GET_ITEM(o, i)) #endif #if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !CYTHON_COMPILING_IN_LIMITED_API && CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) (__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\ __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i)) #else #define __Pyx_PyList_GetItemRefFast(o, i, unsafe_shared) __Pyx_PyList_GetItemRef(o, i) #endif #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result) #elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { *result = PyObject_GetItem(dict, key); if (*result == NULL) { if (PyErr_ExceptionMatches(PyExc_KeyError)) { PyErr_Clear(); return 0; } return -1; } return 1; } #else static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) { *result = PyDict_GetItemWithError(dict, key); if (*result == NULL) { return PyErr_Occurred() ? -1 : 0; } Py_INCREF(*result); return 1; } #endif #if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST #define __Pyx_VISIT_CONST(obj) Py_VISIT(obj) #else #define __Pyx_VISIT_CONST(obj) #endif #if CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i) #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i) #else #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i) #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i) #endif #if CYTHON_ASSUME_SAFE_SIZE #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o) #else #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString) #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) #endif #define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t #define __Pyx_PyLong_AsHash_t __Pyx_PyIndex_AsSsize_t #if __PYX_LIMITED_VERSION_HEX >= 0x030A0000 #define __Pyx_PySendResult PySendResult #else typedef enum { PYGEN_RETURN = 0, PYGEN_ERROR = -1, PYGEN_NEXT = 1, } __Pyx_PySendResult; #endif #if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3 typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result); #else #define __Pyx_pyiter_sendfunc sendfunc #endif #if !CYTHON_USE_AM_SEND #define __PYX_HAS_PY_AM_SEND 0 #elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000 #define __PYX_HAS_PY_AM_SEND 1 #else #define __PYX_HAS_PY_AM_SEND 2 // our own backported implementation #endif #if __PYX_HAS_PY_AM_SEND < 2 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods #else typedef struct { unaryfunc am_await; unaryfunc am_aiter; unaryfunc am_anext; __Pyx_pyiter_sendfunc am_send; } __Pyx_PyAsyncMethodsStruct; #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s)) #endif #if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0 #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21) #else #define __Pyx_TPFLAGS_HAVE_AM_SEND (0) #endif #if PY_VERSION_HEX >= 0x03090000 #define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get() #else #define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp #endif #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000 #ifdef __cplusplus extern "C" #endif PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); #endif #if CYTHON_COMPILING_IN_LIMITED_API static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) { int value; PyObject *py_value = PyObject_GetAttrString(inspect, name); if (!py_value) return 0; value = (int) PyLong_AsLong(py_value); Py_DECREF(py_value); *write_to = value; return value != -1 || !PyErr_Occurred(); } static int __Pyx_init_co_variables(void) { PyObject *inspect; int result; inspect = PyImport_ImportModule("inspect"); result = #if !defined(CO_OPTIMIZED) __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) && #endif #if !defined(CO_NEWLOCALS) __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) && #endif #if !defined(CO_VARARGS) __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) && #endif #if !defined(CO_VARKEYWORDS) __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) && #endif #if !defined(CO_ASYNC_GENERATOR) __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) && #endif #if !defined(CO_GENERATOR) __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) && #endif #if !defined(CO_COROUTINE) __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) && #endif 1; Py_DECREF(inspect); return result ? 0 : -1; } #else static int __Pyx_init_co_variables(void) { return 0; // It's a limited API-only feature } #endif /* MathInitCode */ #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) #ifndef _USE_MATH_DEFINES #define _USE_MATH_DEFINES #endif #endif #include #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) #define __Pyx_truncl trunc #else #define __Pyx_truncl truncl #endif #ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME #define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0 #endif #ifndef CYTHON_CLINE_IN_TRACEBACK #define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME #endif #if CYTHON_CLINE_IN_TRACEBACK #define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; } #else #define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; } #endif #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } #ifdef CYTHON_EXTERN_C #undef __PYX_EXTERN_C #define __PYX_EXTERN_C CYTHON_EXTERN_C #elif defined(__PYX_EXTERN_C) #ifdef _MSC_VER #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") #else #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. #endif #else #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #define __PYX_HAVE__planarity__full__graphLib #define __PYX_HAVE_API__planarity__full__graphLib /* Early includes */ #include "../c/graphLib/lowLevelUtils/apiutils.h" #include "../c/graphLib/graphLib.h" #include "../c/graphLib/lowLevelUtils/appconst.h" #include "../c/graphLib/graph.h" #include "../c/graphLib/io/graphIO.h" #include "../c/graphLib/io/g6-read-iterator.h" #include "../c/graphLib/io/g6-write-iterator.h" #include "../c/graphLib/graphDFSUtils.h" #include "../c/graphLib/planarityRelated/graphPlanarity.h" #include "../c/graphLib/planarityRelated/graphOuterplanarity.h" #include "../c/graphLib/planarityRelated/graphDrawPlanar.h" #include "../c/graphLib/homeomorphSearch/graphK23Search.h" #include "../c/graphLib/homeomorphSearch/graphK33Search.h" #include "../c/graphLib/homeomorphSearch/graphK4Search.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) #define CYTHON_WITHOUT_ASSERTIONS #endif #ifdef CYTHON_FREETHREADING_COMPATIBLE #if CYTHON_FREETHREADING_COMPATIBLE #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_NOT_USED #else #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED #endif #else #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED #endif #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 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))) ) static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { return (size_t) i < (size_t) limit; } #if defined (__cplusplus) && __cplusplus >= 201103L #include #define __Pyx_sst_abs(value) std::abs(value) #elif SIZEOF_INT >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) abs(value) #elif SIZEOF_LONG >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) labs(value) #elif defined (_MSC_VER) #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define __Pyx_sst_abs(value) llabs(value) #elif defined (__GNUC__) #define __Pyx_sst_abs(value) __builtin_llabs(value) #else #define __Pyx_sst_abs(value) ((value<0) ? -value : value) #endif static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*); #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 CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s) #else #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AsString(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AsString(s)) #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s) #endif #define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) #define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) { #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef) return Py_NewRef(obj); #else Py_INCREF(obj); return obj; #endif } static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) { #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef) return Py_XNewRef(obj); #else Py_XINCREF(obj); return obj; #endif } static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b); static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x); #define __Pyx_PySequence_Tuple(obj)\ (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t); static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x) #else #define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x) #endif #define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x)) #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) #if CYTHON_USE_PYLONG_INTERNALS #if PY_VERSION_HEX >= 0x030C00A7 #ifndef _PyLong_SIGN_MASK #define _PyLong_SIGN_MASK 3 #endif #ifndef _PyLong_NON_SIZE_BITS #define _PyLong_NON_SIZE_BITS 3 #endif #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) #define __Pyx_PyLong_SignedDigitCount(x)\ ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) #else #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) #endif typedef Py_ssize_t __Pyx_compact_pylong; typedef size_t __Pyx_compact_upylong; #else #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) #define __Pyx_PyLong_CompactValue(x)\ ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) typedef sdigit __Pyx_compact_pylong; typedef digit __Pyx_compact_upylong; #endif #if PY_VERSION_HEX >= 0x030C00A5 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) #else #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) #endif #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) #elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL) #else #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #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__ */ /* PretendToInitialize */ #ifdef __cplusplus #if __cplusplus > 201103L #include #endif template static void __Pyx_pretend_to_initialize(T* ptr) { #if __cplusplus > 201103L if ((std::is_trivially_default_constructible::value)) #endif *ptr = T(); (void)ptr; } #else static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } #endif #if !CYTHON_USE_MODULE_STATE static PyObject *__pyx_m = NULL; #endif static int __pyx_lineno; static int __pyx_clineno = 0; static const char * const __pyx_cfilenm = __FILE__; static const char *__pyx_filename; /* #### Code section: filename_table ### */ static const char* const __pyx_f[] = { "planarity/full/graphLib.pyx", }; /* #### Code section: utility_code_proto_before_types ### */ /* Atomics.proto (used by UnpackUnboundCMethod) */ #include #ifndef CYTHON_ATOMICS #define CYTHON_ATOMICS 1 #endif #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS #define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #define __pyx_atomic_int_type int #define __pyx_nonatomic_int_type int #if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ (__STDC_VERSION__ >= 201112L) &&\ !defined(__STDC_NO_ATOMICS__)) #include #elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ (__cplusplus >= 201103L) ||\ (defined(_MSC_VER) && _MSC_VER >= 1700))) #include #endif #if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\ (__STDC_VERSION__ >= 201112L) &&\ !defined(__STDC_NO_ATOMICS__) &&\ ATOMIC_INT_LOCK_FREE == 2) #undef __pyx_atomic_int_type #define __pyx_atomic_int_type atomic_int #define __pyx_atomic_ptr_type atomic_uintptr_t #define __pyx_nonatomic_ptr_type uintptr_t #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed) #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel) #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel) #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg) #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) #define __pyx_atomic_load(value) atomic_load(value) #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value) #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed) #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire) #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired) #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) #pragma message ("Using standard C atomics") #elif defined(__PYX_DEBUG_ATOMICS) #warning "Using standard C atomics" #endif #elif CYTHON_ATOMICS && (defined(__cplusplus) && (\ (__cplusplus >= 201103L) ||\ \ (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\ ATOMIC_INT_LOCK_FREE == 2) #undef __pyx_atomic_int_type #define __pyx_atomic_int_type std::atomic_int #define __pyx_atomic_ptr_type std::atomic_uintptr_t #define __pyx_nonatomic_ptr_type uintptr_t #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed) #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel) #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel) #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg) #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) #define __pyx_atomic_load(value) std::atomic_load(value) #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value) #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed) #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire) #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value) #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired) #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER) #pragma message ("Using standard C++ atomics") #elif defined(__PYX_DEBUG_ATOMICS) #warning "Using standard C++ atomics" #endif #elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\ (__GNUC_MINOR__ > 1 ||\ (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2)))) #define __pyx_atomic_ptr_type void* #define __pyx_nonatomic_ptr_type void* #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1) #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1) #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1) #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg) static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired); int result = old == *expected; *expected = old; return result; } #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0) #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value) #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0) #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0) #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value) static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired); int result = old == *expected; *expected = old; return result; } #ifdef __PYX_DEBUG_ATOMICS #warning "Using GNU atomics" #endif #elif CYTHON_ATOMICS && defined(_MSC_VER) #include #undef __pyx_atomic_int_type #define __pyx_atomic_int_type long #define __pyx_atomic_ptr_type void* #undef __pyx_nonatomic_int_type #define __pyx_nonatomic_int_type long #define __pyx_nonatomic_ptr_type void* #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer) #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1) #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1) #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1) #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg) static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) { __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected); int result = old == *expected; *expected = old; return result; } #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0) #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value) #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0) #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value) static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) { __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected); int result = old == *expected; *expected = old; return result; } #ifdef __PYX_DEBUG_ATOMICS #pragma message ("Using MSVC atomics") #endif #else #undef CYTHON_ATOMICS #define CYTHON_ATOMICS 0 #ifdef __PYX_DEBUG_ATOMICS #warning "Not using atomics" #endif #endif /* CriticalSectionsDefinition.proto (used by CriticalSections) */ #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #define __Pyx_PyCriticalSection void* #define __Pyx_PyCriticalSection2 void* #define __Pyx_PyCriticalSection_End(cs) #define __Pyx_PyCriticalSection2_End(cs) #else #define __Pyx_PyCriticalSection PyCriticalSection #define __Pyx_PyCriticalSection2 PyCriticalSection2 #define __Pyx_PyCriticalSection_End PyCriticalSection_End #define __Pyx_PyCriticalSection2_End PyCriticalSection2_End #endif /* CriticalSections.proto (used by ParseKeywordsImpl) */ #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs) #define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs) #else #define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin #define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin #endif #if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_BEGIN_CRITICAL_SECTION(o) { #define __Pyx_END_CRITICAL_SECTION() } #else #define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION #define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION #endif /* IncludeStructmemberH.proto (used by FixUpExtensionType) */ #include /* #### Code section: numeric_typedefs ### */ /* #### Code section: complex_type_declarations ### */ /* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ /* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, Py_ssize_t); void (*DECREF)(void*, PyObject*, Py_ssize_t); void (*GOTREF)(void*, PyObject*, Py_ssize_t); void (*GIVEREF)(void*, PyObject*, Py_ssize_t); void* (*SetupContext)(const char*, Py_ssize_t, 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; #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__));\ } #define __Pyx_RefNannyFinishContextNogil() {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ __Pyx_RefNannyFinishContext();\ PyGILState_Release(__pyx_gilstate_save);\ } #define __Pyx_RefNannyFinishContextNogil() {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ __Pyx_RefNannyFinishContext();\ PyGILState_Release(__pyx_gilstate_save);\ } #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); else {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContextNogil() #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_Py_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; Py_XDECREF(tmp);\ } while (0) #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) /* TupleAndListFromArray.proto (used by fastcall) */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); #endif #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); #endif /* IncludeStringH.proto (used by BytesEquals) */ #include /* BytesEquals.proto (used by UnicodeEquals) */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /* UnicodeEquals.proto (used by fastcall) */ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /* fastcall.proto */ #if CYTHON_AVOID_BORROWED_REFS #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i) #elif CYTHON_ASSUME_SAFE_MACROS #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i)) #else #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i)) #endif #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) #define __Pyx_KwValues_VARARGS(args, nargs) NULL #define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) #define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) #if CYTHON_METH_FASTCALL #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i]) #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds) #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues); #else #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) #endif #else #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS #endif #define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) #if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start) #else #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) #endif /* pyint_simplify.proto */ static CYTHON_INLINE int __Pyx_PyInt_FromNumber(PyObject **number_var, const char *argname, int accept_none); /* py_dict_items.proto (used by OwnedDictNext) */ static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); /* CallCFunction.proto (used by CallUnboundCMethod0) */ #define __Pyx_CallCFunction(cfunc, self, args)\ ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args) #define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\ ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs) #define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\ ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs) #define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\ ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames) /* PyObjectCall.proto (used by PyObjectFastCall) */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); #else #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif /* PyObjectCallMethO.proto (used by PyObjectFastCall) */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif /* PyObjectFastCall.proto (used by PyObjectCallOneArg) */ #define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs); /* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); /* PyObjectGetAttrStr.proto (used by UnpackUnboundCMethod) */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif /* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */ typedef struct { PyObject *type; PyObject **method_name; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS __pyx_atomic_int_type initialized; #endif PyCFunction func; PyObject *method; int flag; } __Pyx_CachedCFunction; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) { #if !CYTHON_ATOMICS return 1; #else __pyx_nonatomic_int_type expected = 0; if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) { return 0; } return expected; #endif } static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) { #if CYTHON_ATOMICS __pyx_atomic_store(&cfunc->initialized, 2); #endif } #else #define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2 #define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc) #endif /* CallUnboundCMethod0.proto */ CYTHON_UNUSED static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); #else #define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self) #endif /* py_dict_values.proto (used by OwnedDictNext) */ static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d); /* OwnedDictNext.proto (used by ParseKeywordsImpl) */ #if CYTHON_AVOID_BORROWED_REFS static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue); #else CYTHON_INLINE static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue); #endif /* RaiseDoubleKeywords.proto (used by ParseKeywordsImpl) */ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /* ParseKeywordsImpl.export */ static int __Pyx_ParseKeywordsTuple( PyObject *kwds, PyObject * const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs ); static int __Pyx_ParseKeywordDictToDict( PyObject *kwds, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name ); static int __Pyx_ParseKeywordDict( PyObject *kwds, PyObject ** const argnames[], PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs ); /* CallUnboundCMethod2.proto */ CYTHON_UNUSED static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2); #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2); #else #define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) #endif /* ParseKeywords.proto */ static CYTHON_INLINE int __Pyx_ParseKeywords( PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs ); /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /* decode_c_string_utf16.proto (used by decode_c_bytes) */ static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) { int byteorder = 0; return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); } static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) { int byteorder = -1; return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); } static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) { int byteorder = 1; return PyUnicode_DecodeUTF16(s, size, errors, &byteorder); } /* decode_c_bytes.proto (used by decode_bytes) */ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); /* decode_bytes.proto */ static CYTHON_INLINE PyObject* __Pyx_decode_bytes( PyObject* string, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { char* as_c_string; Py_ssize_t size; #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE as_c_string = PyBytes_AS_STRING(string); size = PyBytes_GET_SIZE(string); #else if (PyBytes_AsStringAndSize(string, &as_c_string, &size) < 0) { return NULL; } #endif return __Pyx_decode_c_bytes( as_c_string, size, start, stop, encoding, errors, decode_func); } /* FunctionExport.proto */ static int __Pyx_ExportFunction(PyObject *api_dict, const char *name, void (*f)(void), const char *sig); /* GetApiDict.proto */ static PyObject *__Pyx_ApiExport_GetApiDict(void); /* dict_setdefault.proto (used by FetchCommonType) */ static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value); /* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */ #if CYTHON_COMPILING_IN_LIMITED_API static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp); #endif /* SetItemOnTypeDict.proto (used by FixUpExtensionType) */ static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v); #define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v) /* FixUpExtensionType.proto (used by FetchCommonType) */ static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); /* AddModuleRef.proto (used by FetchSharedCythonModule) */ #if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\ __PYX_LIMITED_VERSION_HEX < 0x030d0000) static PyObject *__Pyx_PyImport_AddModuleRef(const char *name); #else #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) #endif /* FetchSharedCythonModule.proto (used by FetchCommonType) */ static PyObject *__Pyx_FetchSharedCythonABIModule(void); /* FetchCommonType.proto (used by CommonTypesMetaclass) */ static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases); /* CommonTypesMetaclass.proto (used by CythonFunctionShared) */ static int __pyx_CommonTypesMetaclass_init(PyObject *module); #define __Pyx_CommonTypesMetaclass_USED /* CallTypeTraverse.proto (used by CythonFunctionShared) */ #if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) #define __Pyx_call_type_traverse(o, always_call, visit, arg) 0 #else static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg); #endif /* PyMethodNew.proto (used by CythonFunctionShared) */ static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ); /* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */ #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); #endif /* CythonFunctionShared.proto (used by CythonFunction) */ #define __Pyx_CyFunction_USED #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 #define __Pyx_CYFUNCTION_CCLASS 0x04 #define __Pyx_CYFUNCTION_COROUTINE 0x08 #define __Pyx_CyFunction_GetClosure(f)\ (((__pyx_CyFunctionObject *) (f))->func_closure) #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_CyFunction_GetClassObj(f)\ (((__pyx_CyFunctionObject *) (f))->func_classobj) #else #define __Pyx_CyFunction_GetClassObj(f)\ ((PyObject*) ((PyCMethodObject *) (f))->mm_class) #endif #define __Pyx_CyFunction_SetClassObj(f, classobj)\ __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) #define __Pyx_CyFunction_Defaults(type, f)\ ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) typedef struct { #if CYTHON_COMPILING_IN_LIMITED_API PyObject_HEAD PyObject *func; #elif PY_VERSION_HEX < 0x030900B1 PyCFunctionObject func; #else PyCMethodObject func; #endif #if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL __pyx_vectorcallfunc func_vectorcall; #endif #if CYTHON_COMPILING_IN_LIMITED_API PyObject *func_weakreflist; #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API PyObject *func_dict; #endif PyObject *func_name; PyObject *func_qualname; PyObject *func_doc; PyObject *func_globals; PyObject *func_code; PyObject *func_closure; #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API PyObject *func_classobj; #endif PyObject *defaults; int flags; PyObject *defaults_tuple; PyObject *defaults_kwdict; PyObject *(*defaults_getter)(PyObject *); PyObject *func_annotations; PyObject *func_is_coroutine; } __pyx_CyFunctionObject; #undef __Pyx_CyOrPyCFunction_Check #define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType) #define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type) #define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType) static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)); #undef __Pyx_IsSameCFunction #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc) static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject *globals, PyObject* code); static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type); static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, PyObject *tuple); static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, PyObject *dict); static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, PyObject *dict); static int __pyx_CyFunction_init(PyObject *module); #if CYTHON_METH_FASTCALL static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); #if CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) #else #define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) #endif #endif /* CythonFunction.proto */ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject *globals, PyObject* code); /* PyDictVersioning.proto (used by CLineInTraceback) */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ (version_var) = __PYX_GET_DICT_VERSION(dict);\ (cache_var) = (value); #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\ } else {\ (VAR) = __pyx_dict_cached_value = (LOOKUP);\ __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ }\ } static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); #else #define __PYX_GET_DICT_VERSION(dict) (0) #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); #endif /* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); #else #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) #endif /* PyThreadStateGet.proto (used by PyErrFetchRestore) */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; #if PY_VERSION_HEX >= 0x030C00A6 #define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) #else #define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) #endif #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign #define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) #define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() #endif /* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) #else #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) #endif #else #define __Pyx_PyErr_Clear() PyErr_Clear() #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif /* PyObjectGetAttrStrNoError.proto (used by CLineInTraceback) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); /* CLineInTraceback.proto (used by AddTraceback) */ #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #else #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) #endif /* CodeObjectCache.proto (used by AddTraceback) */ #if CYTHON_COMPILING_IN_LIMITED_API typedef PyObject __Pyx_CachedCodeObjectType; #else typedef PyCodeObject __Pyx_CachedCodeObjectType; #endif typedef struct { __Pyx_CachedCodeObjectType* code_object; int code_line; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_atomic_int_type accessor_count; #endif }; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object); /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* GCCDiagnostics.proto */ #if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) #define __Pyx_HAS_GCC_DIAGNOSTIC #endif /* PyObjectVectorCallKwBuilder.proto (used by CIntToPy) */ CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); #if CYTHON_VECTORCALL #if PY_VERSION_HEX >= 0x03090000 #define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall #else #define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall #endif #define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n) static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n); static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n); #else #define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict #define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n) #define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value) #define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value) #endif /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value); /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *); /* FormatTypeName.proto */ #if CYTHON_COMPILING_IN_LIMITED_API typedef PyObject *__Pyx_TypeName; #define __Pyx_FMT_TYPENAME "%U" #define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName #else static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp); #endif #else // !LIMITED_API typedef const char *__Pyx_TypeName; #define __Pyx_FMT_TYPENAME "%.200s" #define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name) #define __Pyx_DECREF_TypeName(obj) #endif /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *); /* FastTypeChecks.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); #else #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) { return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2); } #endif #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) #ifdef PyExceptionInstance_Check #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj) #else #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException) #endif /* GetRuntimeVersion.proto */ #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 static unsigned long __Pyx_cached_runtime_version = 0; static void __Pyx_init_runtime_version(void); #else #define __Pyx_init_runtime_version() #endif static unsigned long __Pyx_get_runtime_version(void); /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); /* DecompressString.proto */ static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo); /* MultiPhaseInitModuleState.proto */ #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE static PyObject *__Pyx_State_FindModule(void*); static int __Pyx_State_AddModule(PyObject* module, void*); static int __Pyx_State_RemoveModule(void*); #elif CYTHON_USE_MODULE_STATE #define __Pyx_State_FindModule PyState_FindModule #define __Pyx_State_AddModule PyState_AddModule #define __Pyx_State_RemoveModule PyState_RemoveModule #endif /* #### Code section: module_declarations ### */ /* CythonABIVersion.proto */ #if CYTHON_COMPILING_IN_LIMITED_API #if CYTHON_METH_FASTCALL #define __PYX_FASTCALL_ABI_SUFFIX "_fastcall" #else #define __PYX_FASTCALL_ABI_SUFFIX #endif #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX #else #define __PYX_LIMITED_ABI_SUFFIX #endif #if __PYX_HAS_PY_AM_SEND == 1 #define __PYX_AM_SEND_ABI_SUFFIX #elif __PYX_HAS_PY_AM_SEND == 2 #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport" #else #define __PYX_AM_SEND_ABI_SUFFIX "noamsend" #endif #ifndef __PYX_MONITORING_ABI_SUFFIX #define __PYX_MONITORING_ABI_SUFFIX #endif #if CYTHON_USE_TP_FINALIZE #define __PYX_TP_FINALIZE_ABI_SUFFIX #else #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize" #endif #if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED) #define __PYX_FREELISTS_ABI_SUFFIX #else #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists" #endif #define CYTHON_ABI __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." /* Module declarations from "planarity.full" */ /* Module declarations from "planarity.full.cgraphLib" */ /* Module declarations from "planarity.full.graphLib" */ /* #### Code section: typeinfo ### */ /* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "planarity.full.graphLib" extern int __pyx_module_is_main_planarity__full__graphLib; int __pyx_module_is_main_planarity__full__graphLib = 0; /* Implementation of "planarity.full.graphLib" */ /* #### Code section: global_var ### */ /* #### Code section: string_decls ### */ static const char __pyx_k_Cython_wrapper_for_the_Edge_Add[] = "\nCython wrapper for the Edge Addition Planarity Suite Graph Library\n\nWraps functions and macros that operate over graphP structs and to exposes the \nG6 read and write iterator machinery.\n\nNOTE: No bounds/error checking is done here, and is rather the responsibility\nof the caller to make sure these functions are being called legitimately.\n"; /* #### Code section: decls ### */ static PyObject *__pyx_pf_9planarity_4full_8graphLib_gp_GetQuietMode(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_8graphLib_2gp_SetQuietMode(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_newQuietMode); /* proto */ static PyObject *__pyx_pf_9planarity_4full_8graphLib_4gp_GetProjectVersionFull(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_9planarity_4full_8graphLib_6gp_GetLibPlanarityVersionFull(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ /* #### Code section: late_includes ### */ /* #### Code section: module_state ### */ /* SmallCodeConfig */ #ifndef CYTHON_SMALL_CODE #if defined(__clang__) #define CYTHON_SMALL_CODE #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) #define CYTHON_SMALL_CODE __attribute__((cold)) #else #define CYTHON_SMALL_CODE #endif #endif typedef struct { PyObject *__pyx_d; PyObject *__pyx_b; PyObject *__pyx_cython_runtime; PyObject *__pyx_empty_tuple; PyObject *__pyx_empty_bytes; PyObject *__pyx_empty_unicode; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop; __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values; PyObject *__pyx_codeobj_tab[4]; PyObject *__pyx_string_tab[96]; /* #### Code section: module_state_contents ### */ /* CommonTypesMetaclass.module_state_decls */ PyTypeObject *__pyx_CommonTypesMetaclassType; /* CachedMethodType.module_state_decls */ #if CYTHON_COMPILING_IN_LIMITED_API PyObject *__Pyx_CachedMethodType; #endif /* CythonFunctionShared.module_state_decls */ PyTypeObject *__pyx_CyFunctionType; /* CodeObjectCache.module_state_decls */ struct __Pyx_CodeObjectCache __pyx_code_cache; /* #### Code section: module_state_end ### */ } __pyx_mstatetype; #if CYTHON_USE_MODULE_STATE #ifdef __cplusplus namespace { extern struct PyModuleDef __pyx_moduledef; } /* anonymous namespace */ #else static struct PyModuleDef __pyx_moduledef; #endif #define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef))) #define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef)) #else static __pyx_mstatetype __pyx_mstate_global_static = #ifdef __cplusplus {}; #else {0}; #endif static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static; #endif /* #### Code section: constant_name_defines ### */ #define __pyx_kp_u_ __pyx_string_tab[0] #define __pyx_kp_u_planarity_full_graphLib_pyx __pyx_string_tab[1] #define __pyx_n_u_AT_EDGE_CAPACITY_LIMIT __pyx_string_tab[2] #define __pyx_n_u_DEFAULT_EDGE_CAPACITY_FACTOR __pyx_string_tab[3] #define __pyx_n_u_DFSUTILS_NAME __pyx_string_tab[4] #define __pyx_n_u_DRAWPLANAR_NAME __pyx_string_tab[5] #define __pyx_n_u_EDGEFLAG_DIRECTION_INONLY __pyx_string_tab[6] #define __pyx_n_u_EDGEFLAG_DIRECTION_MASK __pyx_string_tab[7] #define __pyx_n_u_EDGEFLAG_DIRECTION_OUTONLY __pyx_string_tab[8] #define __pyx_n_u_EDGEFLAG_INVERTED_MASK __pyx_string_tab[9] #define __pyx_n_u_EDGE_MARKED_MASK __pyx_string_tab[10] #define __pyx_n_u_EDGE_TYPE_BACK __pyx_string_tab[11] #define __pyx_n_u_EDGE_TYPE_CHILD __pyx_string_tab[12] #define __pyx_n_u_EDGE_TYPE_FORWARD __pyx_string_tab[13] #define __pyx_n_u_EDGE_TYPE_MASK __pyx_string_tab[14] #define __pyx_n_u_EDGE_TYPE_NOTDEFINED __pyx_string_tab[15] #define __pyx_n_u_EDGE_TYPE_PARENT __pyx_string_tab[16] #define __pyx_n_u_EDGE_TYPE_TREE __pyx_string_tab[17] #define __pyx_n_u_EDGE_VISITED_MASK __pyx_string_tab[18] #define __pyx_n_u_EMBEDFLAGS_DRAWPLANAR __pyx_string_tab[19] #define __pyx_n_u_EMBEDFLAGS_OUTERPLANAR __pyx_string_tab[20] #define __pyx_n_u_EMBEDFLAGS_PLANAR __pyx_string_tab[21] #define __pyx_n_u_EMBEDFLAGS_SEARCHFORK23 __pyx_string_tab[22] #define __pyx_n_u_EMBEDFLAGS_SEARCHFORK33 __pyx_string_tab[23] #define __pyx_n_u_EMBEDFLAGS_SEARCHFORK4 __pyx_string_tab[24] #define __pyx_n_u_FALSE __pyx_string_tab[25] #define __pyx_n_u_GRAPHFLAGS_DFSNUMBERED __pyx_string_tab[26] #define __pyx_n_u_GRAPHFLAGS_EXTENDEDWITH_DFSUTILS __pyx_string_tab[27] #define __pyx_n_u_GRAPHFLAGS_EXTENDEDWITH_OUTERPLA __pyx_string_tab[28] #define __pyx_n_u_GRAPHFLAGS_EXTENDEDWITH_PLANARIT __pyx_string_tab[29] #define __pyx_n_u_GRAPHFLAGS_SORTEDBYDFI __pyx_string_tab[30] #define __pyx_n_u_GRAPHFLAGS_ZEROBASEDIO __pyx_string_tab[31] #define __pyx_n_u_K23SEARCH_NAME __pyx_string_tab[32] #define __pyx_n_u_K33SEARCH_NAME __pyx_string_tab[33] #define __pyx_n_u_K4SEARCH_NAME __pyx_string_tab[34] #define __pyx_n_u_MINORTYPE_A __pyx_string_tab[35] #define __pyx_n_u_MINORTYPE_B __pyx_string_tab[36] #define __pyx_n_u_MINORTYPE_C __pyx_string_tab[37] #define __pyx_n_u_MINORTYPE_D __pyx_string_tab[38] #define __pyx_n_u_MINORTYPE_E __pyx_string_tab[39] #define __pyx_n_u_MINORTYPE_E1 __pyx_string_tab[40] #define __pyx_n_u_MINORTYPE_E2 __pyx_string_tab[41] #define __pyx_n_u_MINORTYPE_E3 __pyx_string_tab[42] #define __pyx_n_u_MINORTYPE_E4 __pyx_string_tab[43] #define __pyx_n_u_MINORTYPE_E5 __pyx_string_tab[44] #define __pyx_n_u_MINORTYPE_E6 __pyx_string_tab[45] #define __pyx_n_u_MINORTYPE_E7 __pyx_string_tab[46] #define __pyx_n_u_MINORTYPE_NONE __pyx_string_tab[47] #define __pyx_n_u_NIL __pyx_string_tab[48] #define __pyx_n_u_NONEMBEDDABLE __pyx_string_tab[49] #define __pyx_n_u_NOTOK __pyx_string_tab[50] #define __pyx_n_u_None __pyx_string_tab[51] #define __pyx_n_u_OK __pyx_string_tab[52] #define __pyx_n_u_OUTERPLANARITY_NAME __pyx_string_tab[53] #define __pyx_n_u_PLANARITY_NAME __pyx_string_tab[54] #define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[55] #define __pyx_n_u_QUIETMODE_ALL __pyx_string_tab[56] #define __pyx_n_u_QUIETMODE_ERRORS __pyx_string_tab[57] #define __pyx_n_u_QUIETMODE_MESSAGES __pyx_string_tab[58] #define __pyx_n_u_QUIETMODE_NONE __pyx_string_tab[59] #define __pyx_n_u_TRUE __pyx_string_tab[60] #define __pyx_n_u_VERTEX_MARKED_MASK __pyx_string_tab[61] #define __pyx_n_u_VERTEX_VISITED_MASK __pyx_string_tab[62] #define __pyx_n_u_WRITE_ADJLIST __pyx_string_tab[63] #define __pyx_n_u_WRITE_ADJMATRIX __pyx_string_tab[64] #define __pyx_n_u_WRITE_G6 __pyx_string_tab[65] #define __pyx_n_u_asyncio_coroutines __pyx_string_tab[66] #define __pyx_n_u_cline_in_traceback __pyx_string_tab[67] #define __pyx_n_u_encoded_version __pyx_string_tab[68] #define __pyx_n_u_func __pyx_string_tab[69] #define __pyx_n_u_gp_GetLibPlanarityVersionFull __pyx_string_tab[70] #define __pyx_n_u_gp_GetProjectVersionFull __pyx_string_tab[71] #define __pyx_n_u_gp_GetQuietMode __pyx_string_tab[72] #define __pyx_n_u_gp_SetQuietMode __pyx_string_tab[73] #define __pyx_n_u_int __pyx_string_tab[74] #define __pyx_n_u_is_coroutine __pyx_string_tab[75] #define __pyx_n_u_items __pyx_string_tab[76] #define __pyx_n_u_main __pyx_string_tab[77] #define __pyx_n_u_module __pyx_string_tab[78] #define __pyx_n_u_name __pyx_string_tab[79] #define __pyx_n_u_newQuietMode __pyx_string_tab[80] #define __pyx_n_u_planarity_full_graphLib __pyx_string_tab[81] #define __pyx_n_u_pop __pyx_string_tab[82] #define __pyx_n_u_pyx_capi __pyx_string_tab[83] #define __pyx_n_u_qualname __pyx_string_tab[84] #define __pyx_n_u_return __pyx_string_tab[85] #define __pyx_n_u_set_name __pyx_string_tab[86] #define __pyx_n_u_setdefault __pyx_string_tab[87] #define __pyx_n_u_str __pyx_string_tab[88] #define __pyx_n_u_test __pyx_string_tab[89] #define __pyx_n_u_values __pyx_string_tab[90] #define __pyx_kp_b_graphP_graphP_graphP_void_int_G6 __pyx_string_tab[91] #define __pyx_kp_b_iso88591_A __pyx_string_tab[92] #define __pyx_kp_b_iso88591_C1 __pyx_string_tab[93] #define __pyx_kp_b_iso88591_Qa __pyx_string_tab[94] #define __pyx_kp_b_iso88591_q_H __pyx_string_tab[95] /* #### Code section: module_state_clear ### */ #if CYTHON_USE_MODULE_STATE static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) { __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m); if (!clear_module_state) return 0; Py_CLEAR(clear_module_state->__pyx_d); Py_CLEAR(clear_module_state->__pyx_b); Py_CLEAR(clear_module_state->__pyx_cython_runtime); Py_CLEAR(clear_module_state->__pyx_empty_tuple); Py_CLEAR(clear_module_state->__pyx_empty_bytes); Py_CLEAR(clear_module_state->__pyx_empty_unicode); #if CYTHON_PEP489_MULTI_PHASE_INIT __Pyx_State_RemoveModule(NULL); #endif for (int i=0; i<4; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); } for (int i=0; i<96; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); } /* #### Code section: module_state_clear_contents ### */ /* CommonTypesMetaclass.module_state_clear */ Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType); /* CythonFunctionShared.module_state_clear */ Py_CLEAR(clear_module_state->__pyx_CyFunctionType); /* #### Code section: module_state_clear_end ### */ return 0; } #endif /* #### Code section: module_state_traverse ### */ #if CYTHON_USE_MODULE_STATE static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m); if (!traverse_module_state) return 0; Py_VISIT(traverse_module_state->__pyx_d); Py_VISIT(traverse_module_state->__pyx_b); Py_VISIT(traverse_module_state->__pyx_cython_runtime); __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple); __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes); __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode); for (int i=0; i<4; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); } for (int i=0; i<96; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); } /* #### Code section: module_state_traverse_contents ### */ /* CommonTypesMetaclass.module_state_traverse */ Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType); /* CythonFunctionShared.module_state_traverse */ Py_VISIT(traverse_module_state->__pyx_CyFunctionType); /* #### Code section: module_state_traverse_end ### */ return 0; } #endif /* #### Code section: module_code ### */ /* "planarity/full/graphLib.pyx":113 * * # Functions to be made available when importing package from Python * def gp_GetQuietMode() -> int: # <<<<<<<<<<<<<< * return cgraphLib.gp_GetQuietMode() * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_8graphLib_1gp_GetQuietMode(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_8graphLib_gp_GetQuietMode, "gp_GetQuietMode() -> int"); static PyMethodDef __pyx_mdef_9planarity_4full_8graphLib_1gp_GetQuietMode = {"gp_GetQuietMode", (PyCFunction)__pyx_pw_9planarity_4full_8graphLib_1gp_GetQuietMode, METH_NOARGS, __pyx_doc_9planarity_4full_8graphLib_gp_GetQuietMode}; static PyObject *__pyx_pw_9planarity_4full_8graphLib_1gp_GetQuietMode(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetQuietMode (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_9planarity_4full_8graphLib_gp_GetQuietMode(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_8graphLib_gp_GetQuietMode(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetQuietMode", 0); /* "planarity/full/graphLib.pyx":114 * # Functions to be made available when importing package from Python * def gp_GetQuietMode() -> int: * return cgraphLib.gp_GetQuietMode() # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyLong_From_int(gp_GetQuietMode()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (__Pyx_PyInt_FromNumber(&__pyx_t_1, NULL, 0) < (0)) __PYX_ERR(0, 114, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graphLib.pyx":113 * * # Functions to be made available when importing package from Python * def gp_GetQuietMode() -> int: # <<<<<<<<<<<<<< * return cgraphLib.gp_GetQuietMode() * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("planarity.full.graphLib.gp_GetQuietMode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graphLib.pyx":117 * * * def gp_SetQuietMode(int newQuietMode) -> None: # <<<<<<<<<<<<<< * cgraphLib.gp_SetQuietMode(newQuietMode) * */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_8graphLib_3gp_SetQuietMode(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_8graphLib_2gp_SetQuietMode, "gp_SetQuietMode(int newQuietMode) -> None"); static PyMethodDef __pyx_mdef_9planarity_4full_8graphLib_3gp_SetQuietMode = {"gp_SetQuietMode", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9planarity_4full_8graphLib_3gp_SetQuietMode, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9planarity_4full_8graphLib_2gp_SetQuietMode}; static PyObject *__pyx_pw_9planarity_4full_8graphLib_3gp_SetQuietMode(PyObject *__pyx_self, #if CYTHON_METH_FASTCALL PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds #else PyObject *__pyx_args, PyObject *__pyx_kwds #endif ) { int __pyx_v_newQuietMode; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_SetQuietMode (wrapper)", 0); #if !CYTHON_METH_FASTCALL #if CYTHON_ASSUME_SAFE_SIZE __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); #else __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; #endif #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_newQuietMode,0}; const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0; if (unlikely(__pyx_kwds_len < 0)) __PYX_ERR(0, 117, __pyx_L3_error) if (__pyx_kwds_len > 0) { switch (__pyx_nargs) { case 1: values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 117, __pyx_L3_error) CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } const Py_ssize_t kwd_pos_args = __pyx_nargs; if (__Pyx_ParseKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values, kwd_pos_args, __pyx_kwds_len, "gp_SetQuietMode", 0) < (0)) __PYX_ERR(0, 117, __pyx_L3_error) for (Py_ssize_t i = __pyx_nargs; i < 1; i++) { if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("gp_SetQuietMode", 1, 1, 1, i); __PYX_ERR(0, 117, __pyx_L3_error) } } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0); if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 117, __pyx_L3_error) } __pyx_v_newQuietMode = __Pyx_PyLong_As_int(values[0]); if (unlikely((__pyx_v_newQuietMode == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 117, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gp_SetQuietMode", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 117, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_AddTraceback("planarity.full.graphLib.gp_SetQuietMode", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9planarity_4full_8graphLib_2gp_SetQuietMode(__pyx_self, __pyx_v_newQuietMode); /* function exit code */ for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { Py_XDECREF(values[__pyx_temp]); } __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_8graphLib_2gp_SetQuietMode(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_newQuietMode) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_SetQuietMode", 0); /* "planarity/full/graphLib.pyx":118 * * def gp_SetQuietMode(int newQuietMode) -> None: * cgraphLib.gp_SetQuietMode(newQuietMode) # <<<<<<<<<<<<<< * * */ gp_SetQuietMode(__pyx_v_newQuietMode); /* "planarity/full/graphLib.pyx":117 * * * def gp_SetQuietMode(int newQuietMode) -> None: # <<<<<<<<<<<<<< * cgraphLib.gp_SetQuietMode(newQuietMode) * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graphLib.pyx":121 * * * def gp_GetProjectVersionFull() -> str: # <<<<<<<<<<<<<< * cdef bytes encoded_version = cgraphLib.gp_GetProjectVersionFull() * return encoded_version.decode('utf-8') */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_8graphLib_5gp_GetProjectVersionFull(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_8graphLib_4gp_GetProjectVersionFull, "gp_GetProjectVersionFull() -> str"); static PyMethodDef __pyx_mdef_9planarity_4full_8graphLib_5gp_GetProjectVersionFull = {"gp_GetProjectVersionFull", (PyCFunction)__pyx_pw_9planarity_4full_8graphLib_5gp_GetProjectVersionFull, METH_NOARGS, __pyx_doc_9planarity_4full_8graphLib_4gp_GetProjectVersionFull}; static PyObject *__pyx_pw_9planarity_4full_8graphLib_5gp_GetProjectVersionFull(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetProjectVersionFull (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_9planarity_4full_8graphLib_4gp_GetProjectVersionFull(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_8graphLib_4gp_GetProjectVersionFull(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_v_encoded_version = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetProjectVersionFull", 0); /* "planarity/full/graphLib.pyx":122 * * def gp_GetProjectVersionFull() -> str: * cdef bytes encoded_version = cgraphLib.gp_GetProjectVersionFull() # <<<<<<<<<<<<<< * return encoded_version.decode('utf-8') * */ __pyx_t_1 = __Pyx_PyBytes_FromString(gp_GetProjectVersionFull()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_encoded_version = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "planarity/full/graphLib.pyx":123 * def gp_GetProjectVersionFull() -> str: * cdef bytes encoded_version = cgraphLib.gp_GetProjectVersionFull() * return encoded_version.decode('utf-8') # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_decode_bytes(__pyx_v_encoded_version, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graphLib.pyx":121 * * * def gp_GetProjectVersionFull() -> str: # <<<<<<<<<<<<<< * cdef bytes encoded_version = cgraphLib.gp_GetProjectVersionFull() * return encoded_version.decode('utf-8') */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("planarity.full.graphLib.gp_GetProjectVersionFull", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_encoded_version); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graphLib.pyx":126 * * * def gp_GetLibPlanarityVersionFull() -> str: # <<<<<<<<<<<<<< * cdef bytes encoded_version = cgraphLib.gp_GetLibPlanarityVersionFull() * return encoded_version.decode('utf-8') */ /* Python wrapper */ static PyObject *__pyx_pw_9planarity_4full_8graphLib_7gp_GetLibPlanarityVersionFull(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ PyDoc_STRVAR(__pyx_doc_9planarity_4full_8graphLib_6gp_GetLibPlanarityVersionFull, "gp_GetLibPlanarityVersionFull() -> str"); static PyMethodDef __pyx_mdef_9planarity_4full_8graphLib_7gp_GetLibPlanarityVersionFull = {"gp_GetLibPlanarityVersionFull", (PyCFunction)__pyx_pw_9planarity_4full_8graphLib_7gp_GetLibPlanarityVersionFull, METH_NOARGS, __pyx_doc_9planarity_4full_8graphLib_6gp_GetLibPlanarityVersionFull}; static PyObject *__pyx_pw_9planarity_4full_8graphLib_7gp_GetLibPlanarityVersionFull(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gp_GetLibPlanarityVersionFull (wrapper)", 0); __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_9planarity_4full_8graphLib_6gp_GetLibPlanarityVersionFull(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9planarity_4full_8graphLib_6gp_GetLibPlanarityVersionFull(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_v_encoded_version = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gp_GetLibPlanarityVersionFull", 0); /* "planarity/full/graphLib.pyx":127 * * def gp_GetLibPlanarityVersionFull() -> str: * cdef bytes encoded_version = cgraphLib.gp_GetLibPlanarityVersionFull() # <<<<<<<<<<<<<< * return encoded_version.decode('utf-8') * */ __pyx_t_1 = __Pyx_PyBytes_FromString(gp_GetLibPlanarityVersionFull()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_encoded_version = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "planarity/full/graphLib.pyx":128 * def gp_GetLibPlanarityVersionFull() -> str: * cdef bytes encoded_version = cgraphLib.gp_GetLibPlanarityVersionFull() * return encoded_version.decode('utf-8') # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_decode_bytes(__pyx_v_encoded_version, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "planarity/full/graphLib.pyx":126 * * * def gp_GetLibPlanarityVersionFull() -> str: # <<<<<<<<<<<<<< * cdef bytes encoded_version = cgraphLib.gp_GetLibPlanarityVersionFull() * return encoded_version.decode('utf-8') */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("planarity.full.graphLib.gp_GetLibPlanarityVersionFull", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_encoded_version); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "planarity/full/graphLib.pyx":134 * # subpackage's Cython modules * # Wraps functions declared in "planarity/c/graphLib/graph.h": * cdef graphP gp_New(): # <<<<<<<<<<<<<< * return cgraphLib.gp_New() * */ static graphP __pyx_f_9planarity_4full_8graphLib_gp_New(void) { graphP __pyx_r; /* "planarity/full/graphLib.pyx":135 * # Wraps functions declared in "planarity/c/graphLib/graph.h": * cdef graphP gp_New(): * return cgraphLib.gp_New() # <<<<<<<<<<<<<< * * */ __pyx_r = gp_New(); goto __pyx_L0; /* "planarity/full/graphLib.pyx":134 * # subpackage's Cython modules * # Wraps functions declared in "planarity/c/graphLib/graph.h": * cdef graphP gp_New(): # <<<<<<<<<<<<<< * return cgraphLib.gp_New() * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":138 * * * cdef int gp_EnsureVertexCapacity(graphP theGraph, int N): # <<<<<<<<<<<<<< * return cgraphLib.gp_EnsureVertexCapacity(theGraph, N) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_EnsureVertexCapacity(graphP __pyx_v_theGraph, int __pyx_v_N) { int __pyx_r; /* "planarity/full/graphLib.pyx":139 * * cdef int gp_EnsureVertexCapacity(graphP theGraph, int N): * return cgraphLib.gp_EnsureVertexCapacity(theGraph, N) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_EnsureVertexCapacity(__pyx_v_theGraph, __pyx_v_N); goto __pyx_L0; /* "planarity/full/graphLib.pyx":138 * * * cdef int gp_EnsureVertexCapacity(graphP theGraph, int N): # <<<<<<<<<<<<<< * return cgraphLib.gp_EnsureVertexCapacity(theGraph, N) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":142 * * * cdef int gp_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity): # <<<<<<<<<<<<<< * return cgraphLib.gp_EnsureEdgeCapacity(theGraph, requiredEdgeCapacity) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_EnsureEdgeCapacity(graphP __pyx_v_theGraph, int __pyx_v_requiredEdgeCapacity) { int __pyx_r; /* "planarity/full/graphLib.pyx":143 * * cdef int gp_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity): * return cgraphLib.gp_EnsureEdgeCapacity(theGraph, requiredEdgeCapacity) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_EnsureEdgeCapacity(__pyx_v_theGraph, __pyx_v_requiredEdgeCapacity); goto __pyx_L0; /* "planarity/full/graphLib.pyx":142 * * * cdef int gp_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity): # <<<<<<<<<<<<<< * return cgraphLib.gp_EnsureEdgeCapacity(theGraph, requiredEdgeCapacity) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":146 * * * cdef void gp_ResetGraphStorage(graphP theGraph): # <<<<<<<<<<<<<< * cgraphLib.gp_ResetGraphStorage(theGraph) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_ResetGraphStorage(graphP __pyx_v_theGraph) { /* "planarity/full/graphLib.pyx":147 * * cdef void gp_ResetGraphStorage(graphP theGraph): * cgraphLib.gp_ResetGraphStorage(theGraph) # <<<<<<<<<<<<<< * * */ gp_ResetGraphStorage(__pyx_v_theGraph); /* "planarity/full/graphLib.pyx":146 * * * cdef void gp_ResetGraphStorage(graphP theGraph): # <<<<<<<<<<<<<< * cgraphLib.gp_ResetGraphStorage(theGraph) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":150 * * * cdef void gp_Free(graphP *pGraph): # <<<<<<<<<<<<<< * cgraphLib.gp_Free(pGraph) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_Free(graphP *__pyx_v_pGraph) { /* "planarity/full/graphLib.pyx":151 * * cdef void gp_Free(graphP *pGraph): * cgraphLib.gp_Free(pGraph) # <<<<<<<<<<<<<< * * */ gp_Free(__pyx_v_pGraph); /* "planarity/full/graphLib.pyx":150 * * * cdef void gp_Free(graphP *pGraph): # <<<<<<<<<<<<<< * cgraphLib.gp_Free(pGraph) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":154 * * * cdef int gp_GetN(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetN(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetN(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":155 * * cdef int gp_GetN(graphP theGraph): * return cgraphLib.gp_GetN(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetN(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":154 * * * cdef int gp_GetN(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetN(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":158 * * * cdef int gp_GetNV(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetNV(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetNV(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":159 * * cdef int gp_GetNV(graphP theGraph): * return cgraphLib.gp_GetNV(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetNV(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":158 * * * cdef int gp_GetNV(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetNV(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":162 * * * cdef int gp_GetM(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetM(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetM(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":163 * * cdef int gp_GetM(graphP theGraph): * return cgraphLib.gp_GetM(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetM(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":162 * * * cdef int gp_GetM(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetM(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":166 * * * cdef int gp_GetEdgeCapacity(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetEdgeCapacity(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetEdgeCapacity(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":167 * * cdef int gp_GetEdgeCapacity(graphP theGraph): * return cgraphLib.gp_GetEdgeCapacity(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetEdgeCapacity(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":166 * * * cdef int gp_GetEdgeCapacity(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetEdgeCapacity(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":170 * * * cdef int gp_CopyGraph(graphP dstGraph, graphP srcGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_CopyGraph(dstGraph, srcGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_CopyGraph(graphP __pyx_v_dstGraph, graphP __pyx_v_srcGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":171 * * cdef int gp_CopyGraph(graphP dstGraph, graphP srcGraph): * return cgraphLib.gp_CopyGraph(dstGraph, srcGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_CopyGraph(__pyx_v_dstGraph, __pyx_v_srcGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":170 * * * cdef int gp_CopyGraph(graphP dstGraph, graphP srcGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_CopyGraph(dstGraph, srcGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":174 * * * cdef graphP gp_DupGraph(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_DupGraph(theGraph) * */ static graphP __pyx_f_9planarity_4full_8graphLib_gp_DupGraph(graphP __pyx_v_theGraph) { graphP __pyx_r; /* "planarity/full/graphLib.pyx":175 * * cdef graphP gp_DupGraph(graphP theGraph): * return cgraphLib.gp_DupGraph(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_DupGraph(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":174 * * * cdef graphP gp_DupGraph(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_DupGraph(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":178 * * * cdef int gp_CopyAdjacencyLists(graphP dstGraph, graphP srcGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_CopyAdjacencyLists(dstGraph, srcGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_CopyAdjacencyLists(graphP __pyx_v_dstGraph, graphP __pyx_v_srcGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":179 * * cdef int gp_CopyAdjacencyLists(graphP dstGraph, graphP srcGraph): * return cgraphLib.gp_CopyAdjacencyLists(dstGraph, srcGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_CopyAdjacencyLists(__pyx_v_dstGraph, __pyx_v_srcGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":178 * * * cdef int gp_CopyAdjacencyLists(graphP dstGraph, graphP srcGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_CopyAdjacencyLists(dstGraph, srcGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":182 * * * cdef int gp_CreateRandomGraph(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_CreateRandomGraph(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_CreateRandomGraph(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":183 * * cdef int gp_CreateRandomGraph(graphP theGraph): * return cgraphLib.gp_CreateRandomGraph(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_CreateRandomGraph(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":182 * * * cdef int gp_CreateRandomGraph(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_CreateRandomGraph(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":186 * * * cdef int gp_CreateRandomGraphEx(graphP theGraph, int numEdges): # <<<<<<<<<<<<<< * return cgraphLib.gp_CreateRandomGraphEx(theGraph, numEdges) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_CreateRandomGraphEx(graphP __pyx_v_theGraph, int __pyx_v_numEdges) { int __pyx_r; /* "planarity/full/graphLib.pyx":187 * * cdef int gp_CreateRandomGraphEx(graphP theGraph, int numEdges): * return cgraphLib.gp_CreateRandomGraphEx(theGraph, numEdges) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_CreateRandomGraphEx(__pyx_v_theGraph, __pyx_v_numEdges); goto __pyx_L0; /* "planarity/full/graphLib.pyx":186 * * * cdef int gp_CreateRandomGraphEx(graphP theGraph, int numEdges): # <<<<<<<<<<<<<< * return cgraphLib.gp_CreateRandomGraphEx(theGraph, numEdges) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":190 * * * cdef int gp_IsNeighbor(graphP theGraph, int u, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsNeighbor(theGraph, u, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_IsNeighbor(graphP __pyx_v_theGraph, int __pyx_v_u, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":191 * * cdef int gp_IsNeighbor(graphP theGraph, int u, int v): * return cgraphLib.gp_IsNeighbor(theGraph, u, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_IsNeighbor(__pyx_v_theGraph, __pyx_v_u, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":190 * * * cdef int gp_IsNeighbor(graphP theGraph, int u, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsNeighbor(theGraph, u, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":194 * * * cdef int gp_FindEdge(graphP theGraph, int u, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_FindEdge(theGraph, u, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_FindEdge(graphP __pyx_v_theGraph, int __pyx_v_u, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":195 * * cdef int gp_FindEdge(graphP theGraph, int u, int v): * return cgraphLib.gp_FindEdge(theGraph, u, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_FindEdge(__pyx_v_theGraph, __pyx_v_u, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":194 * * * cdef int gp_FindEdge(graphP theGraph, int u, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_FindEdge(theGraph, u, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":198 * * * cdef int gp_GetVertexDegree(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetVertexDegree(theGraph, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetVertexDegree(graphP __pyx_v_theGraph, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":199 * * cdef int gp_GetVertexDegree(graphP theGraph, int v): * return cgraphLib.gp_GetVertexDegree(theGraph, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetVertexDegree(__pyx_v_theGraph, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":198 * * * cdef int gp_GetVertexDegree(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetVertexDegree(theGraph, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":202 * * * cdef int gp_IsNeighborDirected(graphP theGraph, int u, int v, unsigned direction): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsNeighborDirected(theGraph, u, v, direction) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_IsNeighborDirected(graphP __pyx_v_theGraph, int __pyx_v_u, int __pyx_v_v, unsigned int __pyx_v_direction) { int __pyx_r; /* "planarity/full/graphLib.pyx":203 * * cdef int gp_IsNeighborDirected(graphP theGraph, int u, int v, unsigned direction): * return cgraphLib.gp_IsNeighborDirected(theGraph, u, v, direction) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_IsNeighborDirected(__pyx_v_theGraph, __pyx_v_u, __pyx_v_v, __pyx_v_direction); goto __pyx_L0; /* "planarity/full/graphLib.pyx":202 * * * cdef int gp_IsNeighborDirected(graphP theGraph, int u, int v, unsigned direction): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsNeighborDirected(theGraph, u, v, direction) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":206 * * * cdef int gp_FindDirectedEdge(graphP theGraph, int u, int v, unsigned direction): # <<<<<<<<<<<<<< * return cgraphLib.gp_FindDirectedEdge(theGraph, u, v, direction) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_FindDirectedEdge(graphP __pyx_v_theGraph, int __pyx_v_u, int __pyx_v_v, unsigned int __pyx_v_direction) { int __pyx_r; /* "planarity/full/graphLib.pyx":207 * * cdef int gp_FindDirectedEdge(graphP theGraph, int u, int v, unsigned direction): * return cgraphLib.gp_FindDirectedEdge(theGraph, u, v, direction) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_FindDirectedEdge(__pyx_v_theGraph, __pyx_v_u, __pyx_v_v, __pyx_v_direction); goto __pyx_L0; /* "planarity/full/graphLib.pyx":206 * * * cdef int gp_FindDirectedEdge(graphP theGraph, int u, int v, unsigned direction): # <<<<<<<<<<<<<< * return cgraphLib.gp_FindDirectedEdge(theGraph, u, v, direction) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":210 * * * cdef int gp_GetVertexInDegree(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetVertexInDegree(theGraph, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetVertexInDegree(graphP __pyx_v_theGraph, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":211 * * cdef int gp_GetVertexInDegree(graphP theGraph, int v): * return cgraphLib.gp_GetVertexInDegree(theGraph, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetVertexInDegree(__pyx_v_theGraph, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":210 * * * cdef int gp_GetVertexInDegree(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetVertexInDegree(theGraph, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":214 * * * cdef int gp_GetVertexOutDegree(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetVertexOutDegree(theGraph, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetVertexOutDegree(graphP __pyx_v_theGraph, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":215 * * cdef int gp_GetVertexOutDegree(graphP theGraph, int v): * return cgraphLib.gp_GetVertexOutDegree(theGraph, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetVertexOutDegree(__pyx_v_theGraph, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":214 * * * cdef int gp_GetVertexOutDegree(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetVertexOutDegree(theGraph, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":218 * * * cdef int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink): # <<<<<<<<<<<<<< * return cgraphLib.gp_AddEdge(theGraph, u, ulink, v, vlink) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_AddEdge(graphP __pyx_v_theGraph, int __pyx_v_u, int __pyx_v_ulink, int __pyx_v_v, int __pyx_v_vlink) { int __pyx_r; /* "planarity/full/graphLib.pyx":219 * * cdef int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink): * return cgraphLib.gp_AddEdge(theGraph, u, ulink, v, vlink) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_AddEdge(__pyx_v_theGraph, __pyx_v_u, __pyx_v_ulink, __pyx_v_v, __pyx_v_vlink); goto __pyx_L0; /* "planarity/full/graphLib.pyx":218 * * * cdef int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink): # <<<<<<<<<<<<<< * return cgraphLib.gp_AddEdge(theGraph, u, ulink, v, vlink) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":222 * * * cdef int gp_DynamicAddEdge(graphP theGraph, int u, int ulink, int v, int vlink): # <<<<<<<<<<<<<< * return cgraphLib.gp_DynamicAddEdge(theGraph, u, ulink, v, vlink) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_DynamicAddEdge(graphP __pyx_v_theGraph, int __pyx_v_u, int __pyx_v_ulink, int __pyx_v_v, int __pyx_v_vlink) { int __pyx_r; /* "planarity/full/graphLib.pyx":223 * * cdef int gp_DynamicAddEdge(graphP theGraph, int u, int ulink, int v, int vlink): * return cgraphLib.gp_DynamicAddEdge(theGraph, u, ulink, v, vlink) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_DynamicAddEdge(__pyx_v_theGraph, __pyx_v_u, __pyx_v_ulink, __pyx_v_v, __pyx_v_vlink); goto __pyx_L0; /* "planarity/full/graphLib.pyx":222 * * * cdef int gp_DynamicAddEdge(graphP theGraph, int u, int ulink, int v, int vlink): # <<<<<<<<<<<<<< * return cgraphLib.gp_DynamicAddEdge(theGraph, u, ulink, v, vlink) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":226 * * * cdef int gp_InsertEdge(graphP theGraph, int u, int e_u, int e_ulink, int v, int e_v, int e_vlink): # <<<<<<<<<<<<<< * return cgraphLib.gp_InsertEdge(theGraph, u, e_u, e_ulink, v, e_v, e_vlink) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_InsertEdge(graphP __pyx_v_theGraph, int __pyx_v_u, int __pyx_v_e_u, int __pyx_v_e_ulink, int __pyx_v_v, int __pyx_v_e_v, int __pyx_v_e_vlink) { int __pyx_r; /* "planarity/full/graphLib.pyx":227 * * cdef int gp_InsertEdge(graphP theGraph, int u, int e_u, int e_ulink, int v, int e_v, int e_vlink): * return cgraphLib.gp_InsertEdge(theGraph, u, e_u, e_ulink, v, e_v, e_vlink) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_InsertEdge(__pyx_v_theGraph, __pyx_v_u, __pyx_v_e_u, __pyx_v_e_ulink, __pyx_v_v, __pyx_v_e_v, __pyx_v_e_vlink); goto __pyx_L0; /* "planarity/full/graphLib.pyx":226 * * * cdef int gp_InsertEdge(graphP theGraph, int u, int e_u, int e_ulink, int v, int e_v, int e_vlink): # <<<<<<<<<<<<<< * return cgraphLib.gp_InsertEdge(theGraph, u, e_u, e_ulink, v, e_v, e_vlink) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":230 * * * cdef int gp_DeleteEdge(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_DeleteEdge(theGraph, e) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_DeleteEdge(graphP __pyx_v_theGraph, int __pyx_v_e) { int __pyx_r; /* "planarity/full/graphLib.pyx":231 * * cdef int gp_DeleteEdge(graphP theGraph, int e): * return cgraphLib.gp_DeleteEdge(theGraph, e) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_DeleteEdge(__pyx_v_theGraph, __pyx_v_e); goto __pyx_L0; /* "planarity/full/graphLib.pyx":230 * * * cdef int gp_DeleteEdge(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_DeleteEdge(theGraph, e) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":234 * * * cdef void gp_HideEdge(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_HideEdge(theGraph, e) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_HideEdge(graphP __pyx_v_theGraph, int __pyx_v_e) { /* "planarity/full/graphLib.pyx":235 * * cdef void gp_HideEdge(graphP theGraph, int e): * cgraphLib.gp_HideEdge(theGraph, e) # <<<<<<<<<<<<<< * * */ gp_HideEdge(__pyx_v_theGraph, __pyx_v_e); /* "planarity/full/graphLib.pyx":234 * * * cdef void gp_HideEdge(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_HideEdge(theGraph, e) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":238 * * * cdef void gp_RestoreEdge(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_RestoreEdge(theGraph, e) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_RestoreEdge(graphP __pyx_v_theGraph, int __pyx_v_e) { /* "planarity/full/graphLib.pyx":239 * * cdef void gp_RestoreEdge(graphP theGraph, int e): * cgraphLib.gp_RestoreEdge(theGraph, e) # <<<<<<<<<<<<<< * * */ gp_RestoreEdge(__pyx_v_theGraph, __pyx_v_e); /* "planarity/full/graphLib.pyx":238 * * * cdef void gp_RestoreEdge(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_RestoreEdge(theGraph, e) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":242 * * * cdef int gp_HideVertex(graphP theGraph, int vertex): # <<<<<<<<<<<<<< * return cgraphLib.gp_HideVertex(theGraph, vertex) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_HideVertex(graphP __pyx_v_theGraph, int __pyx_v_vertex) { int __pyx_r; /* "planarity/full/graphLib.pyx":243 * * cdef int gp_HideVertex(graphP theGraph, int vertex): * return cgraphLib.gp_HideVertex(theGraph, vertex) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_HideVertex(__pyx_v_theGraph, __pyx_v_vertex); goto __pyx_L0; /* "planarity/full/graphLib.pyx":242 * * * cdef int gp_HideVertex(graphP theGraph, int vertex): # <<<<<<<<<<<<<< * return cgraphLib.gp_HideVertex(theGraph, vertex) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":246 * * * cdef int gp_RestoreVertex(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_RestoreVertex(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_RestoreVertex(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":247 * * cdef int gp_RestoreVertex(graphP theGraph): * return cgraphLib.gp_RestoreVertex(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_RestoreVertex(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":246 * * * cdef int gp_RestoreVertex(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_RestoreVertex(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":250 * * * cdef int gp_ContractEdge(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_ContractEdge(theGraph, e) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_ContractEdge(graphP __pyx_v_theGraph, int __pyx_v_e) { int __pyx_r; /* "planarity/full/graphLib.pyx":251 * * cdef int gp_ContractEdge(graphP theGraph, int e): * return cgraphLib.gp_ContractEdge(theGraph, e) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_ContractEdge(__pyx_v_theGraph, __pyx_v_e); goto __pyx_L0; /* "planarity/full/graphLib.pyx":250 * * * cdef int gp_ContractEdge(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_ContractEdge(theGraph, e) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":254 * * * cdef int gp_IdentifyVertices(graphP theGraph, int u, int v, int eBefore): # <<<<<<<<<<<<<< * return cgraphLib.gp_IdentifyVertices(theGraph, u, v, eBefore) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_IdentifyVertices(graphP __pyx_v_theGraph, int __pyx_v_u, int __pyx_v_v, int __pyx_v_eBefore) { int __pyx_r; /* "planarity/full/graphLib.pyx":255 * * cdef int gp_IdentifyVertices(graphP theGraph, int u, int v, int eBefore): * return cgraphLib.gp_IdentifyVertices(theGraph, u, v, eBefore) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_IdentifyVertices(__pyx_v_theGraph, __pyx_v_u, __pyx_v_v, __pyx_v_eBefore); goto __pyx_L0; /* "planarity/full/graphLib.pyx":254 * * * cdef int gp_IdentifyVertices(graphP theGraph, int u, int v, int eBefore): # <<<<<<<<<<<<<< * return cgraphLib.gp_IdentifyVertices(theGraph, u, v, eBefore) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":258 * * * cdef int gp_RestoreVertices(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_RestoreVertices(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_RestoreVertices(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":259 * * cdef int gp_RestoreVertices(graphP theGraph): * return cgraphLib.gp_RestoreVertices(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_RestoreVertices(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":258 * * * cdef int gp_RestoreVertices(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_RestoreVertices(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":262 * * * cdef int gp_GetGraphFlags(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetGraphFlags(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetGraphFlags(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":263 * * cdef int gp_GetGraphFlags(graphP theGraph): * return cgraphLib.gp_GetGraphFlags(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetGraphFlags(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":262 * * * cdef int gp_GetGraphFlags(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetGraphFlags(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":266 * * * cdef int gp_GetFirstEdge(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetFirstEdge(theGraph, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetFirstEdge(graphP __pyx_v_theGraph, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":267 * * cdef int gp_GetFirstEdge(graphP theGraph, int v): * return cgraphLib.gp_GetFirstEdge(theGraph, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetFirstEdge(__pyx_v_theGraph, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":266 * * * cdef int gp_GetFirstEdge(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetFirstEdge(theGraph, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":270 * * * cdef int gp_GetLastEdge(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetLastEdge(theGraph, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetLastEdge(graphP __pyx_v_theGraph, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":271 * * cdef int gp_GetLastEdge(graphP theGraph, int v): * return cgraphLib.gp_GetLastEdge(theGraph, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetLastEdge(__pyx_v_theGraph, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":270 * * * cdef int gp_GetLastEdge(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetLastEdge(theGraph, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":274 * * * cdef int gp_GetEdgeByLink(graphP theGraph, int v, int theLink): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetEdgeByLink(theGraph, v, theLink) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetEdgeByLink(graphP __pyx_v_theGraph, int __pyx_v_v, int __pyx_v_theLink) { int __pyx_r; /* "planarity/full/graphLib.pyx":275 * * cdef int gp_GetEdgeByLink(graphP theGraph, int v, int theLink): * return cgraphLib.gp_GetEdgeByLink(theGraph, v, theLink) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetEdgeByLink(__pyx_v_theGraph, __pyx_v_v, __pyx_v_theLink); goto __pyx_L0; /* "planarity/full/graphLib.pyx":274 * * * cdef int gp_GetEdgeByLink(graphP theGraph, int v, int theLink): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetEdgeByLink(theGraph, v, theLink) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":278 * * * cdef void gp_SetFirstEdge(graphP theGraph, int v, int newFirstEdge): # <<<<<<<<<<<<<< * cgraphLib.gp_SetFirstEdge(theGraph, v, newFirstEdge) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_SetFirstEdge(graphP __pyx_v_theGraph, int __pyx_v_v, int __pyx_v_newFirstEdge) { /* "planarity/full/graphLib.pyx":279 * * cdef void gp_SetFirstEdge(graphP theGraph, int v, int newFirstEdge): * cgraphLib.gp_SetFirstEdge(theGraph, v, newFirstEdge) # <<<<<<<<<<<<<< * * */ gp_SetFirstEdge(__pyx_v_theGraph, __pyx_v_v, __pyx_v_newFirstEdge); /* "planarity/full/graphLib.pyx":278 * * * cdef void gp_SetFirstEdge(graphP theGraph, int v, int newFirstEdge): # <<<<<<<<<<<<<< * cgraphLib.gp_SetFirstEdge(theGraph, v, newFirstEdge) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":282 * * * cdef void gp_SetLastEdge(graphP theGraph, int v, int newLastEdge): # <<<<<<<<<<<<<< * cgraphLib.gp_SetLastEdge(theGraph, v, newLastEdge) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_SetLastEdge(graphP __pyx_v_theGraph, int __pyx_v_v, int __pyx_v_newLastEdge) { /* "planarity/full/graphLib.pyx":283 * * cdef void gp_SetLastEdge(graphP theGraph, int v, int newLastEdge): * cgraphLib.gp_SetLastEdge(theGraph, v, newLastEdge) # <<<<<<<<<<<<<< * * */ gp_SetLastEdge(__pyx_v_theGraph, __pyx_v_v, __pyx_v_newLastEdge); /* "planarity/full/graphLib.pyx":282 * * * cdef void gp_SetLastEdge(graphP theGraph, int v, int newLastEdge): # <<<<<<<<<<<<<< * cgraphLib.gp_SetLastEdge(theGraph, v, newLastEdge) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":286 * * * cdef void gp_SetEdgeByLink(graphP theGraph, int v, int theLink, int newEdge): # <<<<<<<<<<<<<< * cgraphLib.gp_SetEdgeByLink(theGraph, v, theLink, newEdge) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_SetEdgeByLink(graphP __pyx_v_theGraph, int __pyx_v_v, int __pyx_v_theLink, int __pyx_v_newEdge) { /* "planarity/full/graphLib.pyx":287 * * cdef void gp_SetEdgeByLink(graphP theGraph, int v, int theLink, int newEdge): * cgraphLib.gp_SetEdgeByLink(theGraph, v, theLink, newEdge) # <<<<<<<<<<<<<< * * */ gp_SetEdgeByLink(__pyx_v_theGraph, __pyx_v_v, __pyx_v_theLink, __pyx_v_newEdge); /* "planarity/full/graphLib.pyx":286 * * * cdef void gp_SetEdgeByLink(graphP theGraph, int v, int theLink, int newEdge): # <<<<<<<<<<<<<< * cgraphLib.gp_SetEdgeByLink(theGraph, v, theLink, newEdge) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":290 * * * cdef int gp_LowerBoundVertices(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_LowerBoundVertices(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_LowerBoundVertices(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":291 * * cdef int gp_LowerBoundVertices(graphP theGraph): * return cgraphLib.gp_LowerBoundVertices(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_LowerBoundVertices(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":290 * * * cdef int gp_LowerBoundVertices(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_LowerBoundVertices(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":294 * * * cdef int gp_UpperBoundVertices(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_UpperBoundVertices(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_UpperBoundVertices(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":295 * * cdef int gp_UpperBoundVertices(graphP theGraph): * return cgraphLib.gp_UpperBoundVertices(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_UpperBoundVertices(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":294 * * * cdef int gp_UpperBoundVertices(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_UpperBoundVertices(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":298 * * * cdef int gp_LowerBoundVirtualVertices(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_LowerBoundVirtualVertices(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_LowerBoundVirtualVertices(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":299 * * cdef int gp_LowerBoundVirtualVertices(graphP theGraph): * return cgraphLib.gp_LowerBoundVirtualVertices(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_LowerBoundVirtualVertices(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":298 * * * cdef int gp_LowerBoundVirtualVertices(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_LowerBoundVirtualVertices(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":302 * * * cdef int gp_UpperBoundVirtualVertices(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_UpperBoundVirtualVertices(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_UpperBoundVirtualVertices(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":303 * * cdef int gp_UpperBoundVirtualVertices(graphP theGraph): * return cgraphLib.gp_UpperBoundVirtualVertices(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_UpperBoundVirtualVertices(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":302 * * * cdef int gp_UpperBoundVirtualVertices(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_UpperBoundVirtualVertices(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":306 * * * cdef int gp_LowerBoundVertexStorage(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_LowerBoundVertexStorage(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_LowerBoundVertexStorage(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":307 * * cdef int gp_LowerBoundVertexStorage(graphP theGraph): * return cgraphLib.gp_LowerBoundVertexStorage(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_LowerBoundVertexStorage(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":306 * * * cdef int gp_LowerBoundVertexStorage(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_LowerBoundVertexStorage(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":310 * * * cdef int gp_UpperBoundVertexStorage(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_UpperBoundVertexStorage(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_UpperBoundVertexStorage(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":311 * * cdef int gp_UpperBoundVertexStorage(graphP theGraph): * return cgraphLib.gp_UpperBoundVertexStorage(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_UpperBoundVertexStorage(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":310 * * * cdef int gp_UpperBoundVertexStorage(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_UpperBoundVertexStorage(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":314 * * * cdef int gp_IsVertex(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsVertex(theGraph, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_IsVertex(graphP __pyx_v_theGraph, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":315 * * cdef int gp_IsVertex(graphP theGraph, int v): * return cgraphLib.gp_IsVertex(theGraph, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_IsVertex(__pyx_v_theGraph, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":314 * * * cdef int gp_IsVertex(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsVertex(theGraph, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":318 * * * cdef int gp_IsVirtualVertex(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsVirtualVertex(theGraph, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_IsVirtualVertex(graphP __pyx_v_theGraph, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":319 * * cdef int gp_IsVirtualVertex(graphP theGraph, int v): * return cgraphLib.gp_IsVirtualVertex(theGraph, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_IsVirtualVertex(__pyx_v_theGraph, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":318 * * * cdef int gp_IsVirtualVertex(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsVirtualVertex(theGraph, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":322 * * * cdef int gp_IsNotVertex(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsNotVertex(theGraph, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_IsNotVertex(graphP __pyx_v_theGraph, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":323 * * cdef int gp_IsNotVertex(graphP theGraph, int v): * return cgraphLib.gp_IsNotVertex(theGraph, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_IsNotVertex(__pyx_v_theGraph, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":322 * * * cdef int gp_IsNotVertex(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsNotVertex(theGraph, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":326 * * * cdef int gp_IsNotVirtualVertex(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsNotVirtualVertex(theGraph, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_IsNotVirtualVertex(graphP __pyx_v_theGraph, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":327 * * cdef int gp_IsNotVirtualVertex(graphP theGraph, int v): * return cgraphLib.gp_IsNotVirtualVertex(theGraph, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_IsNotVirtualVertex(__pyx_v_theGraph, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":326 * * * cdef int gp_IsNotVirtualVertex(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsNotVirtualVertex(theGraph, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":330 * * * cdef int gp_VirtualVertexInUse(graphP theGraph, int virtualVertex): # <<<<<<<<<<<<<< * return cgraphLib.gp_VirtualVertexInUse(theGraph, virtualVertex) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_VirtualVertexInUse(graphP __pyx_v_theGraph, int __pyx_v_virtualVertex) { int __pyx_r; /* "planarity/full/graphLib.pyx":331 * * cdef int gp_VirtualVertexInUse(graphP theGraph, int virtualVertex): * return cgraphLib.gp_VirtualVertexInUse(theGraph, virtualVertex) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_VirtualVertexInUse(__pyx_v_theGraph, __pyx_v_virtualVertex); goto __pyx_L0; /* "planarity/full/graphLib.pyx":330 * * * cdef int gp_VirtualVertexInUse(graphP theGraph, int virtualVertex): # <<<<<<<<<<<<<< * return cgraphLib.gp_VirtualVertexInUse(theGraph, virtualVertex) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":334 * * * cdef int gp_VirtualVertexNotInUse(graphP theGraph, int virtualVertex): # <<<<<<<<<<<<<< * return cgraphLib.gp_VirtualVertexNotInUse(theGraph, virtualVertex) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_VirtualVertexNotInUse(graphP __pyx_v_theGraph, int __pyx_v_virtualVertex) { int __pyx_r; /* "planarity/full/graphLib.pyx":335 * * cdef int gp_VirtualVertexNotInUse(graphP theGraph, int virtualVertex): * return cgraphLib.gp_VirtualVertexNotInUse(theGraph, virtualVertex) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_VirtualVertexNotInUse(__pyx_v_theGraph, __pyx_v_virtualVertex); goto __pyx_L0; /* "planarity/full/graphLib.pyx":334 * * * cdef int gp_VirtualVertexNotInUse(graphP theGraph, int virtualVertex): # <<<<<<<<<<<<<< * return cgraphLib.gp_VirtualVertexNotInUse(theGraph, virtualVertex) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":338 * * * cdef int gp_GetIndex(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetIndex(theGraph, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetIndex(graphP __pyx_v_theGraph, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":339 * * cdef int gp_GetIndex(graphP theGraph, int v): * return cgraphLib.gp_GetIndex(theGraph, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetIndex(__pyx_v_theGraph, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":338 * * * cdef int gp_GetIndex(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetIndex(theGraph, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":342 * * * cdef void gp_SetIndex(graphP theGraph, int v, int theIndex): # <<<<<<<<<<<<<< * cgraphLib.gp_SetIndex(theGraph, v, theIndex) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_SetIndex(graphP __pyx_v_theGraph, int __pyx_v_v, int __pyx_v_theIndex) { /* "planarity/full/graphLib.pyx":343 * * cdef void gp_SetIndex(graphP theGraph, int v, int theIndex): * cgraphLib.gp_SetIndex(theGraph, v, theIndex) # <<<<<<<<<<<<<< * * */ gp_SetIndex(__pyx_v_theGraph, __pyx_v_v, __pyx_v_theIndex); /* "planarity/full/graphLib.pyx":342 * * * cdef void gp_SetIndex(graphP theGraph, int v, int theIndex): # <<<<<<<<<<<<<< * cgraphLib.gp_SetIndex(theGraph, v, theIndex) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":346 * * * cdef void gp_InitFlags(graphP theGraph, int v): # <<<<<<<<<<<<<< * cgraphLib.gp_InitFlags(theGraph, v) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_InitFlags(graphP __pyx_v_theGraph, int __pyx_v_v) { /* "planarity/full/graphLib.pyx":347 * * cdef void gp_InitFlags(graphP theGraph, int v): * cgraphLib.gp_InitFlags(theGraph, v) # <<<<<<<<<<<<<< * * */ gp_InitFlags(__pyx_v_theGraph, __pyx_v_v); /* "planarity/full/graphLib.pyx":346 * * * cdef void gp_InitFlags(graphP theGraph, int v): # <<<<<<<<<<<<<< * cgraphLib.gp_InitFlags(theGraph, v) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":350 * * * cdef int gp_GetVisited(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetVisited(theGraph, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetVisited(graphP __pyx_v_theGraph, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":351 * * cdef int gp_GetVisited(graphP theGraph, int v): * return cgraphLib.gp_GetVisited(theGraph, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetVisited(__pyx_v_theGraph, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":350 * * * cdef int gp_GetVisited(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetVisited(theGraph, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":354 * * * cdef void gp_ClearVisited(graphP theGraph, int v): # <<<<<<<<<<<<<< * cgraphLib.gp_ClearVisited(theGraph, v) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_ClearVisited(graphP __pyx_v_theGraph, int __pyx_v_v) { /* "planarity/full/graphLib.pyx":355 * * cdef void gp_ClearVisited(graphP theGraph, int v): * cgraphLib.gp_ClearVisited(theGraph, v) # <<<<<<<<<<<<<< * * */ gp_ClearVisited(__pyx_v_theGraph, __pyx_v_v); /* "planarity/full/graphLib.pyx":354 * * * cdef void gp_ClearVisited(graphP theGraph, int v): # <<<<<<<<<<<<<< * cgraphLib.gp_ClearVisited(theGraph, v) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":358 * * * cdef void gp_SetVisited(graphP theGraph, int v): # <<<<<<<<<<<<<< * cgraphLib.gp_SetVisited(theGraph, v) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_SetVisited(graphP __pyx_v_theGraph, int __pyx_v_v) { /* "planarity/full/graphLib.pyx":359 * * cdef void gp_SetVisited(graphP theGraph, int v): * cgraphLib.gp_SetVisited(theGraph, v) # <<<<<<<<<<<<<< * * */ gp_SetVisited(__pyx_v_theGraph, __pyx_v_v); /* "planarity/full/graphLib.pyx":358 * * * cdef void gp_SetVisited(graphP theGraph, int v): # <<<<<<<<<<<<<< * cgraphLib.gp_SetVisited(theGraph, v) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":362 * * * cdef int gp_GetMarked(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetMarked(theGraph, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetMarked(graphP __pyx_v_theGraph, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":363 * * cdef int gp_GetMarked(graphP theGraph, int v): * return cgraphLib.gp_GetMarked(theGraph, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetMarked(__pyx_v_theGraph, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":362 * * * cdef int gp_GetMarked(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetMarked(theGraph, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":366 * * * cdef void gp_ClearMarked(graphP theGraph, int v): # <<<<<<<<<<<<<< * cgraphLib.gp_ClearMarked(theGraph, v) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_ClearMarked(graphP __pyx_v_theGraph, int __pyx_v_v) { /* "planarity/full/graphLib.pyx":367 * * cdef void gp_ClearMarked(graphP theGraph, int v): * cgraphLib.gp_ClearMarked(theGraph, v) # <<<<<<<<<<<<<< * * */ gp_ClearMarked(__pyx_v_theGraph, __pyx_v_v); /* "planarity/full/graphLib.pyx":366 * * * cdef void gp_ClearMarked(graphP theGraph, int v): # <<<<<<<<<<<<<< * cgraphLib.gp_ClearMarked(theGraph, v) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":370 * * * cdef void gp_SetMarked(graphP theGraph, int v): # <<<<<<<<<<<<<< * cgraphLib.gp_SetMarked(theGraph, v) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_SetMarked(graphP __pyx_v_theGraph, int __pyx_v_v) { /* "planarity/full/graphLib.pyx":371 * * cdef void gp_SetMarked(graphP theGraph, int v): * cgraphLib.gp_SetMarked(theGraph, v) # <<<<<<<<<<<<<< * * */ gp_SetMarked(__pyx_v_theGraph, __pyx_v_v); /* "planarity/full/graphLib.pyx":370 * * * cdef void gp_SetMarked(graphP theGraph, int v): # <<<<<<<<<<<<<< * cgraphLib.gp_SetMarked(theGraph, v) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":374 * * * cdef int gp_GetTwin(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetTwin(theGraph, e) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetTwin(graphP __pyx_v_theGraph, int __pyx_v_e) { int __pyx_r; /* "planarity/full/graphLib.pyx":375 * * cdef int gp_GetTwin(graphP theGraph, int e): * return cgraphLib.gp_GetTwin(theGraph, e) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetTwin(__pyx_v_theGraph, __pyx_v_e); goto __pyx_L0; /* "planarity/full/graphLib.pyx":374 * * * cdef int gp_GetTwin(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetTwin(theGraph, e) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":378 * * * cdef int gp_GetNextEdge(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetNextEdge(theGraph, e) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetNextEdge(graphP __pyx_v_theGraph, int __pyx_v_e) { int __pyx_r; /* "planarity/full/graphLib.pyx":379 * * cdef int gp_GetNextEdge(graphP theGraph, int e): * return cgraphLib.gp_GetNextEdge(theGraph, e) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetNextEdge(__pyx_v_theGraph, __pyx_v_e); goto __pyx_L0; /* "planarity/full/graphLib.pyx":378 * * * cdef int gp_GetNextEdge(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetNextEdge(theGraph, e) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":382 * * * cdef int gp_GetPrevEdge(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetPrevEdge(theGraph, e) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetPrevEdge(graphP __pyx_v_theGraph, int __pyx_v_e) { int __pyx_r; /* "planarity/full/graphLib.pyx":383 * * cdef int gp_GetPrevEdge(graphP theGraph, int e): * return cgraphLib.gp_GetPrevEdge(theGraph, e) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetPrevEdge(__pyx_v_theGraph, __pyx_v_e); goto __pyx_L0; /* "planarity/full/graphLib.pyx":382 * * * cdef int gp_GetPrevEdge(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetPrevEdge(theGraph, e) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":386 * * * cdef int gp_GetAdjacentEdge(graphP theGraph, int e, int theLink): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetAdjacentEdge(theGraph, e, theLink) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetAdjacentEdge(graphP __pyx_v_theGraph, int __pyx_v_e, int __pyx_v_theLink) { int __pyx_r; /* "planarity/full/graphLib.pyx":387 * * cdef int gp_GetAdjacentEdge(graphP theGraph, int e, int theLink): * return cgraphLib.gp_GetAdjacentEdge(theGraph, e, theLink) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetAdjacentEdge(__pyx_v_theGraph, __pyx_v_e, __pyx_v_theLink); goto __pyx_L0; /* "planarity/full/graphLib.pyx":386 * * * cdef int gp_GetAdjacentEdge(graphP theGraph, int e, int theLink): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetAdjacentEdge(theGraph, e, theLink) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":390 * * * cdef void gp_SetNextEdge(graphP theGraph, int e, int newNextEdge): # <<<<<<<<<<<<<< * cgraphLib.gp_SetNextEdge(theGraph, e, newNextEdge) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_SetNextEdge(graphP __pyx_v_theGraph, int __pyx_v_e, int __pyx_v_newNextEdge) { /* "planarity/full/graphLib.pyx":391 * * cdef void gp_SetNextEdge(graphP theGraph, int e, int newNextEdge): * cgraphLib.gp_SetNextEdge(theGraph, e, newNextEdge) # <<<<<<<<<<<<<< * * */ gp_SetNextEdge(__pyx_v_theGraph, __pyx_v_e, __pyx_v_newNextEdge); /* "planarity/full/graphLib.pyx":390 * * * cdef void gp_SetNextEdge(graphP theGraph, int e, int newNextEdge): # <<<<<<<<<<<<<< * cgraphLib.gp_SetNextEdge(theGraph, e, newNextEdge) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":394 * * * cdef void gp_SetPrevEdge(graphP theGraph, int e, int newPrevEdge): # <<<<<<<<<<<<<< * cgraphLib.gp_SetPrevEdge(theGraph, e, newPrevEdge) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_SetPrevEdge(graphP __pyx_v_theGraph, int __pyx_v_e, int __pyx_v_newPrevEdge) { /* "planarity/full/graphLib.pyx":395 * * cdef void gp_SetPrevEdge(graphP theGraph, int e, int newPrevEdge): * cgraphLib.gp_SetPrevEdge(theGraph, e, newPrevEdge) # <<<<<<<<<<<<<< * * */ gp_SetPrevEdge(__pyx_v_theGraph, __pyx_v_e, __pyx_v_newPrevEdge); /* "planarity/full/graphLib.pyx":394 * * * cdef void gp_SetPrevEdge(graphP theGraph, int e, int newPrevEdge): # <<<<<<<<<<<<<< * cgraphLib.gp_SetPrevEdge(theGraph, e, newPrevEdge) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":398 * * * cdef void gp_SetAdjacentEdge(graphP theGraph, int e, int theLink, int newEdge): # <<<<<<<<<<<<<< * cgraphLib.gp_SetAdjacentEdge(theGraph, e, theLink, newEdge) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_SetAdjacentEdge(graphP __pyx_v_theGraph, int __pyx_v_e, int __pyx_v_theLink, int __pyx_v_newEdge) { /* "planarity/full/graphLib.pyx":399 * * cdef void gp_SetAdjacentEdge(graphP theGraph, int e, int theLink, int newEdge): * cgraphLib.gp_SetAdjacentEdge(theGraph, e, theLink, newEdge) # <<<<<<<<<<<<<< * * */ gp_SetAdjacentEdge(__pyx_v_theGraph, __pyx_v_e, __pyx_v_theLink, __pyx_v_newEdge); /* "planarity/full/graphLib.pyx":398 * * * cdef void gp_SetAdjacentEdge(graphP theGraph, int e, int theLink, int newEdge): # <<<<<<<<<<<<<< * cgraphLib.gp_SetAdjacentEdge(theGraph, e, theLink, newEdge) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":402 * * * cdef int gp_IsEdge(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsEdge(theGraph, e) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_IsEdge(graphP __pyx_v_theGraph, int __pyx_v_e) { int __pyx_r; /* "planarity/full/graphLib.pyx":403 * * cdef int gp_IsEdge(graphP theGraph, int e): * return cgraphLib.gp_IsEdge(theGraph, e) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_IsEdge(__pyx_v_theGraph, __pyx_v_e); goto __pyx_L0; /* "planarity/full/graphLib.pyx":402 * * * cdef int gp_IsEdge(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsEdge(theGraph, e) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":406 * * * cdef int gp_IsNotEdge(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsNotEdge(theGraph, e) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_IsNotEdge(graphP __pyx_v_theGraph, int __pyx_v_e) { int __pyx_r; /* "planarity/full/graphLib.pyx":407 * * cdef int gp_IsNotEdge(graphP theGraph, int e): * return cgraphLib.gp_IsNotEdge(theGraph, e) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_IsNotEdge(__pyx_v_theGraph, __pyx_v_e); goto __pyx_L0; /* "planarity/full/graphLib.pyx":406 * * * cdef int gp_IsNotEdge(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsNotEdge(theGraph, e) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":410 * * * cdef int gp_GetNeighbor(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetNeighbor(theGraph, e) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetNeighbor(graphP __pyx_v_theGraph, int __pyx_v_e) { int __pyx_r; /* "planarity/full/graphLib.pyx":411 * * cdef int gp_GetNeighbor(graphP theGraph, int e): * return cgraphLib.gp_GetNeighbor(theGraph, e) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetNeighbor(__pyx_v_theGraph, __pyx_v_e); goto __pyx_L0; /* "planarity/full/graphLib.pyx":410 * * * cdef int gp_GetNeighbor(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetNeighbor(theGraph, e) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":414 * * * cdef void gp_SetNeighbor(graphP theGraph, int e, int v): # <<<<<<<<<<<<<< * cgraphLib.gp_SetNeighbor(theGraph, e, v) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_SetNeighbor(graphP __pyx_v_theGraph, int __pyx_v_e, int __pyx_v_v) { /* "planarity/full/graphLib.pyx":415 * * cdef void gp_SetNeighbor(graphP theGraph, int e, int v): * cgraphLib.gp_SetNeighbor(theGraph, e, v) # <<<<<<<<<<<<<< * * */ gp_SetNeighbor(__pyx_v_theGraph, __pyx_v_e, __pyx_v_v); /* "planarity/full/graphLib.pyx":414 * * * cdef void gp_SetNeighbor(graphP theGraph, int e, int v): # <<<<<<<<<<<<<< * cgraphLib.gp_SetNeighbor(theGraph, e, v) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":418 * * * cdef void gp_InitEdgeFlags(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_InitEdgeFlags(theGraph, e) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_InitEdgeFlags(graphP __pyx_v_theGraph, int __pyx_v_e) { /* "planarity/full/graphLib.pyx":419 * * cdef void gp_InitEdgeFlags(graphP theGraph, int e): * cgraphLib.gp_InitEdgeFlags(theGraph, e) # <<<<<<<<<<<<<< * * */ gp_InitEdgeFlags(__pyx_v_theGraph, __pyx_v_e); /* "planarity/full/graphLib.pyx":418 * * * cdef void gp_InitEdgeFlags(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_InitEdgeFlags(theGraph, e) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":422 * * * cdef int gp_GetEdgeVisited(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetEdgeVisited(theGraph, e) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetEdgeVisited(graphP __pyx_v_theGraph, int __pyx_v_e) { int __pyx_r; /* "planarity/full/graphLib.pyx":423 * * cdef int gp_GetEdgeVisited(graphP theGraph, int e): * return cgraphLib.gp_GetEdgeVisited(theGraph, e) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetEdgeVisited(__pyx_v_theGraph, __pyx_v_e); goto __pyx_L0; /* "planarity/full/graphLib.pyx":422 * * * cdef int gp_GetEdgeVisited(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetEdgeVisited(theGraph, e) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":426 * * * cdef void gp_ClearEdgeVisited(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_ClearEdgeVisited(theGraph, e) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeVisited(graphP __pyx_v_theGraph, int __pyx_v_e) { /* "planarity/full/graphLib.pyx":427 * * cdef void gp_ClearEdgeVisited(graphP theGraph, int e): * cgraphLib.gp_ClearEdgeVisited(theGraph, e) # <<<<<<<<<<<<<< * * */ gp_ClearEdgeVisited(__pyx_v_theGraph, __pyx_v_e); /* "planarity/full/graphLib.pyx":426 * * * cdef void gp_ClearEdgeVisited(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_ClearEdgeVisited(theGraph, e) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":430 * * * cdef void gp_SetEdgeVisited(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_SetEdgeVisited(theGraph, e) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_SetEdgeVisited(graphP __pyx_v_theGraph, int __pyx_v_e) { /* "planarity/full/graphLib.pyx":431 * * cdef void gp_SetEdgeVisited(graphP theGraph, int e): * cgraphLib.gp_SetEdgeVisited(theGraph, e) # <<<<<<<<<<<<<< * * */ gp_SetEdgeVisited(__pyx_v_theGraph, __pyx_v_e); /* "planarity/full/graphLib.pyx":430 * * * cdef void gp_SetEdgeVisited(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_SetEdgeVisited(theGraph, e) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":434 * * * cdef int gp_GetEdgeMarked(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetEdgeMarked(theGraph, e) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetEdgeMarked(graphP __pyx_v_theGraph, int __pyx_v_e) { int __pyx_r; /* "planarity/full/graphLib.pyx":435 * * cdef int gp_GetEdgeMarked(graphP theGraph, int e): * return cgraphLib.gp_GetEdgeMarked(theGraph, e) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetEdgeMarked(__pyx_v_theGraph, __pyx_v_e); goto __pyx_L0; /* "planarity/full/graphLib.pyx":434 * * * cdef int gp_GetEdgeMarked(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetEdgeMarked(theGraph, e) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":438 * * * cdef void gp_ClearEdgeMarked(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_ClearEdgeMarked(theGraph, e) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeMarked(graphP __pyx_v_theGraph, int __pyx_v_e) { /* "planarity/full/graphLib.pyx":439 * * cdef void gp_ClearEdgeMarked(graphP theGraph, int e): * cgraphLib.gp_ClearEdgeMarked(theGraph, e) # <<<<<<<<<<<<<< * * */ gp_ClearEdgeMarked(__pyx_v_theGraph, __pyx_v_e); /* "planarity/full/graphLib.pyx":438 * * * cdef void gp_ClearEdgeMarked(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_ClearEdgeMarked(theGraph, e) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":442 * * * cdef void gp_SetEdgeMarked(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_SetEdgeMarked(theGraph, e) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_SetEdgeMarked(graphP __pyx_v_theGraph, int __pyx_v_e) { /* "planarity/full/graphLib.pyx":443 * * cdef void gp_SetEdgeMarked(graphP theGraph, int e): * cgraphLib.gp_SetEdgeMarked(theGraph, e) # <<<<<<<<<<<<<< * * */ gp_SetEdgeMarked(__pyx_v_theGraph, __pyx_v_e); /* "planarity/full/graphLib.pyx":442 * * * cdef void gp_SetEdgeMarked(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_SetEdgeMarked(theGraph, e) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":446 * * * cdef int gp_GetEdgeType(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetEdgeType(theGraph, e) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetEdgeType(graphP __pyx_v_theGraph, int __pyx_v_e) { int __pyx_r; /* "planarity/full/graphLib.pyx":447 * * cdef int gp_GetEdgeType(graphP theGraph, int e): * return cgraphLib.gp_GetEdgeType(theGraph, e) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetEdgeType(__pyx_v_theGraph, __pyx_v_e); goto __pyx_L0; /* "planarity/full/graphLib.pyx":446 * * * cdef int gp_GetEdgeType(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetEdgeType(theGraph, e) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":450 * * * cdef void gp_ClearEdgeType(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_ClearEdgeType(theGraph, e) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeType(graphP __pyx_v_theGraph, int __pyx_v_e) { /* "planarity/full/graphLib.pyx":451 * * cdef void gp_ClearEdgeType(graphP theGraph, int e): * cgraphLib.gp_ClearEdgeType(theGraph, e) # <<<<<<<<<<<<<< * * */ gp_ClearEdgeType(__pyx_v_theGraph, __pyx_v_e); /* "planarity/full/graphLib.pyx":450 * * * cdef void gp_ClearEdgeType(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_ClearEdgeType(theGraph, e) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":454 * * * cdef void gp_SetEdgeType(graphP theGraph, int e, int type): # <<<<<<<<<<<<<< * cgraphLib.gp_SetEdgeType(theGraph, e, type) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_SetEdgeType(graphP __pyx_v_theGraph, int __pyx_v_e, int __pyx_v_type) { /* "planarity/full/graphLib.pyx":455 * * cdef void gp_SetEdgeType(graphP theGraph, int e, int type): * cgraphLib.gp_SetEdgeType(theGraph, e, type) # <<<<<<<<<<<<<< * * */ gp_SetEdgeType(__pyx_v_theGraph, __pyx_v_e, __pyx_v_type); /* "planarity/full/graphLib.pyx":454 * * * cdef void gp_SetEdgeType(graphP theGraph, int e, int type): # <<<<<<<<<<<<<< * cgraphLib.gp_SetEdgeType(theGraph, e, type) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":458 * * * cdef void gp_ResetEdgeType(graphP theGraph, int e, int type): # <<<<<<<<<<<<<< * cgraphLib.gp_ResetEdgeType(theGraph, e, type) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_ResetEdgeType(graphP __pyx_v_theGraph, int __pyx_v_e, int __pyx_v_type) { /* "planarity/full/graphLib.pyx":459 * * cdef void gp_ResetEdgeType(graphP theGraph, int e, int type): * cgraphLib.gp_ResetEdgeType(theGraph, e, type) # <<<<<<<<<<<<<< * * */ gp_ResetEdgeType(__pyx_v_theGraph, __pyx_v_e, __pyx_v_type); /* "planarity/full/graphLib.pyx":458 * * * cdef void gp_ResetEdgeType(graphP theGraph, int e, int type): # <<<<<<<<<<<<<< * cgraphLib.gp_ResetEdgeType(theGraph, e, type) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":462 * * * cdef int gp_GetEdgeFlagInverted(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetEdgeFlagInverted(theGraph, e) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetEdgeFlagInverted(graphP __pyx_v_theGraph, int __pyx_v_e) { int __pyx_r; /* "planarity/full/graphLib.pyx":463 * * cdef int gp_GetEdgeFlagInverted(graphP theGraph, int e): * return cgraphLib.gp_GetEdgeFlagInverted(theGraph, e) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetEdgeFlagInverted(__pyx_v_theGraph, __pyx_v_e); goto __pyx_L0; /* "planarity/full/graphLib.pyx":462 * * * cdef int gp_GetEdgeFlagInverted(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetEdgeFlagInverted(theGraph, e) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":466 * * * cdef void gp_SetEdgeFlagInverted(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_SetEdgeFlagInverted(theGraph, e) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_SetEdgeFlagInverted(graphP __pyx_v_theGraph, int __pyx_v_e) { /* "planarity/full/graphLib.pyx":467 * * cdef void gp_SetEdgeFlagInverted(graphP theGraph, int e): * cgraphLib.gp_SetEdgeFlagInverted(theGraph, e) # <<<<<<<<<<<<<< * * */ gp_SetEdgeFlagInverted(__pyx_v_theGraph, __pyx_v_e); /* "planarity/full/graphLib.pyx":466 * * * cdef void gp_SetEdgeFlagInverted(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_SetEdgeFlagInverted(theGraph, e) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":470 * * * cdef void gp_ClearEdgeFlagInverted(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_ClearEdgeFlagInverted(theGraph, e) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeFlagInverted(graphP __pyx_v_theGraph, int __pyx_v_e) { /* "planarity/full/graphLib.pyx":471 * * cdef void gp_ClearEdgeFlagInverted(graphP theGraph, int e): * cgraphLib.gp_ClearEdgeFlagInverted(theGraph, e) # <<<<<<<<<<<<<< * * */ gp_ClearEdgeFlagInverted(__pyx_v_theGraph, __pyx_v_e); /* "planarity/full/graphLib.pyx":470 * * * cdef void gp_ClearEdgeFlagInverted(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_ClearEdgeFlagInverted(theGraph, e) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":474 * * * cdef void gp_XorEdgeFlagInverted(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_XorEdgeFlagInverted(theGraph, e) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_XorEdgeFlagInverted(graphP __pyx_v_theGraph, int __pyx_v_e) { /* "planarity/full/graphLib.pyx":475 * * cdef void gp_XorEdgeFlagInverted(graphP theGraph, int e): * cgraphLib.gp_XorEdgeFlagInverted(theGraph, e) # <<<<<<<<<<<<<< * * */ gp_XorEdgeFlagInverted(__pyx_v_theGraph, __pyx_v_e); /* "planarity/full/graphLib.pyx":474 * * * cdef void gp_XorEdgeFlagInverted(graphP theGraph, int e): # <<<<<<<<<<<<<< * cgraphLib.gp_XorEdgeFlagInverted(theGraph, e) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":478 * * * cdef int gp_GetDirection(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetDirection(theGraph, e) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetDirection(graphP __pyx_v_theGraph, int __pyx_v_e) { int __pyx_r; /* "planarity/full/graphLib.pyx":479 * * cdef int gp_GetDirection(graphP theGraph, int e): * return cgraphLib.gp_GetDirection(theGraph, e) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetDirection(__pyx_v_theGraph, __pyx_v_e); goto __pyx_L0; /* "planarity/full/graphLib.pyx":478 * * * cdef int gp_GetDirection(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetDirection(theGraph, e) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":482 * * * cdef void gp_SetDirection(graphP theGraph, int e, int direction): # <<<<<<<<<<<<<< * cgraphLib.gp_SetDirection(theGraph, e, direction) * */ static void __pyx_f_9planarity_4full_8graphLib_gp_SetDirection(graphP __pyx_v_theGraph, int __pyx_v_e, int __pyx_v_direction) { /* "planarity/full/graphLib.pyx":483 * * cdef void gp_SetDirection(graphP theGraph, int e, int direction): * cgraphLib.gp_SetDirection(theGraph, e, direction) # <<<<<<<<<<<<<< * * */ gp_SetDirection(__pyx_v_theGraph, __pyx_v_e, __pyx_v_direction); /* "planarity/full/graphLib.pyx":482 * * * cdef void gp_SetDirection(graphP theGraph, int e, int direction): # <<<<<<<<<<<<<< * cgraphLib.gp_SetDirection(theGraph, e, direction) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":486 * * * cdef int gp_LowerBoundEdges(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_LowerBoundEdges(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_LowerBoundEdges(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":487 * * cdef int gp_LowerBoundEdges(graphP theGraph): * return cgraphLib.gp_LowerBoundEdges(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_LowerBoundEdges(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":486 * * * cdef int gp_LowerBoundEdges(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_LowerBoundEdges(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":490 * * * cdef int gp_UpperBoundEdges(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_UpperBoundEdges(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_UpperBoundEdges(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":491 * * cdef int gp_UpperBoundEdges(graphP theGraph): * return cgraphLib.gp_UpperBoundEdges(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_UpperBoundEdges(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":490 * * * cdef int gp_UpperBoundEdges(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_UpperBoundEdges(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":494 * * * cdef int gp_EdgeInUse(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_EdgeInUse(theGraph, e) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_EdgeInUse(graphP __pyx_v_theGraph, int __pyx_v_e) { int __pyx_r; /* "planarity/full/graphLib.pyx":495 * * cdef int gp_EdgeInUse(graphP theGraph, int e): * return cgraphLib.gp_EdgeInUse(theGraph, e) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_EdgeInUse(__pyx_v_theGraph, __pyx_v_e); goto __pyx_L0; /* "planarity/full/graphLib.pyx":494 * * * cdef int gp_EdgeInUse(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_EdgeInUse(theGraph, e) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":498 * * * cdef int gp_EdgeNotInUse(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_EdgeNotInUse(theGraph, e) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_EdgeNotInUse(graphP __pyx_v_theGraph, int __pyx_v_e) { int __pyx_r; /* "planarity/full/graphLib.pyx":499 * * cdef int gp_EdgeNotInUse(graphP theGraph, int e): * return cgraphLib.gp_EdgeNotInUse(theGraph, e) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_EdgeNotInUse(__pyx_v_theGraph, __pyx_v_e); goto __pyx_L0; /* "planarity/full/graphLib.pyx":498 * * * cdef int gp_EdgeNotInUse(graphP theGraph, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_EdgeNotInUse(theGraph, e) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":502 * * * cdef int gp_LowerBoundEdgeStorage(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_LowerBoundEdgeStorage(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_LowerBoundEdgeStorage(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":503 * * cdef int gp_LowerBoundEdgeStorage(graphP theGraph): * return cgraphLib.gp_LowerBoundEdgeStorage(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_LowerBoundEdgeStorage(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":502 * * * cdef int gp_LowerBoundEdgeStorage(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_LowerBoundEdgeStorage(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":506 * * * cdef int gp_UpperBoundEdgeStorage(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_UpperBoundEdgeStorage(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_UpperBoundEdgeStorage(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":507 * * cdef int gp_UpperBoundEdgeStorage(graphP theGraph): * return cgraphLib.gp_UpperBoundEdgeStorage(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_UpperBoundEdgeStorage(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":506 * * * cdef int gp_UpperBoundEdgeStorage(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_UpperBoundEdgeStorage(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":511 * * # Wraps functions declared in "planarity/c/graphLib/io/graphIO.h": * cdef int gp_Read(graphP theGraph, char *fileName): # <<<<<<<<<<<<<< * return cgraphLib.gp_Read(theGraph, fileName) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_Read(graphP __pyx_v_theGraph, char *__pyx_v_fileName) { int __pyx_r; /* "planarity/full/graphLib.pyx":512 * # Wraps functions declared in "planarity/c/graphLib/io/graphIO.h": * cdef int gp_Read(graphP theGraph, char *fileName): * return cgraphLib.gp_Read(theGraph, fileName) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_Read(__pyx_v_theGraph, __pyx_v_fileName); goto __pyx_L0; /* "planarity/full/graphLib.pyx":511 * * # Wraps functions declared in "planarity/c/graphLib/io/graphIO.h": * cdef int gp_Read(graphP theGraph, char *fileName): # <<<<<<<<<<<<<< * return cgraphLib.gp_Read(theGraph, fileName) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":515 * * * cdef int gp_ReadFromString(graphP theGraph, char *inputStr): # <<<<<<<<<<<<<< * return cgraphLib.gp_ReadFromString(theGraph, inputStr) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_ReadFromString(graphP __pyx_v_theGraph, char *__pyx_v_inputStr) { int __pyx_r; /* "planarity/full/graphLib.pyx":516 * * cdef int gp_ReadFromString(graphP theGraph, char *inputStr): * return cgraphLib.gp_ReadFromString(theGraph, inputStr) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_ReadFromString(__pyx_v_theGraph, __pyx_v_inputStr); goto __pyx_L0; /* "planarity/full/graphLib.pyx":515 * * * cdef int gp_ReadFromString(graphP theGraph, char *inputStr): # <<<<<<<<<<<<<< * return cgraphLib.gp_ReadFromString(theGraph, inputStr) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":519 * * * cdef int gp_Write(graphP theGraph, char *fileName, int writeMode): # <<<<<<<<<<<<<< * return cgraphLib.gp_Write(theGraph, fileName, writeMode) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_Write(graphP __pyx_v_theGraph, char *__pyx_v_fileName, int __pyx_v_writeMode) { int __pyx_r; /* "planarity/full/graphLib.pyx":520 * * cdef int gp_Write(graphP theGraph, char *fileName, int writeMode): * return cgraphLib.gp_Write(theGraph, fileName, writeMode) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_Write(__pyx_v_theGraph, __pyx_v_fileName, __pyx_v_writeMode); goto __pyx_L0; /* "planarity/full/graphLib.pyx":519 * * * cdef int gp_Write(graphP theGraph, char *fileName, int writeMode): # <<<<<<<<<<<<<< * return cgraphLib.gp_Write(theGraph, fileName, writeMode) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":523 * * * cdef int gp_WriteToString(graphP theGraph, char **pOutputStr, int writeMode): # <<<<<<<<<<<<<< * return cgraphLib.gp_WriteToString(theGraph, pOutputStr, writeMode) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_WriteToString(graphP __pyx_v_theGraph, char **__pyx_v_pOutputStr, int __pyx_v_writeMode) { int __pyx_r; /* "planarity/full/graphLib.pyx":524 * * cdef int gp_WriteToString(graphP theGraph, char **pOutputStr, int writeMode): * return cgraphLib.gp_WriteToString(theGraph, pOutputStr, writeMode) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_WriteToString(__pyx_v_theGraph, __pyx_v_pOutputStr, __pyx_v_writeMode); goto __pyx_L0; /* "planarity/full/graphLib.pyx":523 * * * cdef int gp_WriteToString(graphP theGraph, char **pOutputStr, int writeMode): # <<<<<<<<<<<<<< * return cgraphLib.gp_WriteToString(theGraph, pOutputStr, writeMode) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":528 * * # Wraps functions declared in "planarity/c/graphLib/io/g6-read-iterator.h": * cdef int g6_NewReader(G6ReadIteratorP *pG6ReadIterator, graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.g6_NewReader(pG6ReadIterator, theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_g6_NewReader(G6ReadIteratorP *__pyx_v_pG6ReadIterator, graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":529 * # Wraps functions declared in "planarity/c/graphLib/io/g6-read-iterator.h": * cdef int g6_NewReader(G6ReadIteratorP *pG6ReadIterator, graphP theGraph): * return cgraphLib.g6_NewReader(pG6ReadIterator, theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = g6_NewReader(__pyx_v_pG6ReadIterator, __pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":528 * * # Wraps functions declared in "planarity/c/graphLib/io/g6-read-iterator.h": * cdef int g6_NewReader(G6ReadIteratorP *pG6ReadIterator, graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.g6_NewReader(pG6ReadIterator, theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":532 * * * cdef int g6_InitReaderWithString(G6ReadIteratorP theG6ReadIterator, char *inputString): # <<<<<<<<<<<<<< * return cgraphLib.g6_InitReaderWithString(theG6ReadIterator, inputString) * */ static int __pyx_f_9planarity_4full_8graphLib_g6_InitReaderWithString(G6ReadIteratorP __pyx_v_theG6ReadIterator, char *__pyx_v_inputString) { int __pyx_r; /* "planarity/full/graphLib.pyx":533 * * cdef int g6_InitReaderWithString(G6ReadIteratorP theG6ReadIterator, char *inputString): * return cgraphLib.g6_InitReaderWithString(theG6ReadIterator, inputString) # <<<<<<<<<<<<<< * * */ __pyx_r = g6_InitReaderWithString(__pyx_v_theG6ReadIterator, __pyx_v_inputString); goto __pyx_L0; /* "planarity/full/graphLib.pyx":532 * * * cdef int g6_InitReaderWithString(G6ReadIteratorP theG6ReadIterator, char *inputString): # <<<<<<<<<<<<<< * return cgraphLib.g6_InitReaderWithString(theG6ReadIterator, inputString) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":536 * * * cdef int g6_InitReaderWithFileName(G6ReadIteratorP theG6ReadIterator, char *infileName): # <<<<<<<<<<<<<< * return cgraphLib.g6_InitReaderWithFileName(theG6ReadIterator, infileName) * */ static int __pyx_f_9planarity_4full_8graphLib_g6_InitReaderWithFileName(G6ReadIteratorP __pyx_v_theG6ReadIterator, char *__pyx_v_infileName) { int __pyx_r; /* "planarity/full/graphLib.pyx":537 * * cdef int g6_InitReaderWithFileName(G6ReadIteratorP theG6ReadIterator, char *infileName): * return cgraphLib.g6_InitReaderWithFileName(theG6ReadIterator, infileName) # <<<<<<<<<<<<<< * * */ __pyx_r = g6_InitReaderWithFileName(__pyx_v_theG6ReadIterator, __pyx_v_infileName); goto __pyx_L0; /* "planarity/full/graphLib.pyx":536 * * * cdef int g6_InitReaderWithFileName(G6ReadIteratorP theG6ReadIterator, char *infileName): # <<<<<<<<<<<<<< * return cgraphLib.g6_InitReaderWithFileName(theG6ReadIterator, infileName) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":540 * * * cdef int g6_ReadGraph(G6ReadIteratorP theG6ReadIterator): # <<<<<<<<<<<<<< * return cgraphLib.g6_ReadGraph(theG6ReadIterator) * */ static int __pyx_f_9planarity_4full_8graphLib_g6_ReadGraph(G6ReadIteratorP __pyx_v_theG6ReadIterator) { int __pyx_r; /* "planarity/full/graphLib.pyx":541 * * cdef int g6_ReadGraph(G6ReadIteratorP theG6ReadIterator): * return cgraphLib.g6_ReadGraph(theG6ReadIterator) # <<<<<<<<<<<<<< * * */ __pyx_r = g6_ReadGraph(__pyx_v_theG6ReadIterator); goto __pyx_L0; /* "planarity/full/graphLib.pyx":540 * * * cdef int g6_ReadGraph(G6ReadIteratorP theG6ReadIterator): # <<<<<<<<<<<<<< * return cgraphLib.g6_ReadGraph(theG6ReadIterator) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":544 * * * cdef int g6_EndReached(G6ReadIteratorP theG6ReadIterator): # <<<<<<<<<<<<<< * return cgraphLib.g6_EndReached(theG6ReadIterator) * */ static int __pyx_f_9planarity_4full_8graphLib_g6_EndReached(G6ReadIteratorP __pyx_v_theG6ReadIterator) { int __pyx_r; /* "planarity/full/graphLib.pyx":545 * * cdef int g6_EndReached(G6ReadIteratorP theG6ReadIterator): * return cgraphLib.g6_EndReached(theG6ReadIterator) # <<<<<<<<<<<<<< * * */ __pyx_r = g6_EndReached(__pyx_v_theG6ReadIterator); goto __pyx_L0; /* "planarity/full/graphLib.pyx":544 * * * cdef int g6_EndReached(G6ReadIteratorP theG6ReadIterator): # <<<<<<<<<<<<<< * return cgraphLib.g6_EndReached(theG6ReadIterator) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":548 * * * cdef void g6_FreeReader(G6ReadIteratorP *pG6ReadIterator): # <<<<<<<<<<<<<< * cgraphLib.g6_FreeReader(pG6ReadIterator) * */ static void __pyx_f_9planarity_4full_8graphLib_g6_FreeReader(G6ReadIteratorP *__pyx_v_pG6ReadIterator) { /* "planarity/full/graphLib.pyx":549 * * cdef void g6_FreeReader(G6ReadIteratorP *pG6ReadIterator): * cgraphLib.g6_FreeReader(pG6ReadIterator) # <<<<<<<<<<<<<< * * */ g6_FreeReader(__pyx_v_pG6ReadIterator); /* "planarity/full/graphLib.pyx":548 * * * cdef void g6_FreeReader(G6ReadIteratorP *pG6ReadIterator): # <<<<<<<<<<<<<< * cgraphLib.g6_FreeReader(pG6ReadIterator) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":553 * * # Wraps functions declared in "planarity/c/graphLib/io/g6-write-iterator.h" * cdef int g6_NewWriter(G6WriteIteratorP *pG6WriteIterator, graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.g6_NewWriter(pG6WriteIterator, theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_g6_NewWriter(G6WriteIteratorP *__pyx_v_pG6WriteIterator, graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":554 * # Wraps functions declared in "planarity/c/graphLib/io/g6-write-iterator.h" * cdef int g6_NewWriter(G6WriteIteratorP *pG6WriteIterator, graphP theGraph): * return cgraphLib.g6_NewWriter(pG6WriteIterator, theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = g6_NewWriter(__pyx_v_pG6WriteIterator, __pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":553 * * # Wraps functions declared in "planarity/c/graphLib/io/g6-write-iterator.h" * cdef int g6_NewWriter(G6WriteIteratorP *pG6WriteIterator, graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.g6_NewWriter(pG6WriteIterator, theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":557 * * * cdef int g6_InitWriterWithString(G6WriteIteratorP theG6WriteIterator, char **pOutputString): # <<<<<<<<<<<<<< * return cgraphLib.g6_InitWriterWithString(theG6WriteIterator, pOutputString) * */ static int __pyx_f_9planarity_4full_8graphLib_g6_InitWriterWithString(G6WriteIteratorP __pyx_v_theG6WriteIterator, char **__pyx_v_pOutputString) { int __pyx_r; /* "planarity/full/graphLib.pyx":558 * * cdef int g6_InitWriterWithString(G6WriteIteratorP theG6WriteIterator, char **pOutputString): * return cgraphLib.g6_InitWriterWithString(theG6WriteIterator, pOutputString) # <<<<<<<<<<<<<< * * */ __pyx_r = g6_InitWriterWithString(__pyx_v_theG6WriteIterator, __pyx_v_pOutputString); goto __pyx_L0; /* "planarity/full/graphLib.pyx":557 * * * cdef int g6_InitWriterWithString(G6WriteIteratorP theG6WriteIterator, char **pOutputString): # <<<<<<<<<<<<<< * return cgraphLib.g6_InitWriterWithString(theG6WriteIterator, pOutputString) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":561 * * * cdef int g6_InitWriterWithFileName(G6WriteIteratorP theG6WriteIterator, char *outputFileName): # <<<<<<<<<<<<<< * return cgraphLib.g6_InitWriterWithFileName(theG6WriteIterator, outputFileName) * */ static int __pyx_f_9planarity_4full_8graphLib_g6_InitWriterWithFileName(G6WriteIteratorP __pyx_v_theG6WriteIterator, char *__pyx_v_outputFileName) { int __pyx_r; /* "planarity/full/graphLib.pyx":562 * * cdef int g6_InitWriterWithFileName(G6WriteIteratorP theG6WriteIterator, char *outputFileName): * return cgraphLib.g6_InitWriterWithFileName(theG6WriteIterator, outputFileName) # <<<<<<<<<<<<<< * * */ __pyx_r = g6_InitWriterWithFileName(__pyx_v_theG6WriteIterator, __pyx_v_outputFileName); goto __pyx_L0; /* "planarity/full/graphLib.pyx":561 * * * cdef int g6_InitWriterWithFileName(G6WriteIteratorP theG6WriteIterator, char *outputFileName): # <<<<<<<<<<<<<< * return cgraphLib.g6_InitWriterWithFileName(theG6WriteIterator, outputFileName) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":565 * * * cdef int g6_WriteGraph(G6WriteIteratorP theG6WriteIterator): # <<<<<<<<<<<<<< * return cgraphLib.g6_WriteGraph(theG6WriteIterator) * */ static int __pyx_f_9planarity_4full_8graphLib_g6_WriteGraph(G6WriteIteratorP __pyx_v_theG6WriteIterator) { int __pyx_r; /* "planarity/full/graphLib.pyx":566 * * cdef int g6_WriteGraph(G6WriteIteratorP theG6WriteIterator): * return cgraphLib.g6_WriteGraph(theG6WriteIterator) # <<<<<<<<<<<<<< * * */ __pyx_r = g6_WriteGraph(__pyx_v_theG6WriteIterator); goto __pyx_L0; /* "planarity/full/graphLib.pyx":565 * * * cdef int g6_WriteGraph(G6WriteIteratorP theG6WriteIterator): # <<<<<<<<<<<<<< * return cgraphLib.g6_WriteGraph(theG6WriteIterator) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":569 * * * cdef void g6_FreeWriter(G6WriteIteratorP *pG6WriteIterator): # <<<<<<<<<<<<<< * cgraphLib.g6_FreeWriter(pG6WriteIterator) * */ static void __pyx_f_9planarity_4full_8graphLib_g6_FreeWriter(G6WriteIteratorP *__pyx_v_pG6WriteIterator) { /* "planarity/full/graphLib.pyx":570 * * cdef void g6_FreeWriter(G6WriteIteratorP *pG6WriteIterator): * cgraphLib.g6_FreeWriter(pG6WriteIterator) # <<<<<<<<<<<<<< * * */ g6_FreeWriter(__pyx_v_pG6WriteIterator); /* "planarity/full/graphLib.pyx":569 * * * cdef void g6_FreeWriter(G6WriteIteratorP *pG6WriteIterator): # <<<<<<<<<<<<<< * cgraphLib.g6_FreeWriter(pG6WriteIterator) * */ /* function exit code */ } /* "planarity/full/graphLib.pyx":574 * * # Wraps functions declared in "planarity/c/graphLib/graphDFSUtils.h" * cdef int gp_ExtendWith_DFSUtils(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_ExtendWith_DFSUtils(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_DFSUtils(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":575 * # Wraps functions declared in "planarity/c/graphLib/graphDFSUtils.h" * cdef int gp_ExtendWith_DFSUtils(graphP theGraph): * return cgraphLib.gp_ExtendWith_DFSUtils(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_ExtendWith_DFSUtils(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":574 * * # Wraps functions declared in "planarity/c/graphLib/graphDFSUtils.h" * cdef int gp_ExtendWith_DFSUtils(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_ExtendWith_DFSUtils(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":578 * * * cdef int gp_Detach_DFSUtils(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_Detach_DFSUtils(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_Detach_DFSUtils(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":579 * * cdef int gp_Detach_DFSUtils(graphP theGraph): * return cgraphLib.gp_Detach_DFSUtils(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_Detach_DFSUtils(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":578 * * * cdef int gp_Detach_DFSUtils(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_Detach_DFSUtils(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":582 * * * cdef int gp_DepthFirstSearch(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_DepthFirstSearch(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_DepthFirstSearch(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":583 * * cdef int gp_DepthFirstSearch(graphP theGraph): * return cgraphLib.gp_DepthFirstSearch(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_DepthFirstSearch(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":582 * * * cdef int gp_DepthFirstSearch(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_DepthFirstSearch(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":586 * * * cdef int gp_SortVertices(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_SortVertices(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_SortVertices(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":587 * * cdef int gp_SortVertices(graphP theGraph): * return cgraphLib.gp_SortVertices(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_SortVertices(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":586 * * * cdef int gp_SortVertices(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_SortVertices(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":590 * * * cdef int gp_ComputeLowpoints(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_ComputeLowpoints(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_ComputeLowpoints(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":591 * * cdef int gp_ComputeLowpoints(graphP theGraph): * return cgraphLib.gp_ComputeLowpoints(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_ComputeLowpoints(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":590 * * * cdef int gp_ComputeLowpoints(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_ComputeLowpoints(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":594 * * * cdef int gp_ComputeLeastAncestors(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_ComputeLeastAncestors(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_ComputeLeastAncestors(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":595 * * cdef int gp_ComputeLeastAncestors(graphP theGraph): * return cgraphLib.gp_ComputeLeastAncestors(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_ComputeLeastAncestors(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":594 * * * cdef int gp_ComputeLeastAncestors(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_ComputeLeastAncestors(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":598 * * * cdef int gp_GetParent(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetParent(theGraph, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetParent(graphP __pyx_v_theGraph, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":599 * * cdef int gp_GetParent(graphP theGraph, int v): * return cgraphLib.gp_GetParent(theGraph, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetParent(__pyx_v_theGraph, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":598 * * * cdef int gp_GetParent(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetParent(theGraph, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":602 * * * cdef int gp_GetLeastAncestor(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetLeastAncestor(theGraph, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetLeastAncestor(graphP __pyx_v_theGraph, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":603 * * cdef int gp_GetLeastAncestor(graphP theGraph, int v): * return cgraphLib.gp_GetLeastAncestor(theGraph, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetLeastAncestor(__pyx_v_theGraph, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":602 * * * cdef int gp_GetLeastAncestor(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetLeastAncestor(theGraph, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":606 * * * cdef int gp_GetLowpoint(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetLowpoint(theGraph, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetLowpoint(graphP __pyx_v_theGraph, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":607 * * cdef int gp_GetLowpoint(graphP theGraph, int v): * return cgraphLib.gp_GetLowpoint(theGraph, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetLowpoint(__pyx_v_theGraph, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":606 * * * cdef int gp_GetLowpoint(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetLowpoint(theGraph, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":621 * * * cdef int gp_GetBicompRootFromDFSChild(graphP theGraph, int c): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetBicompRootFromDFSChild(theGraph, c) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetBicompRootFromDFSChild(graphP __pyx_v_theGraph, int __pyx_v_c) { int __pyx_r; /* "planarity/full/graphLib.pyx":622 * * cdef int gp_GetBicompRootFromDFSChild(graphP theGraph, int c): * return cgraphLib.gp_GetBicompRootFromDFSChild(theGraph, c) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetBicompRootFromDFSChild(__pyx_v_theGraph, __pyx_v_c); goto __pyx_L0; /* "planarity/full/graphLib.pyx":621 * * * cdef int gp_GetBicompRootFromDFSChild(graphP theGraph, int c): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetBicompRootFromDFSChild(theGraph, c) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":625 * * * cdef int gp_GetDFSChildFromBicompRoot(graphP theGraph, int R): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetDFSChildFromBicompRoot(theGraph, R) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetDFSChildFromBicompRoot(graphP __pyx_v_theGraph, int __pyx_v_R) { int __pyx_r; /* "planarity/full/graphLib.pyx":626 * * cdef int gp_GetDFSChildFromBicompRoot(graphP theGraph, int R): * return cgraphLib.gp_GetDFSChildFromBicompRoot(theGraph, R) # <<<<<<<<<<<<<< * * # FIXME: This EAPS macro calls private gp_GetVertexParent() rather than */ __pyx_r = gp_GetDFSChildFromBicompRoot(__pyx_v_theGraph, __pyx_v_R); goto __pyx_L0; /* "planarity/full/graphLib.pyx":625 * * * cdef int gp_GetDFSChildFromBicompRoot(graphP theGraph, int R): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetDFSChildFromBicompRoot(theGraph, R) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":635 * * * cdef int gp_IsBicompRoot(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsBicompRoot(theGraph, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_IsBicompRoot(graphP __pyx_v_theGraph, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":636 * * cdef int gp_IsBicompRoot(graphP theGraph, int v): * return cgraphLib.gp_IsBicompRoot(theGraph, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_IsBicompRoot(__pyx_v_theGraph, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":635 * * * cdef int gp_IsBicompRoot(graphP theGraph, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsBicompRoot(theGraph, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":639 * * * cdef int gp_IsSeparatedDFSChild(graphP theGraph, int theChild): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsSeparatedDFSChild(theGraph, theChild) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_IsSeparatedDFSChild(graphP __pyx_v_theGraph, int __pyx_v_theChild) { int __pyx_r; /* "planarity/full/graphLib.pyx":640 * * cdef int gp_IsSeparatedDFSChild(graphP theGraph, int theChild): * return cgraphLib.gp_IsSeparatedDFSChild(theGraph, theChild) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_IsSeparatedDFSChild(__pyx_v_theGraph, __pyx_v_theChild); goto __pyx_L0; /* "planarity/full/graphLib.pyx":639 * * * cdef int gp_IsSeparatedDFSChild(graphP theGraph, int theChild): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsSeparatedDFSChild(theGraph, theChild) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":643 * * * cdef int gp_IsNotSeparatedDFSChild(graphP theGraph, int theChild): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsNotSeparatedDFSChild(theGraph, theChild) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_IsNotSeparatedDFSChild(graphP __pyx_v_theGraph, int __pyx_v_theChild) { int __pyx_r; /* "planarity/full/graphLib.pyx":644 * * cdef int gp_IsNotSeparatedDFSChild(graphP theGraph, int theChild): * return cgraphLib.gp_IsNotSeparatedDFSChild(theGraph, theChild) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_IsNotSeparatedDFSChild(__pyx_v_theGraph, __pyx_v_theChild); goto __pyx_L0; /* "planarity/full/graphLib.pyx":643 * * * cdef int gp_IsNotSeparatedDFSChild(graphP theGraph, int theChild): # <<<<<<<<<<<<<< * return cgraphLib.gp_IsNotSeparatedDFSChild(theGraph, theChild) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":648 * * # Wraps functions declared in "planarity/c/graphLib/planarityRelated/graphPlanarity.h": * cdef int gp_ExtendWith_Planarity(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_ExtendWith_Planarity(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_Planarity(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":649 * # Wraps functions declared in "planarity/c/graphLib/planarityRelated/graphPlanarity.h": * cdef int gp_ExtendWith_Planarity(graphP theGraph): * return cgraphLib.gp_ExtendWith_Planarity(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_ExtendWith_Planarity(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":648 * * # Wraps functions declared in "planarity/c/graphLib/planarityRelated/graphPlanarity.h": * cdef int gp_ExtendWith_Planarity(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_ExtendWith_Planarity(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":652 * * * cdef int gp_Detach_Planarity(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_Detach_Planarity(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_Detach_Planarity(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":653 * * cdef int gp_Detach_Planarity(graphP theGraph): * return cgraphLib.gp_Detach_Planarity(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_Detach_Planarity(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":652 * * * cdef int gp_Detach_Planarity(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_Detach_Planarity(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":656 * * * cdef int gp_Embed(graphP theGraph, unsigned int embedFlags): # <<<<<<<<<<<<<< * return cgraphLib.gp_Embed(theGraph, embedFlags) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_Embed(graphP __pyx_v_theGraph, unsigned int __pyx_v_embedFlags) { int __pyx_r; /* "planarity/full/graphLib.pyx":657 * * cdef int gp_Embed(graphP theGraph, unsigned int embedFlags): * return cgraphLib.gp_Embed(theGraph, embedFlags) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_Embed(__pyx_v_theGraph, __pyx_v_embedFlags); goto __pyx_L0; /* "planarity/full/graphLib.pyx":656 * * * cdef int gp_Embed(graphP theGraph, unsigned int embedFlags): # <<<<<<<<<<<<<< * return cgraphLib.gp_Embed(theGraph, embedFlags) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":660 * * * cdef int gp_TestEmbedResultIntegrity(graphP theGraph, graphP origGraph, int embedResult): # <<<<<<<<<<<<<< * return cgraphLib.gp_TestEmbedResultIntegrity(theGraph, origGraph, embedResult) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_TestEmbedResultIntegrity(graphP __pyx_v_theGraph, graphP __pyx_v_origGraph, int __pyx_v_embedResult) { int __pyx_r; /* "planarity/full/graphLib.pyx":661 * * cdef int gp_TestEmbedResultIntegrity(graphP theGraph, graphP origGraph, int embedResult): * return cgraphLib.gp_TestEmbedResultIntegrity(theGraph, origGraph, embedResult) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_TestEmbedResultIntegrity(__pyx_v_theGraph, __pyx_v_origGraph, __pyx_v_embedResult); goto __pyx_L0; /* "planarity/full/graphLib.pyx":660 * * * cdef int gp_TestEmbedResultIntegrity(graphP theGraph, graphP origGraph, int embedResult): # <<<<<<<<<<<<<< * return cgraphLib.gp_TestEmbedResultIntegrity(theGraph, origGraph, embedResult) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":664 * * * cdef int gp_GetEmbedFlags(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetEmbedFlags(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_GetEmbedFlags(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":665 * * cdef int gp_GetEmbedFlags(graphP theGraph): * return cgraphLib.gp_GetEmbedFlags(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetEmbedFlags(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":664 * * * cdef int gp_GetEmbedFlags(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetEmbedFlags(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":668 * * * cdef unsigned gp_GetObstructionMinorType(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetObstructionMinorType(theGraph) * */ static unsigned int __pyx_f_9planarity_4full_8graphLib_gp_GetObstructionMinorType(graphP __pyx_v_theGraph) { unsigned int __pyx_r; /* "planarity/full/graphLib.pyx":669 * * cdef unsigned gp_GetObstructionMinorType(graphP theGraph): * return cgraphLib.gp_GetObstructionMinorType(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_GetObstructionMinorType(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":668 * * * cdef unsigned gp_GetObstructionMinorType(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_GetObstructionMinorType(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":673 * * # Wraps functions declared in "planarity/c/graphLib/planarityRelated/graphOuterplanarity.h": * cdef int gp_ExtendWith_Outerplanarity(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_ExtendWith_Outerplanarity(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_Outerplanarity(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":674 * # Wraps functions declared in "planarity/c/graphLib/planarityRelated/graphOuterplanarity.h": * cdef int gp_ExtendWith_Outerplanarity(graphP theGraph): * return cgraphLib.gp_ExtendWith_Outerplanarity(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_ExtendWith_Outerplanarity(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":673 * * # Wraps functions declared in "planarity/c/graphLib/planarityRelated/graphOuterplanarity.h": * cdef int gp_ExtendWith_Outerplanarity(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_ExtendWith_Outerplanarity(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":677 * * * cdef int gp_Detach_Outerplanarity(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_Detach_Outerplanarity(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_Detach_Outerplanarity(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":678 * * cdef int gp_Detach_Outerplanarity(graphP theGraph): * return cgraphLib.gp_Detach_Outerplanarity(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_Detach_Outerplanarity(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":677 * * * cdef int gp_Detach_Outerplanarity(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_Detach_Outerplanarity(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":682 * * # Wraps functions declared in "planarity/c/graphLib/planarityRelated/graphDrawPlanar.h": * cdef int gp_ExtendWith_DrawPlanar(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_ExtendWith_DrawPlanar(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_DrawPlanar(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":683 * # Wraps functions declared in "planarity/c/graphLib/planarityRelated/graphDrawPlanar.h": * cdef int gp_ExtendWith_DrawPlanar(graphP theGraph): * return cgraphLib.gp_ExtendWith_DrawPlanar(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_ExtendWith_DrawPlanar(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":682 * * # Wraps functions declared in "planarity/c/graphLib/planarityRelated/graphDrawPlanar.h": * cdef int gp_ExtendWith_DrawPlanar(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_ExtendWith_DrawPlanar(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":686 * * * cdef int gp_Detach_DrawPlanar(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_Detach_DrawPlanar(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_Detach_DrawPlanar(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":687 * * cdef int gp_Detach_DrawPlanar(graphP theGraph): * return cgraphLib.gp_Detach_DrawPlanar(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_Detach_DrawPlanar(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":686 * * * cdef int gp_Detach_DrawPlanar(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_Detach_DrawPlanar(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":690 * * * cdef int gp_DrawPlanar_RenderToFile(graphP theEmbedding, char *theFileName): # <<<<<<<<<<<<<< * return cgraphLib.gp_DrawPlanar_RenderToFile(theEmbedding, theFileName) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_RenderToFile(graphP __pyx_v_theEmbedding, char *__pyx_v_theFileName) { int __pyx_r; /* "planarity/full/graphLib.pyx":691 * * cdef int gp_DrawPlanar_RenderToFile(graphP theEmbedding, char *theFileName): * return cgraphLib.gp_DrawPlanar_RenderToFile(theEmbedding, theFileName) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_DrawPlanar_RenderToFile(__pyx_v_theEmbedding, __pyx_v_theFileName); goto __pyx_L0; /* "planarity/full/graphLib.pyx":690 * * * cdef int gp_DrawPlanar_RenderToFile(graphP theEmbedding, char *theFileName): # <<<<<<<<<<<<<< * return cgraphLib.gp_DrawPlanar_RenderToFile(theEmbedding, theFileName) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":694 * * * cdef int gp_DrawPlanar_RenderToString(graphP theEmbedding, char **pRenditionString): # <<<<<<<<<<<<<< * return cgraphLib.gp_DrawPlanar_RenderToString(theEmbedding, pRenditionString) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_RenderToString(graphP __pyx_v_theEmbedding, char **__pyx_v_pRenditionString) { int __pyx_r; /* "planarity/full/graphLib.pyx":695 * * cdef int gp_DrawPlanar_RenderToString(graphP theEmbedding, char **pRenditionString): * return cgraphLib.gp_DrawPlanar_RenderToString(theEmbedding, pRenditionString) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_DrawPlanar_RenderToString(__pyx_v_theEmbedding, __pyx_v_pRenditionString); goto __pyx_L0; /* "planarity/full/graphLib.pyx":694 * * * cdef int gp_DrawPlanar_RenderToString(graphP theEmbedding, char **pRenditionString): # <<<<<<<<<<<<<< * return cgraphLib.gp_DrawPlanar_RenderToString(theEmbedding, pRenditionString) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":698 * * * cdef int gp_DrawPlanar_GetVertexPosition(graphP theEmbedding, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_DrawPlanar_GetVertexPosition(theEmbedding, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetVertexPosition(graphP __pyx_v_theEmbedding, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":699 * * cdef int gp_DrawPlanar_GetVertexPosition(graphP theEmbedding, int v): * return cgraphLib.gp_DrawPlanar_GetVertexPosition(theEmbedding, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_DrawPlanar_GetVertexPosition(__pyx_v_theEmbedding, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":698 * * * cdef int gp_DrawPlanar_GetVertexPosition(graphP theEmbedding, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_DrawPlanar_GetVertexPosition(theEmbedding, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":702 * * * cdef int gp_DrawPlanar_GetVertexStart(graphP theEmbedding, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_DrawPlanar_GetVertexStart(theEmbedding, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetVertexStart(graphP __pyx_v_theEmbedding, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":703 * * cdef int gp_DrawPlanar_GetVertexStart(graphP theEmbedding, int v): * return cgraphLib.gp_DrawPlanar_GetVertexStart(theEmbedding, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_DrawPlanar_GetVertexStart(__pyx_v_theEmbedding, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":702 * * * cdef int gp_DrawPlanar_GetVertexStart(graphP theEmbedding, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_DrawPlanar_GetVertexStart(theEmbedding, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":706 * * * cdef int gp_DrawPlanar_GetVertexEnd(graphP theEmbedding, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_DrawPlanar_GetVertexEnd(theEmbedding, v) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetVertexEnd(graphP __pyx_v_theEmbedding, int __pyx_v_v) { int __pyx_r; /* "planarity/full/graphLib.pyx":707 * * cdef int gp_DrawPlanar_GetVertexEnd(graphP theEmbedding, int v): * return cgraphLib.gp_DrawPlanar_GetVertexEnd(theEmbedding, v) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_DrawPlanar_GetVertexEnd(__pyx_v_theEmbedding, __pyx_v_v); goto __pyx_L0; /* "planarity/full/graphLib.pyx":706 * * * cdef int gp_DrawPlanar_GetVertexEnd(graphP theEmbedding, int v): # <<<<<<<<<<<<<< * return cgraphLib.gp_DrawPlanar_GetVertexEnd(theEmbedding, v) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":710 * * * cdef int gp_DrawPlanar_GetEdgePosition(graphP theEmbedding, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_DrawPlanar_GetEdgePosition(theEmbedding, e) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetEdgePosition(graphP __pyx_v_theEmbedding, int __pyx_v_e) { int __pyx_r; /* "planarity/full/graphLib.pyx":711 * * cdef int gp_DrawPlanar_GetEdgePosition(graphP theEmbedding, int e): * return cgraphLib.gp_DrawPlanar_GetEdgePosition(theEmbedding, e) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_DrawPlanar_GetEdgePosition(__pyx_v_theEmbedding, __pyx_v_e); goto __pyx_L0; /* "planarity/full/graphLib.pyx":710 * * * cdef int gp_DrawPlanar_GetEdgePosition(graphP theEmbedding, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_DrawPlanar_GetEdgePosition(theEmbedding, e) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":714 * * * cdef int gp_DrawPlanar_GetEdgeStart(graphP theEmbedding, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_DrawPlanar_GetEdgeStart(theEmbedding, e) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetEdgeStart(graphP __pyx_v_theEmbedding, int __pyx_v_e) { int __pyx_r; /* "planarity/full/graphLib.pyx":715 * * cdef int gp_DrawPlanar_GetEdgeStart(graphP theEmbedding, int e): * return cgraphLib.gp_DrawPlanar_GetEdgeStart(theEmbedding, e) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_DrawPlanar_GetEdgeStart(__pyx_v_theEmbedding, __pyx_v_e); goto __pyx_L0; /* "planarity/full/graphLib.pyx":714 * * * cdef int gp_DrawPlanar_GetEdgeStart(graphP theEmbedding, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_DrawPlanar_GetEdgeStart(theEmbedding, e) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":718 * * * cdef int gp_DrawPlanar_GetEdgeEnd(graphP theEmbedding, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_DrawPlanar_GetEdgeEnd(theEmbedding, e) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetEdgeEnd(graphP __pyx_v_theEmbedding, int __pyx_v_e) { int __pyx_r; /* "planarity/full/graphLib.pyx":719 * * cdef int gp_DrawPlanar_GetEdgeEnd(graphP theEmbedding, int e): * return cgraphLib.gp_DrawPlanar_GetEdgeEnd(theEmbedding, e) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_DrawPlanar_GetEdgeEnd(__pyx_v_theEmbedding, __pyx_v_e); goto __pyx_L0; /* "planarity/full/graphLib.pyx":718 * * * cdef int gp_DrawPlanar_GetEdgeEnd(graphP theEmbedding, int e): # <<<<<<<<<<<<<< * return cgraphLib.gp_DrawPlanar_GetEdgeEnd(theEmbedding, e) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":723 * * # Wraps functions declared in "planarity/c/graphLib/homeomorphSearch/graphK23Search.h": * cdef int gp_ExtendWith_K23Search(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_ExtendWith_K23Search(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_K23Search(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":724 * # Wraps functions declared in "planarity/c/graphLib/homeomorphSearch/graphK23Search.h": * cdef int gp_ExtendWith_K23Search(graphP theGraph): * return cgraphLib.gp_ExtendWith_K23Search(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_ExtendWith_K23Search(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":723 * * # Wraps functions declared in "planarity/c/graphLib/homeomorphSearch/graphK23Search.h": * cdef int gp_ExtendWith_K23Search(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_ExtendWith_K23Search(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":727 * * * cdef int gp_Detach_K23Search(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_Detach_K23Search(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_Detach_K23Search(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":728 * * cdef int gp_Detach_K23Search(graphP theGraph): * return cgraphLib.gp_Detach_K23Search(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_Detach_K23Search(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":727 * * * cdef int gp_Detach_K23Search(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_Detach_K23Search(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":732 * * # Wraps functions declared in "planarity/c/graphLib/homeomorphSearch/graphK33Search.h": * cdef int gp_ExtendWith_K33Search(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_ExtendWith_K33Search(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_K33Search(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":733 * # Wraps functions declared in "planarity/c/graphLib/homeomorphSearch/graphK33Search.h": * cdef int gp_ExtendWith_K33Search(graphP theGraph): * return cgraphLib.gp_ExtendWith_K33Search(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_ExtendWith_K33Search(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":732 * * # Wraps functions declared in "planarity/c/graphLib/homeomorphSearch/graphK33Search.h": * cdef int gp_ExtendWith_K33Search(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_ExtendWith_K33Search(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":736 * * * cdef int gp_Detach_K33Search(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_Detach_K33Search(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_Detach_K33Search(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":737 * * cdef int gp_Detach_K33Search(graphP theGraph): * return cgraphLib.gp_Detach_K33Search(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_Detach_K33Search(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":736 * * * cdef int gp_Detach_K33Search(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_Detach_K33Search(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":741 * * # Wraps functions declared in "planarity/c/graphLib/homeomorphSearch/graphK4Search.h": * cdef int gp_ExtendWith_K4Search(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_ExtendWith_K4Search(theGraph) * */ static int __pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_K4Search(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":742 * # Wraps functions declared in "planarity/c/graphLib/homeomorphSearch/graphK4Search.h": * cdef int gp_ExtendWith_K4Search(graphP theGraph): * return cgraphLib.gp_ExtendWith_K4Search(theGraph) # <<<<<<<<<<<<<< * * */ __pyx_r = gp_ExtendWith_K4Search(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":741 * * # Wraps functions declared in "planarity/c/graphLib/homeomorphSearch/graphK4Search.h": * cdef int gp_ExtendWith_K4Search(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_ExtendWith_K4Search(theGraph) * */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* "planarity/full/graphLib.pyx":745 * * * cdef int gp_Detach_K4Search(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_Detach_K4Search(theGraph) */ static int __pyx_f_9planarity_4full_8graphLib_gp_Detach_K4Search(graphP __pyx_v_theGraph) { int __pyx_r; /* "planarity/full/graphLib.pyx":746 * * cdef int gp_Detach_K4Search(graphP theGraph): * return cgraphLib.gp_Detach_K4Search(theGraph) # <<<<<<<<<<<<<< */ __pyx_r = gp_Detach_K4Search(__pyx_v_theGraph); goto __pyx_L0; /* "planarity/full/graphLib.pyx":745 * * * cdef int gp_Detach_K4Search(graphP theGraph): # <<<<<<<<<<<<<< * return cgraphLib.gp_Detach_K4Search(theGraph) */ /* function exit code */ __pyx_L0:; return __pyx_r; } /* #### Code section: module_exttypes ### */ static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; /* #### Code section: initfunc_declarations ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/ static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/ /* #### Code section: init_module ### */ static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); /*--- Global init code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); /*--- Variable export code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); /*--- Function export code ---*/ { __pyx_t_1 = __Pyx_ApiExport_GetApiDict(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); const char * __pyx_export_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_graphP_graphP_graphP_void_int_G6); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely(!__pyx_export_signature)) __PYX_ERR(0, 1, __pyx_L1_error) #endif const char * __pyx_export_name = __pyx_export_signature + 889; void (*const __pyx_export_pointers[])(void) = {(void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DupGraph, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_New, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_g6_NewReader, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_g6_EndReached, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_g6_ReadGraph, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_g6_InitReaderWithFileName, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_g6_InitReaderWithString, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_g6_NewWriter, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_g6_WriteGraph, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_g6_InitWriterWithFileName, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_g6_InitWriterWithString, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ComputeLeastAncestors, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ComputeLowpoints, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_CreateRandomGraph, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DepthFirstSearch, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_Detach_DFSUtils, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_Detach_DrawPlanar, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_Detach_K23Search, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_Detach_K33Search, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_Detach_K4Search, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_Detach_Outerplanarity, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_Detach_Planarity, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_DFSUtils, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_DrawPlanar, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_K23Search, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_K33Search, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_K4Search, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_Outerplanarity, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ExtendWith_Planarity, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetEdgeCapacity, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetEmbedFlags, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetGraphFlags, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetM, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetN, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetNV, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_LowerBoundEdgeStorage, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_LowerBoundEdges, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_LowerBoundVertexStorage, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_LowerBoundVertices, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_LowerBoundVirtualVertices, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_RestoreVertex, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_RestoreVertices, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SortVertices, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_UpperBoundEdgeStorage, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_UpperBoundEdges, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_UpperBoundVertexStorage, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_UpperBoundVertices, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_UpperBoundVirtualVertices, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_RenderToFile, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_Read, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ReadFromString, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_RenderToString, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_WriteToString, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_Write, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_CopyAdjacencyLists, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_CopyGraph, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_TestEmbedResultIntegrity, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ContractEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_CreateRandomGraphEx, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DeleteEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetEdgeEnd, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetEdgePosition, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetEdgeStart, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetVertexEnd, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetVertexPosition, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DrawPlanar_GetVertexStart, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_EdgeInUse, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_EdgeNotInUse, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_EnsureEdgeCapacity, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_EnsureVertexCapacity, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetBicompRootFromDFSChild, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetDFSChildFromBicompRoot, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetDirection, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetEdgeFlagInverted, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetEdgeMarked, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetEdgeType, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetEdgeVisited, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetFirstEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetIndex, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetLastEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetLeastAncestor, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetLowpoint, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetMarked, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetNeighbor, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetNextEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetParent, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetPrevEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetTwin, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetVertexDegree, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetVertexInDegree, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetVertexOutDegree, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetVisited, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_HideVertex, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsBicompRoot, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsNotEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsNotSeparatedDFSChild, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsNotVertex, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsNotVirtualVertex, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsSeparatedDFSChild, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsVertex, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsVirtualVertex, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_VirtualVertexInUse, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_VirtualVertexNotInUse, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_FindEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetAdjacentEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetEdgeByLink, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsNeighbor, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IdentifyVertices, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_AddEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_DynamicAddEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_InsertEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_FindDirectedEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_IsNeighborDirected, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_Embed, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_GetObstructionMinorType, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_g6_FreeReader, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_g6_FreeWriter, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_Free, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ResetGraphStorage, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeFlagInverted, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeMarked, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeType, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ClearEdgeVisited, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ClearMarked, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ClearVisited, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_HideEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_InitEdgeFlags, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_InitFlags, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_RestoreEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetEdgeFlagInverted, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetEdgeMarked, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetEdgeVisited, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetMarked, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetVisited, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_XorEdgeFlagInverted, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_ResetEdgeType, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetDirection, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetEdgeType, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetFirstEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetIndex, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetLastEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetNeighbor, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetNextEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetPrevEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetAdjacentEdge, (void (*)(void))&__pyx_f_9planarity_4full_8graphLib_gp_SetEdgeByLink, (void (*)(void)) NULL}; void (*const *__pyx_export_pointer)(void) = __pyx_export_pointers; const char *__pyx_export_current_signature = __pyx_export_signature; while (*__pyx_export_pointer) { if (__Pyx_ExportFunction(__pyx_t_1, __pyx_export_name, *__pyx_export_pointer, __pyx_export_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) ++__pyx_export_pointer; __pyx_export_name = strchr(__pyx_export_name, '\0') + 1; __pyx_export_signature = strchr(__pyx_export_signature, '\0') + 1; if (*__pyx_export_signature != '\0') __pyx_export_current_signature = __pyx_export_signature; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); /*--- Variable import code ---*/ __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); /*--- Function import code ---*/ __Pyx_RefNannyFinishContext(); return 0; } #if CYTHON_PEP489_MULTI_PHASE_INIT static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ static int __pyx_pymod_exec_graphLib(PyObject* module); /*proto*/ static PyModuleDef_Slot __pyx_moduledef_slots[] = { {Py_mod_create, (void*)__pyx_pymod_create}, {Py_mod_exec, (void*)__pyx_pymod_exec_graphLib}, #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING {Py_mod_gil, __Pyx_FREETHREADING_COMPATIBLE}, #endif #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}, #endif {0, NULL} }; #endif #ifdef __cplusplus namespace { struct PyModuleDef __pyx_moduledef = #else static struct PyModuleDef __pyx_moduledef = #endif { PyModuleDef_HEAD_INIT, "graphLib", __pyx_k_Cython_wrapper_for_the_Edge_Add, /* m_doc */ #if CYTHON_USE_MODULE_STATE sizeof(__pyx_mstatetype), /* m_size */ #else (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */ #endif __pyx_methods /* m_methods */, #if CYTHON_PEP489_MULTI_PHASE_INIT __pyx_moduledef_slots, /* m_slots */ #else NULL, /* m_reload */ #endif #if CYTHON_USE_MODULE_STATE __pyx_m_traverse, /* m_traverse */ __pyx_m_clear, /* m_clear */ NULL /* m_free */ #else NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ #endif }; #ifdef __cplusplus } /* anonymous namespace */ #endif /* PyModInitFuncType */ #ifndef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #else #ifdef __cplusplus #define __Pyx_PyMODINIT_FUNC extern "C" PyObject * #else #define __Pyx_PyMODINIT_FUNC PyObject * #endif #endif __Pyx_PyMODINIT_FUNC PyInit_graphLib(void) CYTHON_SMALL_CODE; /*proto*/ __Pyx_PyMODINIT_FUNC PyInit_graphLib(void) #if CYTHON_PEP489_MULTI_PHASE_INIT { return PyModuleDef_Init(&__pyx_moduledef); } /* ModuleCreationPEP489 */ #if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) { { PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think if (!module) { PyErr_Clear(); // just try the 3.8-3.12 version module = PyImport_ImportModule("_xxsubinterpreters"); if (!module) goto bad; } PyObject *current = PyObject_CallMethod(module, "get_current", NULL); Py_DECREF(module); if (!current) goto bad; if (PyTuple_Check(current)) { PyObject *new_current = PySequence_GetItem(current, 0); Py_DECREF(current); current = new_current; if (!new_current) goto bad; } long long as_c_int = PyLong_AsLongLong(current); Py_DECREF(current); return as_c_int; } bad: PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n"); return -1; } #endif #if !CYTHON_USE_MODULE_STATE static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { static PY_INT64_T main_interpreter_id = -1; #if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000 PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); #elif CYTHON_COMPILING_IN_GRAAL PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get()); #elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\ || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000)) PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId(); #elif CYTHON_COMPILING_IN_LIMITED_API PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get()); #else PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); #endif if (unlikely(current_id == -1)) { return -1; } if (main_interpreter_id == -1) { main_interpreter_id = current_id; return 0; } else if (unlikely(main_interpreter_id != current_id)) { PyErr_SetString( PyExc_ImportError, "Interpreter change detected - this module can only be loaded into one interpreter per process."); return -1; } return 0; } #endif static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { if (allow_none || value != Py_None) { result = PyDict_SetItemString(moddict, to_name, value); } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Clear(); } else { result = -1; } return result; } static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; CYTHON_UNUSED_VAR(def); #if !CYTHON_USE_MODULE_STATE if (__Pyx_check_single_interpreter()) return NULL; #endif if (__pyx_m) return __Pyx_NewRef(__pyx_m); modname = PyObject_GetAttrString(spec, "name"); if (unlikely(!modname)) goto bad; module = PyModule_NewObject(modname); Py_DECREF(modname); if (unlikely(!module)) goto bad; moddict = PyModule_GetDict(module); if (unlikely(!moddict)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; return module; bad: Py_XDECREF(module); return NULL; } static CYTHON_SMALL_CODE int __pyx_pymod_exec_graphLib(PyObject *__pyx_pyinit_module) #endif { int stringtab_initialized = 0; #if CYTHON_USE_MODULE_STATE int pystate_addmodule_run = 0; #endif __pyx_mstatetype *__pyx_mstate = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannyDeclarations #if CYTHON_PEP489_MULTI_PHASE_INIT if (__pyx_m) { if (__pyx_m == __pyx_pyinit_module) return 0; PyErr_SetString(PyExc_RuntimeError, "Module 'graphLib' has already been imported. Re-initialisation is not supported."); return -1; } #else if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif /*--- Module creation code ---*/ #if CYTHON_PEP489_MULTI_PHASE_INIT __pyx_t_1 = __pyx_pyinit_module; Py_INCREF(__pyx_t_1); #else __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) #endif #if CYTHON_USE_MODULE_STATE { int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef); __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "graphLib" pseudovariable */ if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) pystate_addmodule_run = 1; } #else __pyx_m = __pyx_t_1; #endif #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED); #endif __pyx_mstate = __pyx_mstate_global; CYTHON_UNUSED_VAR(__pyx_t_1); __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_mstate->__pyx_d); __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) /* ImportRefnannyAPI */ #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("PyInit_graphLib", 0); __Pyx_init_runtime_version(); if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Library function declarations ---*/ /*--- Initialize various global constants etc. ---*/ if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) stringtab_initialized = 1; if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error) if (__pyx_module_is_main_planarity__full__graphLib) { if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) } { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "planarity.full.graphLib")) { if (unlikely((PyDict_SetItemString(modules, "planarity.full.graphLib", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) } } /*--- Builtin init code ---*/ if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Global type/function init code ---*/ (void)__Pyx_modinit_global_init_code(__pyx_mstate); (void)__Pyx_modinit_variable_export_code(__pyx_mstate); if (unlikely((__Pyx_modinit_function_export_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) (void)__Pyx_modinit_type_init_code(__pyx_mstate); (void)__Pyx_modinit_type_import_code(__pyx_mstate); (void)__Pyx_modinit_variable_import_code(__pyx_mstate); (void)__Pyx_modinit_function_import_code(__pyx_mstate); /*--- Execution code ---*/ /* "planarity/full/graphLib.pyx":17 * * # Surfaced from planarityc/graphLib/lowLevelUtils/apiutils.h * QUIETMODE_NONE = cgraphLib.QUIETMODE_NONE # <<<<<<<<<<<<<< * QUIETMODE_ERRORS = cgraphLib.QUIETMODE_ERRORS * QUIETMODE_MESSAGES = cgraphLib.QUIETMODE_MESSAGES */ __pyx_t_2 = __Pyx_PyLong_From_int(QUIETMODE_NONE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_QUIETMODE_NONE, __pyx_t_2) < (0)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":18 * # Surfaced from planarityc/graphLib/lowLevelUtils/apiutils.h * QUIETMODE_NONE = cgraphLib.QUIETMODE_NONE * QUIETMODE_ERRORS = cgraphLib.QUIETMODE_ERRORS # <<<<<<<<<<<<<< * QUIETMODE_MESSAGES = cgraphLib.QUIETMODE_MESSAGES * QUIETMODE_ALL = cgraphLib.QUIETMODE_ALL */ __pyx_t_2 = __Pyx_PyLong_From_int(QUIETMODE_ERRORS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_QUIETMODE_ERRORS, __pyx_t_2) < (0)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":19 * QUIETMODE_NONE = cgraphLib.QUIETMODE_NONE * QUIETMODE_ERRORS = cgraphLib.QUIETMODE_ERRORS * QUIETMODE_MESSAGES = cgraphLib.QUIETMODE_MESSAGES # <<<<<<<<<<<<<< * QUIETMODE_ALL = cgraphLib.QUIETMODE_ALL * */ __pyx_t_2 = __Pyx_PyLong_From_int(QUIETMODE_MESSAGES); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_QUIETMODE_MESSAGES, __pyx_t_2) < (0)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":20 * QUIETMODE_ERRORS = cgraphLib.QUIETMODE_ERRORS * QUIETMODE_MESSAGES = cgraphLib.QUIETMODE_MESSAGES * QUIETMODE_ALL = cgraphLib.QUIETMODE_ALL # <<<<<<<<<<<<<< * * # Surfaced from planarity/c/graphLib/graphLib.h */ __pyx_t_2 = __Pyx_PyLong_From_int(QUIETMODE_ALL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_QUIETMODE_ALL, __pyx_t_2) < (0)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":23 * * # Surfaced from planarity/c/graphLib/graphLib.h * OK = cgraphLib.OK # <<<<<<<<<<<<<< * NOTOK = cgraphLib.NOTOK * TRUE = cgraphLib.TRUE */ __pyx_t_2 = __Pyx_PyLong_From_int(OK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_OK, __pyx_t_2) < (0)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":24 * # Surfaced from planarity/c/graphLib/graphLib.h * OK = cgraphLib.OK * NOTOK = cgraphLib.NOTOK # <<<<<<<<<<<<<< * TRUE = cgraphLib.TRUE * FALSE = cgraphLib.FALSE */ __pyx_t_2 = __Pyx_PyLong_From_int(NOTOK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_NOTOK, __pyx_t_2) < (0)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":25 * OK = cgraphLib.OK * NOTOK = cgraphLib.NOTOK * TRUE = cgraphLib.TRUE # <<<<<<<<<<<<<< * FALSE = cgraphLib.FALSE * NIL = cgraphLib.NIL */ __pyx_t_2 = __Pyx_PyLong_From_int(TRUE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_TRUE, __pyx_t_2) < (0)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":26 * NOTOK = cgraphLib.NOTOK * TRUE = cgraphLib.TRUE * FALSE = cgraphLib.FALSE # <<<<<<<<<<<<<< * NIL = cgraphLib.NIL * */ __pyx_t_2 = __Pyx_PyLong_From_int(FALSE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_FALSE, __pyx_t_2) < (0)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":27 * TRUE = cgraphLib.TRUE * FALSE = cgraphLib.FALSE * NIL = cgraphLib.NIL # <<<<<<<<<<<<<< * * # Surfaced from planarity/c/graphLib/graph.h */ __pyx_t_2 = __Pyx_PyLong_From_int(NIL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_NIL, __pyx_t_2) < (0)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":30 * * # Surfaced from planarity/c/graphLib/graph.h * VERTEX_VISITED_MASK = cgraphLib.VERTEX_VISITED_MASK # <<<<<<<<<<<<<< * VERTEX_MARKED_MASK = cgraphLib.VERTEX_MARKED_MASK * */ __pyx_t_2 = __Pyx_PyLong_From_int(VERTEX_VISITED_MASK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_VERTEX_VISITED_MASK, __pyx_t_2) < (0)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":31 * # Surfaced from planarity/c/graphLib/graph.h * VERTEX_VISITED_MASK = cgraphLib.VERTEX_VISITED_MASK * VERTEX_MARKED_MASK = cgraphLib.VERTEX_MARKED_MASK # <<<<<<<<<<<<<< * * EDGE_VISITED_MASK = cgraphLib.EDGE_VISITED_MASK */ __pyx_t_2 = __Pyx_PyLong_From_int(VERTEX_MARKED_MASK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_VERTEX_MARKED_MASK, __pyx_t_2) < (0)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":33 * VERTEX_MARKED_MASK = cgraphLib.VERTEX_MARKED_MASK * * EDGE_VISITED_MASK = cgraphLib.EDGE_VISITED_MASK # <<<<<<<<<<<<<< * EDGE_MARKED_MASK = cgraphLib.EDGE_MARKED_MASK * */ __pyx_t_2 = __Pyx_PyLong_From_int(EDGE_VISITED_MASK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGE_VISITED_MASK, __pyx_t_2) < (0)) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":34 * * EDGE_VISITED_MASK = cgraphLib.EDGE_VISITED_MASK * EDGE_MARKED_MASK = cgraphLib.EDGE_MARKED_MASK # <<<<<<<<<<<<<< * * EDGE_TYPE_MASK = cgraphLib.EDGE_TYPE_MASK */ __pyx_t_2 = __Pyx_PyLong_From_int(EDGE_MARKED_MASK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGE_MARKED_MASK, __pyx_t_2) < (0)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":36 * EDGE_MARKED_MASK = cgraphLib.EDGE_MARKED_MASK * * EDGE_TYPE_MASK = cgraphLib.EDGE_TYPE_MASK # <<<<<<<<<<<<<< * EDGE_TYPE_CHILD = cgraphLib.EDGE_TYPE_CHILD * EDGE_TYPE_FORWARD = cgraphLib.EDGE_TYPE_FORWARD */ __pyx_t_2 = __Pyx_PyLong_From_int(EDGE_TYPE_MASK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_MASK, __pyx_t_2) < (0)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":37 * * EDGE_TYPE_MASK = cgraphLib.EDGE_TYPE_MASK * EDGE_TYPE_CHILD = cgraphLib.EDGE_TYPE_CHILD # <<<<<<<<<<<<<< * EDGE_TYPE_FORWARD = cgraphLib.EDGE_TYPE_FORWARD * EDGE_TYPE_PARENT = cgraphLib.EDGE_TYPE_PARENT */ __pyx_t_2 = __Pyx_PyLong_From_int(EDGE_TYPE_CHILD); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_CHILD, __pyx_t_2) < (0)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":38 * EDGE_TYPE_MASK = cgraphLib.EDGE_TYPE_MASK * EDGE_TYPE_CHILD = cgraphLib.EDGE_TYPE_CHILD * EDGE_TYPE_FORWARD = cgraphLib.EDGE_TYPE_FORWARD # <<<<<<<<<<<<<< * EDGE_TYPE_PARENT = cgraphLib.EDGE_TYPE_PARENT * EDGE_TYPE_BACK = cgraphLib.EDGE_TYPE_BACK */ __pyx_t_2 = __Pyx_PyLong_From_int(EDGE_TYPE_FORWARD); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_FORWARD, __pyx_t_2) < (0)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":39 * EDGE_TYPE_CHILD = cgraphLib.EDGE_TYPE_CHILD * EDGE_TYPE_FORWARD = cgraphLib.EDGE_TYPE_FORWARD * EDGE_TYPE_PARENT = cgraphLib.EDGE_TYPE_PARENT # <<<<<<<<<<<<<< * EDGE_TYPE_BACK = cgraphLib.EDGE_TYPE_BACK * EDGE_TYPE_NOTDEFINED = cgraphLib.EDGE_TYPE_NOTDEFINED */ __pyx_t_2 = __Pyx_PyLong_From_int(EDGE_TYPE_PARENT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_PARENT, __pyx_t_2) < (0)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":40 * EDGE_TYPE_FORWARD = cgraphLib.EDGE_TYPE_FORWARD * EDGE_TYPE_PARENT = cgraphLib.EDGE_TYPE_PARENT * EDGE_TYPE_BACK = cgraphLib.EDGE_TYPE_BACK # <<<<<<<<<<<<<< * EDGE_TYPE_NOTDEFINED = cgraphLib.EDGE_TYPE_NOTDEFINED * EDGE_TYPE_TREE = cgraphLib.EDGE_TYPE_TREE */ __pyx_t_2 = __Pyx_PyLong_From_int(EDGE_TYPE_BACK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_BACK, __pyx_t_2) < (0)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":41 * EDGE_TYPE_PARENT = cgraphLib.EDGE_TYPE_PARENT * EDGE_TYPE_BACK = cgraphLib.EDGE_TYPE_BACK * EDGE_TYPE_NOTDEFINED = cgraphLib.EDGE_TYPE_NOTDEFINED # <<<<<<<<<<<<<< * EDGE_TYPE_TREE = cgraphLib.EDGE_TYPE_TREE * */ __pyx_t_2 = __Pyx_PyLong_From_int(EDGE_TYPE_NOTDEFINED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_NOTDEFINED, __pyx_t_2) < (0)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":42 * EDGE_TYPE_BACK = cgraphLib.EDGE_TYPE_BACK * EDGE_TYPE_NOTDEFINED = cgraphLib.EDGE_TYPE_NOTDEFINED * EDGE_TYPE_TREE = cgraphLib.EDGE_TYPE_TREE # <<<<<<<<<<<<<< * * EDGEFLAG_INVERTED_MASK = cgraphLib.EDGEFLAG_INVERTED_MASK */ __pyx_t_2 = __Pyx_PyLong_From_int(EDGE_TYPE_TREE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGE_TYPE_TREE, __pyx_t_2) < (0)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":44 * EDGE_TYPE_TREE = cgraphLib.EDGE_TYPE_TREE * * EDGEFLAG_INVERTED_MASK = cgraphLib.EDGEFLAG_INVERTED_MASK # <<<<<<<<<<<<<< * * EDGEFLAG_DIRECTION_INONLY = cgraphLib.EDGEFLAG_DIRECTION_INONLY */ __pyx_t_2 = __Pyx_PyLong_From_int(EDGEFLAG_INVERTED_MASK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGEFLAG_INVERTED_MASK, __pyx_t_2) < (0)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":46 * EDGEFLAG_INVERTED_MASK = cgraphLib.EDGEFLAG_INVERTED_MASK * * EDGEFLAG_DIRECTION_INONLY = cgraphLib.EDGEFLAG_DIRECTION_INONLY # <<<<<<<<<<<<<< * EDGEFLAG_DIRECTION_OUTONLY = cgraphLib.EDGEFLAG_DIRECTION_OUTONLY * EDGEFLAG_DIRECTION_MASK = cgraphLib.EDGEFLAG_DIRECTION_MASK */ __pyx_t_2 = __Pyx_PyLong_From_int(EDGEFLAG_DIRECTION_INONLY); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGEFLAG_DIRECTION_INONLY, __pyx_t_2) < (0)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":47 * * EDGEFLAG_DIRECTION_INONLY = cgraphLib.EDGEFLAG_DIRECTION_INONLY * EDGEFLAG_DIRECTION_OUTONLY = cgraphLib.EDGEFLAG_DIRECTION_OUTONLY # <<<<<<<<<<<<<< * EDGEFLAG_DIRECTION_MASK = cgraphLib.EDGEFLAG_DIRECTION_MASK * */ __pyx_t_2 = __Pyx_PyLong_From_int(EDGEFLAG_DIRECTION_OUTONLY); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGEFLAG_DIRECTION_OUTONLY, __pyx_t_2) < (0)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":48 * EDGEFLAG_DIRECTION_INONLY = cgraphLib.EDGEFLAG_DIRECTION_INONLY * EDGEFLAG_DIRECTION_OUTONLY = cgraphLib.EDGEFLAG_DIRECTION_OUTONLY * EDGEFLAG_DIRECTION_MASK = cgraphLib.EDGEFLAG_DIRECTION_MASK # <<<<<<<<<<<<<< * * DEFAULT_EDGE_CAPACITY_FACTOR = cgraphLib.DEFAULT_EDGE_CAPACITY_FACTOR */ __pyx_t_2 = __Pyx_PyLong_From_int(EDGEFLAG_DIRECTION_MASK); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EDGEFLAG_DIRECTION_MASK, __pyx_t_2) < (0)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":50 * EDGEFLAG_DIRECTION_MASK = cgraphLib.EDGEFLAG_DIRECTION_MASK * * DEFAULT_EDGE_CAPACITY_FACTOR = cgraphLib.DEFAULT_EDGE_CAPACITY_FACTOR # <<<<<<<<<<<<<< * AT_EDGE_CAPACITY_LIMIT = cgraphLib.AT_EDGE_CAPACITY_LIMIT * */ __pyx_t_2 = __Pyx_PyLong_From_int(DEFAULT_EDGE_CAPACITY_FACTOR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_DEFAULT_EDGE_CAPACITY_FACTOR, __pyx_t_2) < (0)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":51 * * DEFAULT_EDGE_CAPACITY_FACTOR = cgraphLib.DEFAULT_EDGE_CAPACITY_FACTOR * AT_EDGE_CAPACITY_LIMIT = cgraphLib.AT_EDGE_CAPACITY_LIMIT # <<<<<<<<<<<<<< * * # Surfaced from planarity/c/graphLib/io/graphIO.h */ __pyx_t_2 = __Pyx_PyLong_From_int(AT_EDGE_CAPACITY_LIMIT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_AT_EDGE_CAPACITY_LIMIT, __pyx_t_2) < (0)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":54 * * # Surfaced from planarity/c/graphLib/io/graphIO.h * WRITE_ADJLIST = cgraphLib.WRITE_ADJLIST # <<<<<<<<<<<<<< * WRITE_ADJMATRIX = cgraphLib.WRITE_ADJMATRIX * WRITE_G6 = cgraphLib.WRITE_G6 */ __pyx_t_2 = __Pyx_PyLong_From_int(WRITE_ADJLIST); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_WRITE_ADJLIST, __pyx_t_2) < (0)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":55 * # Surfaced from planarity/c/graphLib/io/graphIO.h * WRITE_ADJLIST = cgraphLib.WRITE_ADJLIST * WRITE_ADJMATRIX = cgraphLib.WRITE_ADJMATRIX # <<<<<<<<<<<<<< * WRITE_G6 = cgraphLib.WRITE_G6 * */ __pyx_t_2 = __Pyx_PyLong_From_int(WRITE_ADJMATRIX); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_WRITE_ADJMATRIX, __pyx_t_2) < (0)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":56 * WRITE_ADJLIST = cgraphLib.WRITE_ADJLIST * WRITE_ADJMATRIX = cgraphLib.WRITE_ADJMATRIX * WRITE_G6 = cgraphLib.WRITE_G6 # <<<<<<<<<<<<<< * * GRAPHFLAGS_ZEROBASEDIO = cgraphLib.GRAPHFLAGS_ZEROBASEDIO */ __pyx_t_2 = __Pyx_PyLong_From_int(WRITE_G6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_WRITE_G6, __pyx_t_2) < (0)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":58 * WRITE_G6 = cgraphLib.WRITE_G6 * * GRAPHFLAGS_ZEROBASEDIO = cgraphLib.GRAPHFLAGS_ZEROBASEDIO # <<<<<<<<<<<<<< * * # Surfaced from planarity/c/graphLib/graphDFSUtils.h */ __pyx_t_2 = __Pyx_PyLong_From_int(GRAPHFLAGS_ZEROBASEDIO); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_GRAPHFLAGS_ZEROBASEDIO, __pyx_t_2) < (0)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":61 * * # Surfaced from planarity/c/graphLib/graphDFSUtils.h * DFSUTILS_NAME = cgraphLib.DFSUTILS_NAME # <<<<<<<<<<<<<< * * GRAPHFLAGS_EXTENDEDWITH_DFSUTILS = cgraphLib.GRAPHFLAGS_EXTENDEDWITH_DFSUTILS */ __pyx_t_2 = __Pyx_PyBytes_FromString(DFSUTILS_NAME); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_DFSUTILS_NAME, __pyx_t_2) < (0)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":63 * DFSUTILS_NAME = cgraphLib.DFSUTILS_NAME * * GRAPHFLAGS_EXTENDEDWITH_DFSUTILS = cgraphLib.GRAPHFLAGS_EXTENDEDWITH_DFSUTILS # <<<<<<<<<<<<<< * GRAPHFLAGS_DFSNUMBERED = cgraphLib.GRAPHFLAGS_DFSNUMBERED * GRAPHFLAGS_SORTEDBYDFI = cgraphLib.GRAPHFLAGS_SORTEDBYDFI */ __pyx_t_2 = __Pyx_PyLong_From_int(GRAPHFLAGS_EXTENDEDWITH_DFSUTILS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_GRAPHFLAGS_EXTENDEDWITH_DFSUTILS, __pyx_t_2) < (0)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":64 * * GRAPHFLAGS_EXTENDEDWITH_DFSUTILS = cgraphLib.GRAPHFLAGS_EXTENDEDWITH_DFSUTILS * GRAPHFLAGS_DFSNUMBERED = cgraphLib.GRAPHFLAGS_DFSNUMBERED # <<<<<<<<<<<<<< * GRAPHFLAGS_SORTEDBYDFI = cgraphLib.GRAPHFLAGS_SORTEDBYDFI * */ __pyx_t_2 = __Pyx_PyLong_From_int(GRAPHFLAGS_DFSNUMBERED); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_GRAPHFLAGS_DFSNUMBERED, __pyx_t_2) < (0)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":65 * GRAPHFLAGS_EXTENDEDWITH_DFSUTILS = cgraphLib.GRAPHFLAGS_EXTENDEDWITH_DFSUTILS * GRAPHFLAGS_DFSNUMBERED = cgraphLib.GRAPHFLAGS_DFSNUMBERED * GRAPHFLAGS_SORTEDBYDFI = cgraphLib.GRAPHFLAGS_SORTEDBYDFI # <<<<<<<<<<<<<< * * # Surfaced from planarity/c/graphLib/planarityRelated/graphPlanarity.h */ __pyx_t_2 = __Pyx_PyLong_From_int(GRAPHFLAGS_SORTEDBYDFI); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_GRAPHFLAGS_SORTEDBYDFI, __pyx_t_2) < (0)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":68 * * # Surfaced from planarity/c/graphLib/planarityRelated/graphPlanarity.h * PLANARITY_NAME = cgraphLib.PLANARITY_NAME # <<<<<<<<<<<<<< * * GRAPHFLAGS_EXTENDEDWITH_PLANARITY = cgraphLib.GRAPHFLAGS_EXTENDEDWITH_PLANARITY */ __pyx_t_2 = __Pyx_PyBytes_FromString(PLANARITY_NAME); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_PLANARITY_NAME, __pyx_t_2) < (0)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":70 * PLANARITY_NAME = cgraphLib.PLANARITY_NAME * * GRAPHFLAGS_EXTENDEDWITH_PLANARITY = cgraphLib.GRAPHFLAGS_EXTENDEDWITH_PLANARITY # <<<<<<<<<<<<<< * * NONEMBEDDABLE = cgraphLib.NONEMBEDDABLE */ __pyx_t_2 = __Pyx_PyLong_From_int(GRAPHFLAGS_EXTENDEDWITH_PLANARITY); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_GRAPHFLAGS_EXTENDEDWITH_PLANARIT, __pyx_t_2) < (0)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":72 * GRAPHFLAGS_EXTENDEDWITH_PLANARITY = cgraphLib.GRAPHFLAGS_EXTENDEDWITH_PLANARITY * * NONEMBEDDABLE = cgraphLib.NONEMBEDDABLE # <<<<<<<<<<<<<< * * EMBEDFLAGS_PLANAR = cgraphLib.EMBEDFLAGS_PLANAR */ __pyx_t_2 = __Pyx_PyLong_From_int(NONEMBEDDABLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_NONEMBEDDABLE, __pyx_t_2) < (0)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":74 * NONEMBEDDABLE = cgraphLib.NONEMBEDDABLE * * EMBEDFLAGS_PLANAR = cgraphLib.EMBEDFLAGS_PLANAR # <<<<<<<<<<<<<< * EMBEDFLAGS_DRAWPLANAR = cgraphLib.EMBEDFLAGS_DRAWPLANAR * EMBEDFLAGS_OUTERPLANAR = cgraphLib.EMBEDFLAGS_OUTERPLANAR */ __pyx_t_2 = __Pyx_PyLong_From_int(EMBEDFLAGS_PLANAR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_PLANAR, __pyx_t_2) < (0)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":75 * * EMBEDFLAGS_PLANAR = cgraphLib.EMBEDFLAGS_PLANAR * EMBEDFLAGS_DRAWPLANAR = cgraphLib.EMBEDFLAGS_DRAWPLANAR # <<<<<<<<<<<<<< * EMBEDFLAGS_OUTERPLANAR = cgraphLib.EMBEDFLAGS_OUTERPLANAR * EMBEDFLAGS_SEARCHFORK23 = cgraphLib.EMBEDFLAGS_SEARCHFORK23 */ __pyx_t_2 = __Pyx_PyLong_From_int(EMBEDFLAGS_DRAWPLANAR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_DRAWPLANAR, __pyx_t_2) < (0)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":76 * EMBEDFLAGS_PLANAR = cgraphLib.EMBEDFLAGS_PLANAR * EMBEDFLAGS_DRAWPLANAR = cgraphLib.EMBEDFLAGS_DRAWPLANAR * EMBEDFLAGS_OUTERPLANAR = cgraphLib.EMBEDFLAGS_OUTERPLANAR # <<<<<<<<<<<<<< * EMBEDFLAGS_SEARCHFORK23 = cgraphLib.EMBEDFLAGS_SEARCHFORK23 * EMBEDFLAGS_SEARCHFORK33 = cgraphLib.EMBEDFLAGS_SEARCHFORK33 */ __pyx_t_2 = __Pyx_PyLong_From_int(EMBEDFLAGS_OUTERPLANAR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_OUTERPLANAR, __pyx_t_2) < (0)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":77 * EMBEDFLAGS_DRAWPLANAR = cgraphLib.EMBEDFLAGS_DRAWPLANAR * EMBEDFLAGS_OUTERPLANAR = cgraphLib.EMBEDFLAGS_OUTERPLANAR * EMBEDFLAGS_SEARCHFORK23 = cgraphLib.EMBEDFLAGS_SEARCHFORK23 # <<<<<<<<<<<<<< * EMBEDFLAGS_SEARCHFORK33 = cgraphLib.EMBEDFLAGS_SEARCHFORK33 * EMBEDFLAGS_SEARCHFORK4 = cgraphLib.EMBEDFLAGS_SEARCHFORK4 */ __pyx_t_2 = __Pyx_PyLong_From_int(EMBEDFLAGS_SEARCHFORK23); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_SEARCHFORK23, __pyx_t_2) < (0)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":78 * EMBEDFLAGS_OUTERPLANAR = cgraphLib.EMBEDFLAGS_OUTERPLANAR * EMBEDFLAGS_SEARCHFORK23 = cgraphLib.EMBEDFLAGS_SEARCHFORK23 * EMBEDFLAGS_SEARCHFORK33 = cgraphLib.EMBEDFLAGS_SEARCHFORK33 # <<<<<<<<<<<<<< * EMBEDFLAGS_SEARCHFORK4 = cgraphLib.EMBEDFLAGS_SEARCHFORK4 * */ __pyx_t_2 = __Pyx_PyLong_From_int(EMBEDFLAGS_SEARCHFORK33); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_SEARCHFORK33, __pyx_t_2) < (0)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":79 * EMBEDFLAGS_SEARCHFORK23 = cgraphLib.EMBEDFLAGS_SEARCHFORK23 * EMBEDFLAGS_SEARCHFORK33 = cgraphLib.EMBEDFLAGS_SEARCHFORK33 * EMBEDFLAGS_SEARCHFORK4 = cgraphLib.EMBEDFLAGS_SEARCHFORK4 # <<<<<<<<<<<<<< * * MINORTYPE_NONE = cgraphLib.MINORTYPE_NONE */ __pyx_t_2 = __Pyx_PyLong_From_int(EMBEDFLAGS_SEARCHFORK4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_EMBEDFLAGS_SEARCHFORK4, __pyx_t_2) < (0)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":81 * EMBEDFLAGS_SEARCHFORK4 = cgraphLib.EMBEDFLAGS_SEARCHFORK4 * * MINORTYPE_NONE = cgraphLib.MINORTYPE_NONE # <<<<<<<<<<<<<< * MINORTYPE_A = cgraphLib.MINORTYPE_A * MINORTYPE_B = cgraphLib.MINORTYPE_B */ __pyx_t_2 = __Pyx_PyLong_From_int(MINORTYPE_NONE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_MINORTYPE_NONE, __pyx_t_2) < (0)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":82 * * MINORTYPE_NONE = cgraphLib.MINORTYPE_NONE * MINORTYPE_A = cgraphLib.MINORTYPE_A # <<<<<<<<<<<<<< * MINORTYPE_B = cgraphLib.MINORTYPE_B * MINORTYPE_C = cgraphLib.MINORTYPE_C */ __pyx_t_2 = __Pyx_PyLong_From_int(MINORTYPE_A); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_MINORTYPE_A, __pyx_t_2) < (0)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":83 * MINORTYPE_NONE = cgraphLib.MINORTYPE_NONE * MINORTYPE_A = cgraphLib.MINORTYPE_A * MINORTYPE_B = cgraphLib.MINORTYPE_B # <<<<<<<<<<<<<< * MINORTYPE_C = cgraphLib.MINORTYPE_C * MINORTYPE_D = cgraphLib.MINORTYPE_D */ __pyx_t_2 = __Pyx_PyLong_From_int(MINORTYPE_B); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_MINORTYPE_B, __pyx_t_2) < (0)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":84 * MINORTYPE_A = cgraphLib.MINORTYPE_A * MINORTYPE_B = cgraphLib.MINORTYPE_B * MINORTYPE_C = cgraphLib.MINORTYPE_C # <<<<<<<<<<<<<< * MINORTYPE_D = cgraphLib.MINORTYPE_D * MINORTYPE_E = cgraphLib.MINORTYPE_E */ __pyx_t_2 = __Pyx_PyLong_From_int(MINORTYPE_C); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_MINORTYPE_C, __pyx_t_2) < (0)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":85 * MINORTYPE_B = cgraphLib.MINORTYPE_B * MINORTYPE_C = cgraphLib.MINORTYPE_C * MINORTYPE_D = cgraphLib.MINORTYPE_D # <<<<<<<<<<<<<< * MINORTYPE_E = cgraphLib.MINORTYPE_E * MINORTYPE_E1 = cgraphLib.MINORTYPE_E1 */ __pyx_t_2 = __Pyx_PyLong_From_int(MINORTYPE_D); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_MINORTYPE_D, __pyx_t_2) < (0)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":86 * MINORTYPE_C = cgraphLib.MINORTYPE_C * MINORTYPE_D = cgraphLib.MINORTYPE_D * MINORTYPE_E = cgraphLib.MINORTYPE_E # <<<<<<<<<<<<<< * MINORTYPE_E1 = cgraphLib.MINORTYPE_E1 * MINORTYPE_E2 = cgraphLib.MINORTYPE_E2 */ __pyx_t_2 = __Pyx_PyLong_From_int(MINORTYPE_E); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_MINORTYPE_E, __pyx_t_2) < (0)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":87 * MINORTYPE_D = cgraphLib.MINORTYPE_D * MINORTYPE_E = cgraphLib.MINORTYPE_E * MINORTYPE_E1 = cgraphLib.MINORTYPE_E1 # <<<<<<<<<<<<<< * MINORTYPE_E2 = cgraphLib.MINORTYPE_E2 * MINORTYPE_E3 = cgraphLib.MINORTYPE_E3 */ __pyx_t_2 = __Pyx_PyLong_From_int(MINORTYPE_E1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_MINORTYPE_E1, __pyx_t_2) < (0)) __PYX_ERR(0, 87, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":88 * MINORTYPE_E = cgraphLib.MINORTYPE_E * MINORTYPE_E1 = cgraphLib.MINORTYPE_E1 * MINORTYPE_E2 = cgraphLib.MINORTYPE_E2 # <<<<<<<<<<<<<< * MINORTYPE_E3 = cgraphLib.MINORTYPE_E3 * MINORTYPE_E4 = cgraphLib.MINORTYPE_E4 */ __pyx_t_2 = __Pyx_PyLong_From_int(MINORTYPE_E2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_MINORTYPE_E2, __pyx_t_2) < (0)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":89 * MINORTYPE_E1 = cgraphLib.MINORTYPE_E1 * MINORTYPE_E2 = cgraphLib.MINORTYPE_E2 * MINORTYPE_E3 = cgraphLib.MINORTYPE_E3 # <<<<<<<<<<<<<< * MINORTYPE_E4 = cgraphLib.MINORTYPE_E4 * MINORTYPE_E5 = cgraphLib.MINORTYPE_E5 */ __pyx_t_2 = __Pyx_PyLong_From_int(MINORTYPE_E3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_MINORTYPE_E3, __pyx_t_2) < (0)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":90 * MINORTYPE_E2 = cgraphLib.MINORTYPE_E2 * MINORTYPE_E3 = cgraphLib.MINORTYPE_E3 * MINORTYPE_E4 = cgraphLib.MINORTYPE_E4 # <<<<<<<<<<<<<< * MINORTYPE_E5 = cgraphLib.MINORTYPE_E5 * MINORTYPE_E6 = cgraphLib.MINORTYPE_E6 */ __pyx_t_2 = __Pyx_PyLong_From_int(MINORTYPE_E4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_MINORTYPE_E4, __pyx_t_2) < (0)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":91 * MINORTYPE_E3 = cgraphLib.MINORTYPE_E3 * MINORTYPE_E4 = cgraphLib.MINORTYPE_E4 * MINORTYPE_E5 = cgraphLib.MINORTYPE_E5 # <<<<<<<<<<<<<< * MINORTYPE_E6 = cgraphLib.MINORTYPE_E6 * MINORTYPE_E7 = cgraphLib.MINORTYPE_E7 */ __pyx_t_2 = __Pyx_PyLong_From_int(MINORTYPE_E5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_MINORTYPE_E5, __pyx_t_2) < (0)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":92 * MINORTYPE_E4 = cgraphLib.MINORTYPE_E4 * MINORTYPE_E5 = cgraphLib.MINORTYPE_E5 * MINORTYPE_E6 = cgraphLib.MINORTYPE_E6 # <<<<<<<<<<<<<< * MINORTYPE_E7 = cgraphLib.MINORTYPE_E7 * */ __pyx_t_2 = __Pyx_PyLong_From_int(MINORTYPE_E6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_MINORTYPE_E6, __pyx_t_2) < (0)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":93 * MINORTYPE_E5 = cgraphLib.MINORTYPE_E5 * MINORTYPE_E6 = cgraphLib.MINORTYPE_E6 * MINORTYPE_E7 = cgraphLib.MINORTYPE_E7 # <<<<<<<<<<<<<< * * # Surfaced from planarity/c/graphLib/planarityRelated/graphOuterplanarity.h */ __pyx_t_2 = __Pyx_PyLong_From_int(MINORTYPE_E7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_MINORTYPE_E7, __pyx_t_2) < (0)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":96 * * # Surfaced from planarity/c/graphLib/planarityRelated/graphOuterplanarity.h * OUTERPLANARITY_NAME = cgraphLib.OUTERPLANARITY_NAME # <<<<<<<<<<<<<< * GRAPHFLAGS_EXTENDEDWITH_OUTERPLANARITY = cgraphLib.GRAPHFLAGS_EXTENDEDWITH_OUTERPLANARITY * */ __pyx_t_2 = __Pyx_PyBytes_FromString(OUTERPLANARITY_NAME); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_OUTERPLANARITY_NAME, __pyx_t_2) < (0)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":97 * # Surfaced from planarity/c/graphLib/planarityRelated/graphOuterplanarity.h * OUTERPLANARITY_NAME = cgraphLib.OUTERPLANARITY_NAME * GRAPHFLAGS_EXTENDEDWITH_OUTERPLANARITY = cgraphLib.GRAPHFLAGS_EXTENDEDWITH_OUTERPLANARITY # <<<<<<<<<<<<<< * * # Surfaced from planarity/c/graphLib/planarityRelated/graphDrawPlanar.h */ __pyx_t_2 = __Pyx_PyLong_From_int(GRAPHFLAGS_EXTENDEDWITH_OUTERPLANARITY); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_GRAPHFLAGS_EXTENDEDWITH_OUTERPLA, __pyx_t_2) < (0)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":100 * * # Surfaced from planarity/c/graphLib/planarityRelated/graphDrawPlanar.h * DRAWPLANAR_NAME = cgraphLib.DRAWPLANAR_NAME # <<<<<<<<<<<<<< * * # Surfaced from planarity/c/graphLib/homeomorphSearch/graphK23Search.h */ __pyx_t_2 = __Pyx_PyBytes_FromString(DRAWPLANAR_NAME); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_DRAWPLANAR_NAME, __pyx_t_2) < (0)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":103 * * # Surfaced from planarity/c/graphLib/homeomorphSearch/graphK23Search.h * K23SEARCH_NAME = cgraphLib.K23SEARCH_NAME # <<<<<<<<<<<<<< * * # Surfaced from planarity/c/graphLib/homeomorphSearch/graphK33Search.h */ __pyx_t_2 = __Pyx_PyBytes_FromString(K23SEARCH_NAME); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_K23SEARCH_NAME, __pyx_t_2) < (0)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":106 * * # Surfaced from planarity/c/graphLib/homeomorphSearch/graphK33Search.h * K33SEARCH_NAME = cgraphLib.K33SEARCH_NAME # <<<<<<<<<<<<<< * * # Surfaced from planarity/c/graphLib/homeomorphSearch/graphK4Search.h */ __pyx_t_2 = __Pyx_PyBytes_FromString(K33SEARCH_NAME); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_K33SEARCH_NAME, __pyx_t_2) < (0)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":109 * * # Surfaced from planarity/c/graphLib/homeomorphSearch/graphK4Search.h * K4SEARCH_NAME = cgraphLib.K4SEARCH_NAME # <<<<<<<<<<<<<< * * */ __pyx_t_2 = __Pyx_PyBytes_FromString(K4SEARCH_NAME); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_K4SEARCH_NAME, __pyx_t_2) < (0)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":113 * * # Functions to be made available when importing package from Python * def gp_GetQuietMode() -> int: # <<<<<<<<<<<<<< * return cgraphLib.gp_GetQuietMode() * */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_int) < (0)) __PYX_ERR(0, 113, __pyx_L1_error) __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_8graphLib_1gp_GetQuietMode, 0, __pyx_mstate_global->__pyx_n_u_gp_GetQuietMode, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graphLib, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_gp_GetQuietMode, __pyx_t_3) < (0)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "planarity/full/graphLib.pyx":117 * * * def gp_SetQuietMode(int newQuietMode) -> None: # <<<<<<<<<<<<<< * cgraphLib.gp_SetQuietMode(newQuietMode) * */ __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_None) < (0)) __PYX_ERR(0, 117, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_8graphLib_3gp_SetQuietMode, 0, __pyx_mstate_global->__pyx_n_u_gp_SetQuietMode, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graphLib, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_gp_SetQuietMode, __pyx_t_2) < (0)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":121 * * * def gp_GetProjectVersionFull() -> str: # <<<<<<<<<<<<<< * cdef bytes encoded_version = cgraphLib.gp_GetProjectVersionFull() * return encoded_version.decode('utf-8') */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_str) < (0)) __PYX_ERR(0, 121, __pyx_L1_error) __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_8graphLib_5gp_GetProjectVersionFull, 0, __pyx_mstate_global->__pyx_n_u_gp_GetProjectVersionFull, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graphLib, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_3); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_gp_GetProjectVersionFull, __pyx_t_3) < (0)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "planarity/full/graphLib.pyx":126 * * * def gp_GetLibPlanarityVersionFull() -> str: # <<<<<<<<<<<<<< * cdef bytes encoded_version = cgraphLib.gp_GetLibPlanarityVersionFull() * return encoded_version.decode('utf-8') */ __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_return, __pyx_mstate_global->__pyx_n_u_str) < (0)) __PYX_ERR(0, 126, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9planarity_4full_8graphLib_7gp_GetLibPlanarityVersionFull, 0, __pyx_mstate_global->__pyx_n_u_gp_GetLibPlanarityVersionFull, NULL, __pyx_mstate_global->__pyx_n_u_planarity_full_graphLib, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000 PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2); #endif __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_gp_GetLibPlanarityVersionFull, __pyx_t_2) < (0)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "planarity/full/graphLib.pyx":1 * #!/usr/bin/env python # <<<<<<<<<<<<<< * # cython: embedsignature=True * """ */ __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_2) < (0)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); if (__pyx_m) { if (__pyx_mstate->__pyx_d && stringtab_initialized) { __Pyx_AddTraceback("init planarity.full.graphLib", __pyx_clineno, __pyx_lineno, __pyx_filename); } #if !CYTHON_USE_MODULE_STATE Py_CLEAR(__pyx_m); #else Py_DECREF(__pyx_m); if (pystate_addmodule_run) { PyObject *tp, *value, *tb; PyErr_Fetch(&tp, &value, &tb); PyState_RemoveModule(&__pyx_moduledef); PyErr_Restore(tp, value, tb); } #endif } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init planarity.full.graphLib"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if CYTHON_PEP489_MULTI_PHASE_INIT return (__pyx_m != NULL) ? 0 : -1; #else return __pyx_m; #endif } /* #### Code section: pystring_table ### */ /* #### Code section: cached_builtins ### */ static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); /* Cached unbound methods */ __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items; __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type; __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop; __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type; __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values; return 0; } /* #### Code section: cached_constants ### */ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) { __Pyx_RefNannyDeclarations CYTHON_UNUSED_VAR(__pyx_mstate); __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); __Pyx_RefNannyFinishContext(); return 0; } /* #### Code section: init_constants ### */ static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) { CYTHON_UNUSED_VAR(__pyx_mstate); { const struct { const unsigned int length: 12; } index[] = {{1},{27},{22},{28},{13},{15},{25},{23},{26},{22},{16},{14},{15},{17},{14},{20},{16},{14},{17},{21},{22},{17},{23},{23},{22},{5},{22},{32},{38},{33},{22},{22},{14},{14},{13},{11},{11},{11},{11},{11},{12},{12},{12},{12},{12},{12},{12},{14},{3},{13},{5},{4},{2},{19},{14},{20},{13},{16},{18},{14},{4},{18},{19},{13},{15},{8},{18},{18},{15},{8},{29},{24},{15},{15},{3},{13},{5},{8},{10},{8},{12},{23},{3},{12},{12},{6},{12},{10},{3},{8},{6},{3628},{13},{24},{12},{24}}; #if (CYTHON_COMPRESS_STRINGS) == 3 && __PYX_LIMITED_VERSION_HEX >= 0x030e0000 /* compression: zstd (1587 bytes) */ const char* const cstring = "(\265/\375`\300\022M1\000v\375\2774@o\333s\004B\3061\2723]u\306\335\354\031\022\355\264\310C\225\177L\241bN\350\361i\202M\342F\345\277\227\232\260VC\255\003\304e\322\327%\213.m\003\265\000\254\000\255\000\362\222\030\027\026\025\024\023\022\220\2322o^2r*\256HA\3722\327\204 \261\242>2\027\255\233,z(HI\230y@\n\316\216\334`oj \265^UAA1\261\261\231\346\203t\302J)\230\341D\032; \234Y&\341|\030\224\361\222\363y\346UQV\334L\323\313T\210}d\223\202\331\204\0352f\235k\203>\316\207%/\031\253\274b6\301\031\251\252yV5\237|\026\346y\223\202\234'+\265b\326\241\0255\257lz\225\325y\025\244\262\310\211V\375\310\342\364\2607U\250\241`\315\336\210\304A|\260\025\342\354\006El[\027\022A\352x\333l7.#\266\244\326\316\277\327\272;\357[gC\376\366\347\265\346\335\365\337\233\355H0g5\256VNs\020\020&\377\"\233\177\353\256\2565c+\252\225\213\276\343\312q\355\031SN\177\334qt\355E\364\306\266\255\253:\260\017\266\372k*\007\252U\313]H\255Yc\276\277\244\336\277Z\313?\242\331\317kv\367\232q\3354\376\031\367No\255Ah\254e\022\267\027\032\2178\263\307\311h\2644(\217\007\354\314\014j\036\245\220C\3475'\264\254W!uq2\030;\034!?\373\350e\355\032\246F$\254\326\215\353\263\226\033WvIhe\036eE\t\003\235c\213\244\345\327\254\310}$N\244w\245\263\3757s\\\247oM\177n\266\353\033kx\364\235?\310n\335\351\315\235\316\354\357\220\034\016\262[u\377#\322,g\247\007]XAq\363\367\021\304\366UAab7\337p\357\332\266O;\337\334S\"}\263\235\337\355o\315\231h\276u\347\257\345\327\271}\353{\307\211\364T9P\306\273\323\027Y\371\033\256B\035{:\316\361~H\273\031\356\277\000]L^j\270\216\272\237A\230\347\356=\016\230mC\032\346\001\363\340\200\301\266\356v\177\217\327\376\274\3200`.\r\027\353\222K\003\003\006\343\337m\001-\000,\033\222\224\205K\311\242p\240\034\014\264\020\2504\\J\010)\004)\013(\031'\002\001-\022+\223C\311!\240\005!%\341Rz)\n\005\245\202\200\026\002\024\203K\211R\355A)\307\333\3766q\377\273\252\027[g\314\351v\347\237\353y\216\032\026\331L\242\356#\205\340\033Gr\346f\\\331m\271\247<^\274\311\361\177\203\236\302&Y\311\357""\236\177[l\264\365'\004\302/\2555\372\233#\346\270\3439R6\262-\347\226\344\250\375\306w\303\241\251k=9\221\326p\346w\307s\327\362y'\307\276m\247Y\343\216\271\306n\206\337\177\033A\315\356\236A\337s\344\237\361\201\233\250\341!B4$\"\222\224\024$\031\016a\014\202P\311\\\235\007\342x(\211\201\030\210f\312\210\230\220\230\244N\215\326\030\307\216\314\266\031\223\013\227z_3\227\307\360\326\313\356#7\021\250\026\221i`\211\344\354\037-\311\367\017nE\340\225\256\004\224\002\333\371\376\206QkZ 0]\"\371h\024;\001e\270\027t\334\216\227\222\346\325\350\214\377\034T.:\317\372e\316\007\274}\245+~!\016\203\303Ut`\251\256\237\266NIJ\304\233\377\006!\201(\227?\315\001\3720\314\221\261\322\206\302\315\202\274\343]pr\247\013\252\357=\362\310-\353\363\206~\270J4\230e8\203\024FFd\002\372SF6\247E{\3126\2256\250\224@\2404\217ZW\301\305P\300,\020\002\244\337\357I\316\r\262\241!L\336$\377\330\024\177l\210l$f\355\334?S\350T\306s\006kFn\267\274G9\273\n\277\364\244:D\272NH\235WVt\256\216\271\345j\030\200\231U\007J+\005p\001P\007\276k\275s\320\322J\032:\362\326\223ipEgm\336\306\224\341\333\305\253\357a\322\356\355?\301.\230\0262kWj\320\021Y8)ssJ1\313hK\002\021~%8\033j\317\005\254G k\275\276Pt\\7p\215\3555\320\221\346yX\365\236\204\336\257\236\003\260\377\374)\177\277\353\2013U\305\260c\322\034F!9\030y\262\\\001\017\320\304N!ZK\264\340\016U,\262\3600m\325\347\034\177\004\254\206;\026\237\217\216\30453\317y\334_\036\365\032\344\277H\240\r\342V\027\244lvg\036P\244g\033\007\226i\303\252\250\231i\344\320\005x%\210Q\031\207\245,\027#|cR\352\204\023\264m\rn~\333\225\357\254\371\264\0321\376qA\215=\310\332e\024\031A\216oG\221\316\001\367\226Z\333N\312\231\321S\302W\272ssu<\301\r*c\332\323E\026}\327\327c\245b\334\020\325\"\001\256\346O\266Q\213r\3359o\270\270\311\352w0L\361\035\216\006\222\212\232M%\t\320\334\357N\310\244\246\202\345\0167z\266""\010\246\253\323\263\031\024By$\017\300\374r\351\006(L\366\177N\203\244\212\237\344\002\360\\\016sx\236\nV\302\257\350\275\0367\211\336\226a\206B\301\034z\353XQj\240\331\341\372\310\207i\353\255\022\355\217\331W\240\243\307f[e\264\362\236\013y\255\360\2138,\270\213\036?\314\010\027\231\336W5\014IR\212h\277\265\241\306\340\000\004'\312\262\233\222g\311z\377z\003U\033\245ORK\234g\304\244c0\210\324\273KB\022\265\317-Ekz;\2772\312P\366\t\346\300\316\202\303\257\024\202\252\217\261\235\2149=!\211\362\243/\220*"; PyObject *data = __Pyx_DecompressString(cstring, 1587, 3); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif #elif (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (1792 bytes) */ const char* const cstring = "BZh91AY&SYW{J\334\000\000\372\177\366f\016$\"t\375\277\200\277\377\377\360\277\377\377\340\000@\000@@@@@@@`\007\335\310>\033a\313C\2404% \000\035\303$\232\206\232\236\232\232~\246\241\2656P\304h\000a2\03244a\003\32411\250sF\215\r0\200i\2014\320\006CC\020\006\214F\206\010\310\000\323Di5'\224\000\003@\0004\000\000\000\0004\000\t5$*?T\364\004\323&\203\32444\0324\000\000dh\000\r\003j\034\321\243CL \032`M4\001\220\320\304\001\243\021\241\2022\000$H \324\304\311\242l\232*zO\364\203\"\2156P\003!\243@\014\236\211\247\006\013\006*\211\300\261\371\356>\272_\306\367\256\377\255\366\024\272\333\367P\357\320\032J\221\214\274\254\252\312v\216\345\314\203\316h\320\014V.\3158\006e\223V2inn\312%\342fQ\204\026F\207\361dx\002y\231\311\245b\013\010\250\r2\241\226\261j\374\033+}h\027\351\315\021\005\212\252\373e\023\2034.\326\032\377\037\356\r|0\313\223V(/\251\244\212#\n\324\214b=i\013\222,\024\201\223\204\216\306q]\031$\306b\3555M\016,\264\261*\243}\362\302\002\347\231\345\327\201x\340\"QT\"\n\252\"?\256f\377\332\253\317\233x)\016\377\202\325J\266\263\023v\006Y\006\2739\215\335\003s\325\317>>\340\010\227\255(\220\037Q\375\005\210\277\265U\354<\307\204\001\352\302\323\017\367\273\254<'\366\\\007\327-_w\235\276\"<\312\231\223j\325\032\324OK\332\024B\357\306\303u\321\261\177s \377S\026^&X\2272\210\006\264\214\204\032\177-f\203\247U\323&\220t\n\365\237\253K\026:;\235\244-CvR\333\266\321R\255\271V\2648\205\2240\266\253\221;\357G\275x\325\354\351-\264\245\374\300\255e\322@[c\245\000\242\005,\312\304\224P\005\027U\365iC5\254sn\271\271\202\232\352\231*\212L\013TR\213Qw*\323\342\300\3737\347\177\346\032hd\003S\222\017*\222.\"\340\276\"SS\207\300\372\320N\320\356i\030>\034N\252\000T\004]\207/\227|g:\205\342\035m2\343\323\350\016{xT\360\235\234\020\236\312&\273\212\323\244\360^)\231\306\256\341\263\240\206I'\354\010H\333F\333l\314Y\316\204vA\021\006+\0071\320f@\035 )p7\373\022\337R\204\024E\003\255MI\021p\206\226\212 8\302[p\025\243H\353\032\372\351\344\255\037\334\037\217\323\001\234iA\023\211""\000a,\000O-\302T\202\tA`\224X\206b\345\231\244\275m\330\240~R\237(\\|\002\3555\340\021$\373\225sQ\nL\300\301\343\214\034MAEAc\020\016)m\240\205\023g:\345u-\216\361\013\317\017\027:\212g\335\267\240\231o\352\367\213\260\320\226\375\313N\351\206I\204QA>\206\022\032hSs\310\347\222\355\014\363\320\246\225<\226]a5\310\345\206\303\240\204\253\\\262)0\326\213\032Y\257/c\216\027\2404n\353\210n\017/q\233\247O\027#\355^*D\205\0075\254,\224\263l\247M\205\264m\210cj\003ee\313'\251\300Y\366\205tgX\006h3\000a\001V\\E\212\251<\027\354\245\221ALA\026S\0101\213\206\020\026\361W\247\275i0\345\266\320\271+\316H|\261\304\322\266\262\236\315\306\"\024\202a\336\304\320\272}\374\016\365I\321\004\306\"IX2jK;A\316p\244D\013&1\244\206\3065\276\350T\006\n\341Y\010\263U\235$\232w\355\314\255&\255\274\350\262\267`Y9\310\345\246\342\355\004\"\300h\013@by\341Q\223\252\243]\233?\364|{'k\233\303Nj\334Rp\330\252\367\331\362TJ\267/]$\221\300!\014=?\202_\035\246`\242\003\250\364\253P\203\242\206\344\260\024\001\230\204\276y%\346-$\316&\370/H\363b<\367\223\326\263\004\271\274z\276\360\222R.JI}*6C\227W\314?\267\344\271\016N\025\004u\331\022\372%\3621K\262\255P:PR\223B~\242\247\226\306x\273\013\0063\222\001X\240\236\375g\306.\205\220\333$\303\024\322\315\021&6\211\260\246}D\205&\322j\301\336\344[\n\030V\252\024\353r\263\264\024\205\340\227Yi\333\337\001\2777\365m\215\277\010\010m\340\232\221\242\242\306\016j\236\001+';p\204\254-\221fa\330\312\236\315mU\033K(O)\323\326B\200\230\232\310.\206y\227o\033\356\213\267\242\305X\2532U(\264\322\260y\262\245+\024P\033iH\356\350Z\3633,P\330([\316?.Y\355G\324\221\311\027\244\230\304\306\t]%\200\002\364\206p\300&,'\017\034\373zM\225\022\n\006\001\2209SVFiFI\022\225UUVMpz\341v\304\347\341'\271m\360\003\314\355T\314\031/\000\370)\235\371n\231\272\207\241\032On}\300n\372`_&\211!-4\335xd7\2543\257\304-,Y\370\213H\026\013\010\017\320\221\"\014\030\333k\271f\262B\234j5\2130\036\361\035\215\266>Io\355\026\213K\346\027T\2021GG\261H[f\213\232\261\373Za\021\246)\205\337E\310""\014<\211`b\\P!\212H1,1\257ze\355\024\023N\305i+Z@\230\347\026J@\375KG\005\341\353\003a\251n\035V\302\3409\307\255Y\007\037h|\360\203\320\300\270~\317A\250\301\264x\210\316rKv\245\274\022\002\316\265\324v#R$$\027\023\373\371\232\377:'\201y\355\343\337\365Ub:\204%\002\"\033\006\202\007\020\014\016\225${\222\311\t9\224A\342\"\022\246\246\337a\332\026\257\231W6\363\024s\005Z!_K\025\346#j\365R$\301)\n\350\351\203\361\311\336\240m\036\224\215vK`q\203H\341^\250,\014I6\351\014X\355\254\254+R\311\r\244\ng1\2313\272\264\241\360\262R%Q\\\304I\221H\030\314\230\nE)I\333\020+b\n\223\245\263\003\220\350\330\2570\"\347lBc$J\311^\223\014\220Xh\265\0013\265\240\204\254\310\2512\345\233\004\031\221\010\276\331\"Dh\274Y\356H\310_\204\351\372W\315\3617\030g\226\301\034<\216\332\231\276\033FXdk5\005\350\377\277\363\350\256\201\rZ\2176{\244\007\213HcJ%\340C\325S\224D\275w\337t\211\215\246Q\375\3143\303 \3204\310\326\236\213\336Wi^\313\030\2227\243a\177\305\334\221N\024$\025\336\322\267\000"; PyObject *data = __Pyx_DecompressString(cstring, 1792, 2); if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error) const char* const bytes = __Pyx_PyBytes_AsString(data); #if !CYTHON_ASSUME_SAFE_MACROS if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } #endif #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (1613 bytes) */ const char* const cstring = "x\332\225W\315n\333F\020V\201\334\212\036\002\344\322C\001\247(\220\330\010\034$v\335c@\211\224\314\232\242\024.\345\237^\026kr-o\"\221\014\271\262\2457\350#\370\350c\037\243\307\036}\364\343t\226\344\222\273\342:M\005$\234\371\276\331\341\314\356\314,\375![\220\204\344\214o\336^\255\026\213\267\363\234d\327\036\273\334\3176k+\304\216=r\360\300\232Z\0037\274\300\236;vC\333\031Z3o\233\032Z\203p\022\330C4\013]\017a\337\032;v`\235M=\313\267\202R\025\366C\317\032a\333\r\234A\350N|\354\372\023\337\2730\020c\013\235\030\340\311,\324\026\270\376\251\023\204\216\335\330\203\020\234\250zx1up\337\032(\332\340\330\365\354V\035N\2023+P\000}\255?\021\t\273\276\243XL\255\300\361\303V\017\003\247\314\016\237\272\310m\302\031\367\035[D\211p\273\021\n\010\2718A\007\355\000\310\261\202\3011\004y\362\376\300\010\037\230\341\303\241\345!g\024X\323\343:\210!\362g`\031@\244-\352\234\207\216\017\251\235\271\3411\226\247\367\024\257\204\014G\376\224\225\311\000M\3041\365/\354\241\253\240\1778\301\244o!\307v'\220]\025{Y*\220\224\252\035*\312\030j&(w\335j\305~+\016Z\321nEe\231\363N\221\337+\362\201\"\037*\362\257\212|\244\310\277\2652\224\261\343\273\236x\210\263\260\255\276\347@\341LN\3744\241\223\023}\337\3124t\r\343\351f\r\377l\026q\354\3235\017\350\325\307\231\353\204\343\211\r\211z^\2538A0\tP\253\217\035\204\254\221\243 \"\2120\2309ek\234\253\035Q#j\225\236A\014\360\006\373w\317Ea\243\214\2550p\317+utD\212M\022\261t?J\363t\305YB\213h\001\377c\226`\236\223\210^\222\3503M\2424\2461\276\241y\301\322\004\343\253U\022a<\317\360\210r\030'S9eN+\203!\314\232\212\234\346\351'\032\361\016\376q\305(\037\203SP\221\242\262\204cV\340&\030\306\351\262\300xI \034\370-\323x\265\240BJ\310\022\236\t\275m\2266\243n_\214\272}9\352\2624\303\030\306\035\216H\306\304\312/+\262\250V\347\224\257r\360[P^\373\003)\246Wd\265\340\005\3171\346\264\340\030\337\220\305\212\026\245\277\351\316\353\352\271\333\223\372M\312\342\335\036\304\275\363zt\024P\022\273\234\346\204\247\371tg\357\315\216\2646\361\273=#\374f'\272&""\371\316^K\237AV\364knu\203'\340\326\357Wi\311\313W|\313OY\240Do\202u\357\r\372f\007P#eb\232\320\014\250\311\276D\376\337o{}\353\304\310<\361\326\216\301\177Y|\203\263UR\260yBc\223C\235S\265\366O\205\000\347G\363~\272Jb\341\024\301\351\2229\355\022\205\016\301u\310\351\332h-(\026u\026\260\234\303\265\245\222AYK\264r\265\005H\033\224\346\\\325gYf\216V'\266l;\321\352T\327\271!\332\366\374!\316\004z.LE\373Tq\223X>\207y\272l\233\307\260\250%\313n\353\000Uke\033+\376\004\337.I\264\361XQ7\027\240MS\205\260W\345\221\303\246\301e\357&\234\316e\201\014\322D|\370\224Ub\354Jg]\365\301\202r*\215\224P\353\002\203\231d&\246i\3018|\014\231Y\304I\316\273Tu\006F\237\025\365\264Wy|\265_\361\0227\231\025T*~\312[=)V9\335\356\217\n\255\374l\365M\237E0\310\2024\345\342\350\240\371\007\327l\021\327\244T\005\325\032J\222\345\360aXG\\'/\372\315Mn\304\213b\005\036\223\374\263\006\204\233\214*\352)\203\334\033\203rV\312s\001\335\205\312Y\327\262G4J\033\313\022\253'\262l{\365\335>e\363\353\313\306T|\313+\336\246$\247\315\272iNo\024.\274e2\321j\037m(8J5\310M\014 \0146\035ms=f\261\322\376n\241o\261[\310\327\273\005\034\261\246 \232\021\270\336i\254\036X\311\250\376\204\332v\262D\237X\253\232tVi@Sl\032\252V\341\220Us\250N\271\356eu\253\205\330\207\336N>\327\241*\007\343\306`\313\2566\352\370\261\342\306\241\275\201O}\026)\210\233\024`*5\361\362\2526i\254lZ\375""\002\311\224m!\006H\035\320\344\022\376`X\225\365__pyx_string_tab; Py_ssize_t pos = 0; for (int i = 0; i < 91; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL); if (likely(string) && i >= 2) PyUnicode_InternInPlace(&string); if (unlikely(!string)) { Py_XDECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } stringtab[i] = string; pos += bytes_length; } for (int i = 91; i < 96; i++) { Py_ssize_t bytes_length = index[i].length; PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length); stringtab[i] = string; pos += bytes_length; if (unlikely(!string)) { Py_XDECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) } } Py_XDECREF(data); for (Py_ssize_t i = 0; i < 96; i++) { if (unlikely(PyObject_Hash(stringtab[i]) == -1)) { __PYX_ERR(0, 1, __pyx_L1_error) } } #if CYTHON_IMMORTAL_CONSTANTS { PyObject **table = stringtab + 91; for (Py_ssize_t i=0; i<5; ++i) { #if PY_VERSION_HEX >= 0x030F0000 PyUnstable_SetImmortal(table[i]); #elif CYTHON_COMPILING_IN_CPYTHON_FREETHREADING if ((PY_SSIZE_T_MAX <= _Py_IMMORTAL_REFCNT_LOCAL)) break; #if PY_VERSION_HEX < 0x030E0000 if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1) #else if (PyUnstable_Object_IsUniquelyReferenced(table[i])) #endif { Py_SET_REFCNT(table[i], ((Py_ssize_t)_Py_IMMORTAL_REFCNT_LOCAL + 1)); } #else if ((PY_SSIZE_T_MAX < _Py_IMMORTAL_INITIAL_REFCNT)) break; Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT); #endif } } #endif } return 0; __pyx_L1_error:; return -1; } /* #### Code section: init_codeobjects ### */ typedef struct { unsigned int argcount : 1; unsigned int num_posonly_args : 1; unsigned int num_kwonly_args : 1; unsigned int nlocals : 1; unsigned int flags : 10; unsigned int first_line : 7; } __Pyx_PyCode_New_function_description; /* NewCodeObj.proto */ static PyObject* __Pyx_PyCode_New( const __Pyx_PyCode_New_function_description descr, PyObject * const *varnames, PyObject *filename, PyObject *funcname, PyObject *line_table, PyObject *tuple_dedup_map ); static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) { PyObject* tuple_dedup_map = PyDict_New(); if (unlikely(!tuple_dedup_map)) return -1; { const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 0, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 113}; PyObject* const varnames[] = {0}; __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graphLib_pyx, __pyx_mstate->__pyx_n_u_gp_GetQuietMode, __pyx_mstate->__pyx_kp_b_iso88591_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 117}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_newQuietMode}; __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graphLib_pyx, __pyx_mstate->__pyx_n_u_gp_SetQuietMode, __pyx_mstate->__pyx_kp_b_iso88591_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 121}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_encoded_version}; __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graphLib_pyx, __pyx_mstate->__pyx_n_u_gp_GetProjectVersionFull, __pyx_mstate->__pyx_kp_b_iso88591_C1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad; } { const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 126}; PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_encoded_version}; __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_planarity_full_graphLib_pyx, __pyx_mstate->__pyx_n_u_gp_GetLibPlanarityVersionFull, __pyx_mstate->__pyx_kp_b_iso88591_q_H, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad; } Py_DECREF(tuple_dedup_map); return 0; bad: Py_DECREF(tuple_dedup_map); return -1; } /* #### Code section: init_globals ### */ static int __Pyx_InitGlobals(void) { /* PythonCompatibility.init */ if (likely(__Pyx_init_co_variables() == 0)); else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) /* CommonTypesMetaclass.init */ if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) /* CachedMethodType.init */ #if CYTHON_COMPILING_IN_LIMITED_API { PyObject *typesModule=NULL; typesModule = PyImport_ImportModule("types"); if (typesModule) { __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType"); Py_DECREF(typesModule); } } // error handling follows #endif if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) /* CythonFunctionShared.init */ if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } /* #### Code section: cleanup_globals ### */ /* #### Code section: cleanup_module ### */ /* #### Code section: main_method ### */ /* #### Code section: utility_code_pragmas ### */ #ifdef _MSC_VER #pragma warning( push ) /* Warning 4127: conditional expression is constant * Cython uses constant conditional expressions to allow in inline functions to be optimized at * compile-time, so this warning is not useful */ #pragma warning( disable : 4127 ) #endif /* #### Code section: utility_code_def ### */ /* --- Runtime support code --- */ /* Refnanny */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule(modname); if (!m) goto end; p = PyObject_GetAttrString(m, "RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* TupleAndListFromArray (used by fastcall) */ #if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL static CYTHON_INLINE PyObject * __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) { PyObject *res; Py_ssize_t i; if (n <= 0) { return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); } res = PyTuple_New(n); if (unlikely(res == NULL)) return NULL; for (i = 0; i < n; i++) { Py_INCREF(src[i]); if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) { Py_DECREF(res); return NULL; } } return res; } #elif CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { PyObject *v; Py_ssize_t i; for (i = 0; i < length; i++) { v = dest[i] = src[i]; Py_INCREF(v); } } static CYTHON_INLINE PyObject * __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) { PyObject *res; if (n <= 0) { return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple); } res = PyTuple_New(n); if (unlikely(res == NULL)) return NULL; __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); return res; } static CYTHON_INLINE PyObject * __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) { PyObject *res; if (n <= 0) { return PyList_New(0); } res = PyList_New(n); if (unlikely(res == NULL)) return NULL; __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); return res; } #endif /* BytesEquals (used by UnicodeEquals) */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\ !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) return PyObject_RichCompareBool(s1, s2, equals); #else if (s1 == s2) { return (equals == Py_EQ); } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { const char *ps1, *ps2; Py_ssize_t length = PyBytes_GET_SIZE(s1); if (length != PyBytes_GET_SIZE(s2)) return (equals == Py_NE); ps1 = PyBytes_AS_STRING(s1); ps2 = PyBytes_AS_STRING(s2); if (ps1[0] != ps2[0]) { return (equals == Py_NE); } else if (length == 1) { return (equals == Py_EQ); } else { int result; #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) Py_hash_t hash1, hash2; hash1 = ((PyBytesObject*)s1)->ob_shash; hash2 = ((PyBytesObject*)s2)->ob_shash; if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { return (equals == Py_NE); } #endif result = memcmp(ps1, ps2, (size_t)length); return (equals == Py_EQ) ? (result == 0) : (result != 0); } } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { return (equals == Py_NE); } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { return (equals == Py_NE); } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); Py_DECREF(py_result); return result; } #endif } /* UnicodeEquals (used by fastcall) */ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL return PyObject_RichCompareBool(s1, s2, equals); #else int s1_is_unicode, s2_is_unicode; if (s1 == s2) { goto return_eq; } s1_is_unicode = PyUnicode_CheckExact(s1); s2_is_unicode = PyUnicode_CheckExact(s2); if (s1_is_unicode & s2_is_unicode) { Py_ssize_t length, length2; int kind; void *data1, *data2; #if !CYTHON_COMPILING_IN_LIMITED_API if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) return -1; #endif length = __Pyx_PyUnicode_GET_LENGTH(s1); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(length < 0)) return -1; #endif length2 = __Pyx_PyUnicode_GET_LENGTH(s2); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(length2 < 0)) return -1; #endif if (length != length2) { goto return_ne; } #if CYTHON_USE_UNICODE_INTERNALS { Py_hash_t hash1, hash2; hash1 = ((PyASCIIObject*)s1)->hash; hash2 = ((PyASCIIObject*)s2)->hash; if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { goto return_ne; } } #endif kind = __Pyx_PyUnicode_KIND(s1); if (kind != __Pyx_PyUnicode_KIND(s2)) { goto return_ne; } data1 = __Pyx_PyUnicode_DATA(s1); data2 = __Pyx_PyUnicode_DATA(s2); if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { goto return_ne; } else if (length == 1) { goto return_eq; } else { int result = memcmp(data1, data2, (size_t)(length * kind)); return (equals == Py_EQ) ? (result == 0) : (result != 0); } } else if ((s1 == Py_None) & s2_is_unicode) { goto return_ne; } else if ((s2 == Py_None) & s1_is_unicode) { goto return_ne; } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); Py_DECREF(py_result); return result; } return_eq: return (equals == Py_EQ); return_ne: return (equals == Py_NE); #endif } /* fastcall */ #if CYTHON_METH_FASTCALL static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) { Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(n == -1)) return NULL; #endif for (i = 0; i < n; i++) { PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely(!namei)) return NULL; #endif if (s == namei) return kwvalues[i]; } for (i = 0; i < n; i++) { PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i); #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely(!namei)) return NULL; #endif int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ); if (unlikely(eq != 0)) { if (unlikely(eq < 0)) return NULL; return kwvalues[i]; } } return NULL; } #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { Py_ssize_t i, nkwargs; PyObject *dict; #if !CYTHON_ASSUME_SAFE_SIZE nkwargs = PyTuple_Size(kwnames); if (unlikely(nkwargs < 0)) return NULL; #else nkwargs = PyTuple_GET_SIZE(kwnames); #endif dict = PyDict_New(); if (unlikely(!dict)) return NULL; for (i=0; itp_call; if (unlikely(!call)) return PyObject_Call(func, arg, kw); if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) return NULL; result = (*call)(func, arg, kw); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* PyObjectCallMethO (used by PyObjectFastCall) */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { PyObject *self, *result; PyCFunction cfunc; cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); self = __Pyx_CyOrPyCFunction_GET_SELF(func); if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) return NULL; result = cfunc(self, arg); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* PyObjectFastCall (used by PyObjectCallOneArg) */ #if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) { PyObject *argstuple; PyObject *result = 0; size_t i; argstuple = PyTuple_New((Py_ssize_t)nargs); if (unlikely(!argstuple)) return NULL; for (i = 0; i < nargs; i++) { Py_INCREF(args[i]); if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad; } result = __Pyx_PyObject_Call(func, argstuple, kwargs); bad: Py_DECREF(argstuple); return result; } #endif #if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API #if PY_VERSION_HEX < 0x03090000 #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable) #elif CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) { PyTypeObject *tp = Py_TYPE(callable); #if defined(__Pyx_CyFunction_USED) if (__Pyx_CyFunction_CheckExact(callable)) { return __Pyx_CyFunction_func_vectorcall(callable); } #endif if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) { return NULL; } assert(PyCallable_Check(callable)); Py_ssize_t offset = tp->tp_vectorcall_offset; assert(offset > 0); vectorcallfunc ptr; memcpy(&ptr, (char *) callable + offset, sizeof(ptr)); return ptr; } #else #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable) #endif #endif static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) { Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); #if CYTHON_COMPILING_IN_CPYTHON if (nargs == 0 && kwargs == NULL) { if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) return __Pyx_PyObject_CallMethO(func, NULL); } else if (nargs == 1 && kwargs == NULL) { if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) return __Pyx_PyObject_CallMethO(func, args[0]); } #endif if (kwargs == NULL) { #if CYTHON_VECTORCALL #if CYTHON_COMPILING_IN_LIMITED_API return PyObject_Vectorcall(func, args, _nargs, NULL); #else vectorcallfunc f = __Pyx_PyVectorcall_Function(func); if (f) { return f(func, args, _nargs, NULL); } #endif #endif } if (nargs == 0) { return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs); } #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); #else return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); #endif } /* PyObjectCallOneArg (used by CallUnboundCMethod0) */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *args[2] = {NULL, arg}; return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } /* PyObjectGetAttrStr (used by UnpackUnboundCMethod) */ #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); return PyObject_GetAttr(obj, attr_name); } #endif /* UnpackUnboundCMethod (used by CallUnboundCMethod0) */ #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) { PyObject *result; PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args)); if (unlikely(!selfless_args)) return NULL; result = PyObject_Call(method, selfless_args, kwargs); Py_DECREF(selfless_args); return result; } #elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000 static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { return _PyObject_Vectorcall (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames); } #else static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { return #if PY_VERSION_HEX < 0x03090000 _PyObject_Vectorcall #else PyObject_Vectorcall #endif (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames); } #endif static PyMethodDef __Pyx_UnboundCMethod_Def = { "CythonUnboundCMethod", __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall), #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000 METH_VARARGS | METH_KEYWORDS, #else METH_FASTCALL | METH_KEYWORDS, #endif NULL }; static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { PyObject *method, *result=NULL; method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); if (unlikely(!method)) return -1; result = method; #if CYTHON_COMPILING_IN_CPYTHON if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) { PyMethodDescrObject *descr = (PyMethodDescrObject*) method; target->func = descr->d_method->ml_meth; target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS); } else #endif #if CYTHON_COMPILING_IN_PYPY #else if (PyCFunction_Check(method)) #endif { PyObject *self; int self_found; #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY self = PyObject_GetAttrString(method, "__self__"); if (!self) { PyErr_Clear(); } #else self = PyCFunction_GET_SELF(method); #endif self_found = (self && self != Py_None); #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY Py_XDECREF(self); #endif if (self_found) { PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method); if (unlikely(!unbound_method)) return -1; Py_DECREF(method); result = unbound_method; } } #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING if (unlikely(target->method)) { Py_DECREF(result); } else #endif target->method = result; return 0; } /* CallUnboundCMethod0 */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); if (likely(was_initialized == 2 && cfunc->func)) { if (likely(cfunc->flag == METH_NOARGS)) return __Pyx_CallCFunction(cfunc, self, NULL); if (likely(cfunc->flag == METH_FASTCALL)) return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0); if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL); if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS))) return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL); if (cfunc->flag == METH_VARARGS) return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple); return __Pyx__CallUnboundCMethod0(cfunc, self); } #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING else if (unlikely(was_initialized == 1)) { __Pyx_CachedCFunction tmp_cfunc = { #ifndef __cplusplus 0 #endif }; tmp_cfunc.type = cfunc->type; tmp_cfunc.method_name = cfunc->method_name; return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self); } #endif PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self); __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); return result; } #endif static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { PyObject *result; if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; result = __Pyx_PyObject_CallOneArg(cfunc->method, self); return result; } /* py_dict_items (used by OwnedDictNext) */ static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) { return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d); } /* py_dict_values (used by OwnedDictNext) */ static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) { return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d); } /* OwnedDictNext (used by ParseKeywordsImpl) */ #if CYTHON_AVOID_BORROWED_REFS static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) { PyObject *next = NULL; if (!*ppos) { if (pvalue) { PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p); if (unlikely(!dictview)) goto bad; *ppos = PyObject_GetIter(dictview); Py_DECREF(dictview); } else { *ppos = PyObject_GetIter(p); } if (unlikely(!*ppos)) goto bad; } next = PyIter_Next(*ppos); if (!next) { if (PyErr_Occurred()) goto bad; return 0; } if (pkey && pvalue) { *pkey = __Pyx_PySequence_ITEM(next, 0); if (unlikely(*pkey)) goto bad; *pvalue = __Pyx_PySequence_ITEM(next, 1); if (unlikely(*pvalue)) goto bad; Py_DECREF(next); } else if (pkey) { *pkey = next; } else { assert(pvalue); *pvalue = next; } return 1; bad: Py_XDECREF(next); #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef"); #else PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef); #endif if (pkey) *pkey = NULL; if (pvalue) *pvalue = NULL; return 0; } #else // !CYTHON_AVOID_BORROWED_REFS static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) { int result = PyDict_Next(p, ppos, pkey, pvalue); if (likely(result == 1)) { if (pkey) Py_INCREF(*pkey); if (pvalue) Py_INCREF(*pvalue); } return result; } #endif /* RaiseDoubleKeywords (used by ParseKeywordsImpl) */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, "%s() got multiple values for keyword argument '%U'", func_name, kw_name); } /* CallUnboundCMethod2 */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc); if (likely(was_initialized == 2 && cfunc->func)) { PyObject *args[2] = {arg1, arg2}; if (cfunc->flag == METH_FASTCALL) { return __Pyx_CallCFunctionFast(cfunc, self, args, 2); } if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL); } #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING else if (unlikely(was_initialized == 1)) { __Pyx_CachedCFunction tmp_cfunc = { #ifndef __cplusplus 0 #endif }; tmp_cfunc.type = cfunc->type; tmp_cfunc.method_name = cfunc->method_name; return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2); } #endif PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2); __Pyx_CachedCFunction_SetFinishedInitializing(cfunc); return result; } #endif static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){ if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; #if CYTHON_COMPILING_IN_CPYTHON if (cfunc->func && (cfunc->flag & METH_VARARGS)) { PyObject *result = NULL; PyObject *args = PyTuple_New(2); if (unlikely(!args)) return NULL; Py_INCREF(arg1); PyTuple_SET_ITEM(args, 0, arg1); Py_INCREF(arg2); PyTuple_SET_ITEM(args, 1, arg2); if (cfunc->flag & METH_KEYWORDS) result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL); else result = __Pyx_CallCFunction(cfunc, self, args); Py_DECREF(args); return result; } #endif { PyObject *args[4] = {NULL, self, arg1, arg2}; return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } } /* ParseKeywordsImpl (used by ParseKeywords) */ static int __Pyx_ValidateDuplicatePosArgs( PyObject *kwds, PyObject ** const argnames[], PyObject ** const *first_kw_arg, const char* function_name) { PyObject ** const *name = argnames; while (name != first_kw_arg) { PyObject *key = **name; int found = PyDict_Contains(kwds, key); if (unlikely(found)) { if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; } name++; } return 0; bad: return -1; } #if CYTHON_USE_UNICODE_INTERNALS static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) { int kind; Py_ssize_t len = PyUnicode_GET_LENGTH(s1); if (len != PyUnicode_GET_LENGTH(s2)) return 0; kind = PyUnicode_KIND(s1); if (kind != PyUnicode_KIND(s2)) return 0; const void *data1 = PyUnicode_DATA(s1); const void *data2 = PyUnicode_DATA(s2); return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0); } #endif static int __Pyx_MatchKeywordArg_str( PyObject *key, PyObject ** const argnames[], PyObject ** const *first_kw_arg, size_t *index_found, const char *function_name) { PyObject ** const *name; #if CYTHON_USE_UNICODE_INTERNALS Py_hash_t key_hash = ((PyASCIIObject*)key)->hash; if (unlikely(key_hash == -1)) { key_hash = PyObject_Hash(key); if (unlikely(key_hash == -1)) goto bad; } #endif name = first_kw_arg; while (*name) { PyObject *name_str = **name; #if CYTHON_USE_UNICODE_INTERNALS if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) { *index_found = (size_t) (name - argnames); return 1; } #else #if CYTHON_ASSUME_SAFE_SIZE if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) #endif { int cmp = PyUnicode_Compare(name_str, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { *index_found = (size_t) (name - argnames); return 1; } } #endif name++; } name = argnames; while (name != first_kw_arg) { PyObject *name_str = **name; #if CYTHON_USE_UNICODE_INTERNALS if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) { if (__Pyx_UnicodeKeywordsEqual(name_str, key)) goto arg_passed_twice; } #else #if CYTHON_ASSUME_SAFE_SIZE if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key)) #endif { if (unlikely(name_str == key)) goto arg_passed_twice; int cmp = PyUnicode_Compare(name_str, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; } #endif name++; } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; bad: return -1; } static int __Pyx_MatchKeywordArg_nostr( PyObject *key, PyObject ** const argnames[], PyObject ** const *first_kw_arg, size_t *index_found, const char *function_name) { PyObject ** const *name; if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type; name = first_kw_arg; while (*name) { int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); if (cmp == 1) { *index_found = (size_t) (name - argnames); return 1; } if (unlikely(cmp == -1)) goto bad; name++; } name = argnames; while (name != first_kw_arg) { int cmp = PyObject_RichCompareBool(**name, key, Py_EQ); if (unlikely(cmp != 0)) { if (cmp == 1) goto arg_passed_twice; else goto bad; } name++; } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%.200s() keywords must be strings", function_name); goto bad; bad: return -1; } static CYTHON_INLINE int __Pyx_MatchKeywordArg( PyObject *key, PyObject ** const argnames[], PyObject ** const *first_kw_arg, size_t *index_found, const char *function_name) { return likely(PyUnicode_CheckExact(key)) ? __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) : __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name); } static void __Pyx_RejectUnknownKeyword( PyObject *kwds, PyObject ** const argnames[], PyObject ** const *first_kw_arg, const char *function_name) { #if CYTHON_AVOID_BORROWED_REFS PyObject *pos = NULL; #else Py_ssize_t pos = 0; #endif PyObject *key = NULL; __Pyx_BEGIN_CRITICAL_SECTION(kwds); while ( #if CYTHON_AVOID_BORROWED_REFS __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL) #else PyDict_Next(kwds, &pos, &key, NULL) #endif ) { PyObject** const *name = first_kw_arg; while (*name && (**name != key)) name++; if (!*name) { size_t index_found = 0; int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); if (cmp != 1) { if (cmp == 0) { PyErr_Format(PyExc_TypeError, "%s() got an unexpected keyword argument '%U'", function_name, key); } #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(key); #endif break; } } #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(key); #endif } __Pyx_END_CRITICAL_SECTION(); #if CYTHON_AVOID_BORROWED_REFS Py_XDECREF(pos); #endif assert(PyErr_Occurred()); } static int __Pyx_ParseKeywordDict( PyObject *kwds, PyObject ** const argnames[], PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs) { PyObject** const *name; PyObject** const *first_kw_arg = argnames + num_pos_args; Py_ssize_t extracted = 0; #if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; #endif name = first_kw_arg; while (*name && num_kwargs > extracted) { PyObject * key = **name; PyObject *value; int found = 0; #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 found = PyDict_GetItemRef(kwds, key, &value); #else value = PyDict_GetItemWithError(kwds, key); if (value) { Py_INCREF(value); found = 1; } else { if (unlikely(PyErr_Occurred())) goto bad; } #endif if (found) { if (unlikely(found < 0)) goto bad; values[name-argnames] = value; extracted++; } name++; } if (num_kwargs > extracted) { if (ignore_unknown_kwargs) { if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1)) goto bad; } else { __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name); goto bad; } } return 0; bad: return -1; } static int __Pyx_ParseKeywordDictToDict( PyObject *kwds, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject** const *name; PyObject** const *first_kw_arg = argnames + num_pos_args; Py_ssize_t len; #if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments) if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1; #endif if (PyDict_Update(kwds2, kwds) < 0) goto bad; name = first_kw_arg; while (*name) { PyObject *key = **name; PyObject *value; #if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop)) int found = PyDict_Pop(kwds2, key, &value); if (found) { if (unlikely(found < 0)) goto bad; values[name-argnames] = value; } #elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 int found = PyDict_GetItemRef(kwds2, key, &value); if (found) { if (unlikely(found < 0)) goto bad; values[name-argnames] = value; if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad; } #else #if CYTHON_COMPILING_IN_CPYTHON value = _PyDict_Pop(kwds2, key, kwds2); #else value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2); #endif if (value == kwds2) { Py_DECREF(value); } else { if (unlikely(!value)) goto bad; values[name-argnames] = value; } #endif name++; } len = PyDict_Size(kwds2); if (len > 0) { return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name); } else if (unlikely(len == -1)) { goto bad; } return 0; bad: return -1; } static int __Pyx_ParseKeywordsTuple( PyObject *kwds, PyObject * const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs) { PyObject *key = NULL; PyObject** const * name; PyObject** const *first_kw_arg = argnames + num_pos_args; for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) { #if CYTHON_AVOID_BORROWED_REFS key = __Pyx_PySequence_ITEM(kwds, pos); #else key = __Pyx_PyTuple_GET_ITEM(kwds, pos); #endif #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely(!key)) goto bad; #endif name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { PyObject *value = kwvalues[pos]; values[name-argnames] = __Pyx_NewRef(value); } else { size_t index_found = 0; int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name); if (cmp == 1) { PyObject *value = kwvalues[pos]; values[index_found] = __Pyx_NewRef(value); } else { if (unlikely(cmp == -1)) goto bad; if (kwds2) { PyObject *value = kwvalues[pos]; if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else if (!ignore_unknown_kwargs) { goto invalid_keyword; } } } #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(key); key = NULL; #endif } return 0; invalid_keyword: PyErr_Format(PyExc_TypeError, "%s() got an unexpected keyword argument '%U'", function_name, key); goto bad; bad: #if CYTHON_AVOID_BORROWED_REFS Py_XDECREF(key); #endif return -1; } /* ParseKeywords */ static int __Pyx_ParseKeywords( PyObject *kwds, PyObject * const *kwvalues, PyObject ** const argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, Py_ssize_t num_kwargs, const char* function_name, int ignore_unknown_kwargs) { if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds))) return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); else if (kwds2) return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name); else return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs); } /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } /* decode_c_bytes (used by decode_bytes) */ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes( const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { if (unlikely((start < 0) | (stop < 0))) { if (start < 0) { start += length; if (start < 0) start = 0; } if (stop < 0) stop += length; } if (stop > length) stop = length; if (unlikely(stop <= start)) return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_unicode); length = stop - start; cstring += start; if (decode_func) { return decode_func(cstring, length, errors); } else { return PyUnicode_Decode(cstring, length, encoding, errors); } } /* FunctionExport */ static int __Pyx_ExportFunction(PyObject *api_dict, const char *name, void (*f)(void), const char *sig) { PyObject *cobj; union { void (*fp)(void); void *p; } tmp; tmp.fp = f; cobj = PyCapsule_New(tmp.p, sig, 0); if (!cobj) goto bad; if (PyDict_SetItemString(api_dict, name, cobj) < 0) goto bad; Py_DECREF(cobj); return 0; bad: Py_XDECREF(cobj); return -1; } /* GetApiDict */ static PyObject *__Pyx_ApiExport_GetApiDict(void) { PyObject *d; if (__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_capi, &d) == -1) return NULL; if (!d) { d = PyDict_New(); if (!d) goto bad; if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_pyx_capi, d) < 0) goto bad; } return d; bad: Py_XDECREF(d); return NULL; } /* dict_setdefault (used by FetchCommonType) */ static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) { PyObject* value; #if __PYX_LIMITED_VERSION_HEX >= 0x030F0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4) PyDict_SetDefaultRef(d, key, default_value, &value); #elif CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000 PyObject *args[] = {d, key, default_value}; value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); #elif CYTHON_COMPILING_IN_LIMITED_API value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL); #else value = PyDict_SetDefault(d, key, default_value); if (unlikely(!value)) return NULL; Py_INCREF(value); #endif return value; } /* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */ #if CYTHON_COMPILING_IN_LIMITED_API static Py_ssize_t __Pyx_GetTypeDictOffset(void) { PyObject *tp_dictoffset_o; Py_ssize_t tp_dictoffset; tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__"); if (unlikely(!tp_dictoffset_o)) return -1; tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o); Py_DECREF(tp_dictoffset_o); if (unlikely(tp_dictoffset == 0)) { PyErr_SetString( PyExc_TypeError, "'type' doesn't have a dictoffset"); return -1; } else if (unlikely(tp_dictoffset < 0)) { PyErr_SetString( PyExc_TypeError, "'type' has an unexpected negative dictoffset. " "Please report this as Cython bug"); return -1; } return tp_dictoffset; } static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) { static Py_ssize_t tp_dictoffset = 0; if (unlikely(tp_dictoffset == 0)) { tp_dictoffset = __Pyx_GetTypeDictOffset(); if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) { tp_dictoffset = 0; // try again next time? return NULL; } } return *(PyObject**)((char*)tp + tp_dictoffset); } #endif /* SetItemOnTypeDict (used by FixUpExtensionType) */ static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) { int result; PyObject *tp_dict; #if CYTHON_COMPILING_IN_LIMITED_API tp_dict = __Pyx_GetTypeDict(tp); if (unlikely(!tp_dict)) return -1; #else tp_dict = tp->tp_dict; #endif result = PyDict_SetItem(tp_dict, k, v); if (likely(!result)) { PyType_Modified(tp); if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) { PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name, (PyObject *) tp, k, NULL); if (!setNameResult) return -1; Py_DECREF(setNameResult); } } return result; } /* FixUpExtensionType (used by FetchCommonType) */ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { #if __PYX_LIMITED_VERSION_HEX > 0x030900B1 CYTHON_UNUSED_VAR(spec); CYTHON_UNUSED_VAR(type); CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); #else const PyType_Slot *slot = spec->slots; int changed = 0; #if !CYTHON_COMPILING_IN_LIMITED_API while (slot && slot->slot && slot->slot != Py_tp_members) slot++; if (slot && slot->slot == Py_tp_members) { #if !CYTHON_COMPILING_IN_CPYTHON const #endif // !CYTHON_COMPILING_IN_CPYTHON) PyMemberDef *memb = (PyMemberDef*) slot->pfunc; while (memb && memb->name) { if (memb->name[0] == '_' && memb->name[1] == '_') { if (strcmp(memb->name, "__weaklistoffset__") == 0) { assert(memb->type == T_PYSSIZET); assert(memb->flags == READONLY); type->tp_weaklistoffset = memb->offset; changed = 1; } else if (strcmp(memb->name, "__dictoffset__") == 0) { assert(memb->type == T_PYSSIZET); assert(memb->flags == READONLY); type->tp_dictoffset = memb->offset; changed = 1; } #if CYTHON_METH_FASTCALL else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { assert(memb->type == T_PYSSIZET); assert(memb->flags == READONLY); type->tp_vectorcall_offset = memb->offset; changed = 1; } #endif // CYTHON_METH_FASTCALL #if !CYTHON_COMPILING_IN_PYPY else if (strcmp(memb->name, "__module__") == 0) { PyObject *descr; assert(memb->type == T_OBJECT); assert(memb->flags == 0 || memb->flags == READONLY); descr = PyDescr_NewMember(type, memb); if (unlikely(!descr)) return -1; int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); Py_DECREF(descr); if (unlikely(set_item_result < 0)) { return -1; } changed = 1; } #endif // !CYTHON_COMPILING_IN_PYPY } memb++; } } #endif // !CYTHON_COMPILING_IN_LIMITED_API #if !CYTHON_COMPILING_IN_PYPY slot = spec->slots; while (slot && slot->slot && slot->slot != Py_tp_getset) slot++; if (slot && slot->slot == Py_tp_getset) { PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc; while (getset && getset->name) { if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) { PyObject *descr = PyDescr_NewGetSet(type, getset); if (unlikely(!descr)) return -1; #if CYTHON_COMPILING_IN_LIMITED_API PyObject *pyname = PyUnicode_FromString(getset->name); if (unlikely(!pyname)) { Py_DECREF(descr); return -1; } int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr); Py_DECREF(pyname); #else CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr); #endif Py_DECREF(descr); if (unlikely(set_item_result < 0)) { return -1; } changed = 1; } ++getset; } } #else CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict); #endif // !CYTHON_COMPILING_IN_PYPY if (changed) PyType_Modified(type); #endif // PY_VERSION_HEX > 0x030900B1 return 0; } /* AddModuleRef (used by FetchSharedCythonModule) */ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) { PyObject *module_dict = PyImport_GetModuleDict(); PyObject *m; if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) { return NULL; } if (m != NULL && PyModule_Check(m)) { return m; } Py_XDECREF(m); m = PyModule_NewObject(name); if (m == NULL) return NULL; if (PyDict_CheckExact(module_dict)) { PyObject *new_m; (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m); Py_DECREF(m); return new_m; } else { if (PyObject_SetItem(module_dict, name, m) != 0) { Py_DECREF(m); return NULL; } return m; } } static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { PyObject *py_name = PyUnicode_FromString(name); if (!py_name) return NULL; PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name); Py_DECREF(py_name); return module; } #elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000 #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) #else static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { PyObject *module = PyImport_AddModule(name); Py_XINCREF(module); return module; } #endif /* FetchSharedCythonModule (used by FetchCommonType) */ static PyObject *__Pyx_FetchSharedCythonABIModule(void) { return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME); } /* FetchCommonType (used by CommonTypesMetaclass) */ #if __PYX_LIMITED_VERSION_HEX < 0x030C0000 static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases); if (result && metaclass) { PyObject *old_tp = (PyObject*)Py_TYPE(result); Py_INCREF((PyObject*)metaclass); #if __PYX_LIMITED_VERSION_HEX >= 0x03090000 Py_SET_TYPE(result, metaclass); #else result->ob_type = metaclass; #endif Py_DECREF(old_tp); } return result; } #else #define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b) #endif static int __Pyx_VerifyCachedType(PyObject *cached_type, const char *name, Py_ssize_t expected_basicsize) { Py_ssize_t basicsize; if (!PyType_Check(cached_type)) { PyErr_Format(PyExc_TypeError, "Shared Cython type %.200s is not a type object", name); return -1; } if (expected_basicsize == 0) { return 0; // size is inherited, nothing useful to check } #if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_basicsize; py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); if (unlikely(!py_basicsize)) return -1; basicsize = PyLong_AsSsize_t(py_basicsize); Py_DECREF(py_basicsize); py_basicsize = NULL; if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1; #else basicsize = ((PyTypeObject*) cached_type)->tp_basicsize; #endif if (basicsize != expected_basicsize) { PyErr_Format(PyExc_TypeError, "Shared Cython type %.200s has the wrong size, try recompiling", name); return -1; } return 0; } static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) { PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name; int get_item_ref_result; const char* object_name = strrchr(spec->name, '.'); object_name = object_name ? object_name+1 : spec->name; py_object_name = PyUnicode_FromString(object_name); if (!py_object_name) return NULL; abi_module = __Pyx_FetchSharedCythonABIModule(); if (!abi_module) goto done; abi_module_dict = PyModule_GetDict(abi_module); if (!abi_module_dict) goto done; get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type); if (get_item_ref_result == 1) { if (__Pyx_VerifyCachedType( cached_type, object_name, spec->basicsize) < 0) { goto bad; } goto done; } else if (unlikely(get_item_ref_result == -1)) { goto bad; } cached_type = __Pyx_PyType_FromMetaclass( metaclass, CYTHON_USE_MODULE_STATE ? module : abi_module, spec, bases); if (unlikely(!cached_type)) goto bad; if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type); if (unlikely(new_cached_type != cached_type)) { if (unlikely(!new_cached_type)) goto bad; Py_DECREF(cached_type); cached_type = new_cached_type; if (__Pyx_VerifyCachedType( cached_type, object_name, spec->basicsize) < 0) { goto bad; } goto done; } else { Py_DECREF(new_cached_type); } done: Py_XDECREF(abi_module); Py_DECREF(py_object_name); assert(cached_type == NULL || PyType_Check(cached_type)); return (PyTypeObject *) cached_type; bad: Py_XDECREF(cached_type); cached_type = NULL; goto done; } /* CommonTypesMetaclass (used by CythonFunctionShared) */ static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) { return PyUnicode_FromString(__PYX_ABI_MODULE_NAME); } #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) { PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types"); return NULL; } static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) { PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable"); return -1; } #endif static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = { {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL}, {0, 0, 0, 0, 0} }; static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = { {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset}, #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call}, {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call}, {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr}, #endif {0, 0} }; static PyType_Spec __pyx_CommonTypesMetaclass_spec = { __PYX_TYPE_MODULE_PREFIX "_common_types_metatype", 0, 0, Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | Py_TPFLAGS_DEFAULT, __pyx_CommonTypesMetaclass_slots }; static int __pyx_CommonTypesMetaclass_init(PyObject *module) { __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); PyObject *bases = PyTuple_Pack(1, &PyType_Type); if (unlikely(!bases)) { return -1; } mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases); Py_DECREF(bases); if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) { return -1; } return 0; } /* CallTypeTraverse (used by CythonFunctionShared) */ #if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000) #else static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) { #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000 if (__Pyx_get_runtime_version() < 0x03090000) return 0; #endif if (!always_call) { PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*); unsigned long flags = PyType_GetFlags(base); if (flags & Py_TPFLAGS_HEAPTYPE) { return 0; } } Py_VISIT((PyObject*)Py_TYPE(o)); return 0; } #endif /* PyMethodNew (used by CythonFunctionShared) */ #if CYTHON_COMPILING_IN_LIMITED_API static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { PyObject *result; CYTHON_UNUSED_VAR(typ); if (!self) return __Pyx_NewRef(func); #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000 { PyObject *args[] = {func, self}; result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL); } #else result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL); #endif return result; } #else static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { CYTHON_UNUSED_VAR(typ); if (!self) return __Pyx_NewRef(func); return PyMethod_New(func, self); } #endif /* PyVectorcallFastCallDict (used by CythonFunctionShared) */ #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) { PyObject *res = NULL; PyObject *kwnames; PyObject **newargs; PyObject **kwvalues; Py_ssize_t i; #if CYTHON_AVOID_BORROWED_REFS PyObject *pos; #else Py_ssize_t pos; #endif size_t j; PyObject *key, *value; unsigned long keys_are_strings; #if !CYTHON_ASSUME_SAFE_SIZE Py_ssize_t nkw = PyDict_Size(kw); if (unlikely(nkw == -1)) return NULL; #else Py_ssize_t nkw = PyDict_GET_SIZE(kw); #endif newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); if (unlikely(newargs == NULL)) { PyErr_NoMemory(); return NULL; } for (j = 0; j < nargs; j++) newargs[j] = args[j]; kwnames = PyTuple_New(nkw); if (unlikely(kwnames == NULL)) { PyMem_Free(newargs); return NULL; } kwvalues = newargs + nargs; pos = 0; i = 0; keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) { keys_are_strings &= #if CYTHON_COMPILING_IN_LIMITED_API PyType_GetFlags(Py_TYPE(key)); #else Py_TYPE(key)->tp_flags; #endif #if !CYTHON_ASSUME_SAFE_MACROS if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup; #else PyTuple_SET_ITEM(kwnames, i, key); #endif kwvalues[i] = value; i++; } if (unlikely(!keys_are_strings)) { PyErr_SetString(PyExc_TypeError, "keywords must be strings"); goto cleanup; } res = vc(func, newargs, nargs, kwnames); cleanup: #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(pos); #endif Py_DECREF(kwnames); for (i = 0; i < nkw; i++) Py_DECREF(kwvalues[i]); PyMem_Free(newargs); return res; } static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) { Py_ssize_t kw_size = likely(kw == NULL) ? 0 : #if !CYTHON_ASSUME_SAFE_SIZE PyDict_Size(kw); #else PyDict_GET_SIZE(kw); #endif if (kw_size == 0) { return vc(func, args, nargs, NULL); } #if !CYTHON_ASSUME_SAFE_SIZE else if (unlikely(kw_size == -1)) { return NULL; } #endif return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); } #endif /* CythonFunctionShared (used by CythonFunction) */ #if CYTHON_COMPILING_IN_LIMITED_API static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) { if (__Pyx_CyFunction_Check(func)) { return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc; } else if (PyCFunction_Check(func)) { return PyCFunction_GetFunction(func) == (PyCFunction) cfunc; } return 0; } static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) { int result; PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func); if (unlikely(!newFunc)) { PyErr_Clear(); // It's only an optimization, so don't throw an error return 0; } result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc); Py_DECREF(newFunc); return result; } return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc); } #else static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) { if (PyMethod_Check(func)) { func = PyMethod_GET_FUNCTION(func); } return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; } #endif static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API __Pyx_Py_XDECREF_SET( __Pyx_CyFunction_GetClassObj(f), ((classobj) ? __Pyx_NewRef(classobj) : NULL)); #else __Pyx_Py_XDECREF_SET( ((PyCMethodObject *) (f))->mm_class, (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); #endif } static PyObject * __Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op) { if (unlikely(op->func_doc == NULL)) { #if CYTHON_COMPILING_IN_LIMITED_API op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); if (unlikely(!op->func_doc)) return NULL; #else if (((PyCFunctionObject*)op)->m_ml->ml_doc) { op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); if (unlikely(op->func_doc == NULL)) return NULL; } else { Py_INCREF(Py_None); return Py_None; } #endif } Py_INCREF(op->func_doc); return op->func_doc; } static PyObject * __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) { PyObject *result; CYTHON_UNUSED_VAR(closure); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_doc_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) { CYTHON_UNUSED_VAR(context); if (value == NULL) { value = Py_None; } Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->func_doc, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op) { if (unlikely(op->func_name == NULL)) { #if CYTHON_COMPILING_IN_LIMITED_API op->func_name = PyObject_GetAttrString(op->func, "__name__"); #else op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #endif if (unlikely(op->func_name == NULL)) return NULL; } Py_INCREF(op->func_name); return op->func_name; } static PyObject * __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) { PyObject *result = NULL; CYTHON_UNUSED_VAR(context); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_name_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) { CYTHON_UNUSED_VAR(context); if (unlikely(value == NULL || !PyUnicode_Check(value))) { PyErr_SetString(PyExc_TypeError, "__name__ must be set to a string object"); return -1; } Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->func_name, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(context); PyObject *result; __Pyx_BEGIN_CRITICAL_SECTION(op); Py_INCREF(op->func_qualname); result = op->func_qualname; __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) { CYTHON_UNUSED_VAR(context); if (unlikely(value == NULL || !PyUnicode_Check(value))) { PyErr_SetString(PyExc_TypeError, "__qualname__ must be set to a string object"); return -1; } Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->func_qualname, value); __Pyx_END_CRITICAL_SECTION(); return 0; } #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 static PyObject * __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(context); if (unlikely(op->func_dict == NULL)) { op->func_dict = PyDict_New(); if (unlikely(op->func_dict == NULL)) return NULL; } Py_INCREF(op->func_dict); return op->func_dict; } #endif static PyObject * __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(context); Py_INCREF(op->func_globals); return op->func_globals; } static PyObject * __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(op); CYTHON_UNUSED_VAR(context); Py_INCREF(Py_None); return Py_None; } static PyObject * __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) { PyObject* result = (op->func_code) ? op->func_code : Py_None; CYTHON_UNUSED_VAR(context); Py_INCREF(result); return result; } static int __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { int result = 0; PyObject *res = op->defaults_getter((PyObject *) op); if (unlikely(!res)) return -1; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS op->defaults_tuple = PyTuple_GET_ITEM(res, 0); Py_INCREF(op->defaults_tuple); op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); Py_INCREF(op->defaults_kwdict); #else op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); if (unlikely(!op->defaults_tuple)) result = -1; else { op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); if (unlikely(!op->defaults_kwdict)) result = -1; } #endif Py_DECREF(res); return result; } static int __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { PyErr_SetString(PyExc_TypeError, "__defaults__ must be set to a tuple object"); return -1; } PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " "currently affect the values used in function calls", 1); Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) { PyObject* result = op->defaults_tuple; if (unlikely(!result)) { if (op->defaults_getter) { if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_tuple; } else { result = Py_None; } } Py_INCREF(result); return result; } static PyObject * __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result = NULL; CYTHON_UNUSED_VAR(context); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_defaults_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); if (!value) { value = Py_None; } else if (unlikely(value != Py_None && !PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__kwdefaults__ must be set to a dict object"); return -1; } PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " "currently affect the values used in function calls", 1); Py_INCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) { PyObject* result = op->defaults_kwdict; if (unlikely(!result)) { if (op->defaults_getter) { if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; result = op->defaults_kwdict; } else { result = Py_None; } } Py_INCREF(result); return result; } static PyObject * __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { PyObject* result; CYTHON_UNUSED_VAR(context); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_kwdefaults_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static int __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); if (!value || value == Py_None) { value = NULL; } else if (unlikely(!PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "__annotations__ must be set to a dict object"); return -1; } Py_XINCREF(value); __Pyx_BEGIN_CRITICAL_SECTION(op); __Pyx_Py_XDECREF_SET(op->func_annotations, value); __Pyx_END_CRITICAL_SECTION(); return 0; } static PyObject * __Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) { PyObject* result = op->func_annotations; if (unlikely(!result)) { result = PyDict_New(); if (unlikely(!result)) return NULL; op->func_annotations = result; } Py_INCREF(result); return result; } static PyObject * __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { PyObject *result; CYTHON_UNUSED_VAR(context); __Pyx_BEGIN_CRITICAL_SECTION(op); result = __Pyx_CyFunction_get_annotations_locked(op); __Pyx_END_CRITICAL_SECTION(); return result; } static PyObject *__Pyx_CyFunction_annotate_impl(PyObject *self, PyObject *args) { CYTHON_UNUSED_VAR(args); if (unlikely(!self)) { PyErr_SetString(PyExc_SystemError, "cython __annotate__ called without 'self' argument"); } Py_XINCREF(self); return self; } static PyMethodDef __Pyx_CyFunction_annotate_method = { "__annotate__", (PyCFunction)(void (*)(void))__Pyx_CyFunction_annotate_impl, METH_VARARGS, "Placeholder __annotate__ function to allow 'functools.wraps' to work " "on Cython functions." }; static PyObject * __Pyx_CyFunction_get_annotate(PyObject *op_in, void *context) { CYTHON_UNUSED_VAR(context); PyObject *annotations = __Pyx_CyFunction_get_annotations((__pyx_CyFunctionObject *) op_in, NULL); if (unlikely(!annotations)) return NULL; PyObject *method = PyCFunction_New( &__Pyx_CyFunction_annotate_method, annotations); Py_DECREF(annotations); return method; } static int __Pyx_CyFunction_set_annotate(PyObject *op_in, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); if (value == NULL) { PyErr_SetString(PyExc_TypeError, "__annotate__ cannot be deleted"); return -1; } if (value == Py_None) { return 0; } PyObject *annotations = PyObject_CallObject(value, NULL); if (!annotations) return -1; int result = __Pyx_CyFunction_set_annotations((__pyx_CyFunctionObject *) op_in, annotations, NULL); Py_DECREF(annotations); return result; } static PyObject * __Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) { int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; if (is_coroutine) { PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine; fromlist = PyList_New(1); if (unlikely(!fromlist)) return NULL; Py_INCREF(marker); #if CYTHON_ASSUME_SAFE_MACROS PyList_SET_ITEM(fromlist, 0, marker); #else if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { Py_DECREF(fromlist); return NULL; } #endif module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0); Py_DECREF(fromlist); if (unlikely(!module)) goto ignore; is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker); Py_DECREF(module); if (likely(is_coroutine_value)) { return is_coroutine_value; } ignore: PyErr_Clear(); } return __Pyx_PyBool_FromLong(is_coroutine); } static PyObject * __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { PyObject *result; CYTHON_UNUSED_VAR(context); if (op->func_is_coroutine) { return __Pyx_NewRef(op->func_is_coroutine); } result = __Pyx_CyFunction_get_is_coroutine_value(op); if (unlikely(!result)) return NULL; __Pyx_BEGIN_CRITICAL_SECTION(op); if (op->func_is_coroutine) { Py_DECREF(result); result = __Pyx_NewRef(op->func_is_coroutine); } else { op->func_is_coroutine = __Pyx_NewRef(result); } __Pyx_END_CRITICAL_SECTION(); return result; } static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) { #if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); if (!py_name) return; PyErr_Format(PyExc_TypeError, "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", py_name, message, size); Py_DECREF(py_name); #else const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; PyErr_Format(PyExc_TypeError, "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)", name, message, size); #endif } static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) { #if CYTHON_COMPILING_IN_LIMITED_API PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL); if (!py_name) return; PyErr_Format(PyExc_TypeError, "%.200S() %s", py_name, message); Py_DECREF(py_name); #else const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name; PyErr_Format(PyExc_TypeError, "%.200s() %s", name, message); #endif } #if CYTHON_COMPILING_IN_LIMITED_API static PyObject * __Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { CYTHON_UNUSED_VAR(context); return PyObject_GetAttrString(op->func, "__module__"); } static int __Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { CYTHON_UNUSED_VAR(context); return PyObject_SetAttrString(op->func, "__module__", value); } #endif static PyGetSetDef __pyx_CyFunction_getsets[] = { {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0}, #else {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0}, #endif {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, {"__annotate__", (getter)__Pyx_CyFunction_get_annotate, (setter)__Pyx_CyFunction_set_annotate, 0, 0}, {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, #if CYTHON_COMPILING_IN_LIMITED_API {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, #endif {0, 0, 0, 0, 0} }; static PyMemberDef __pyx_CyFunction_members[] = { #if !CYTHON_COMPILING_IN_LIMITED_API {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, #endif #if CYTHON_METH_FASTCALL #if CYTHON_COMPILING_IN_LIMITED_API {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, #else {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, #endif #if CYTHON_COMPILING_IN_LIMITED_API {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, #else {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, #endif #endif {0, 0, 0, 0, 0} }; static PyObject * __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) { PyObject *result = NULL; CYTHON_UNUSED_VAR(args); __Pyx_BEGIN_CRITICAL_SECTION(m); Py_INCREF(m->func_qualname); result = m->func_qualname; __Pyx_END_CRITICAL_SECTION(); return result; } static PyMethodDef __pyx_CyFunction_methods[] = { {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, {0, 0, 0, 0} }; #if CYTHON_COMPILING_IN_LIMITED_API #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) #else #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) #endif static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { #if !CYTHON_COMPILING_IN_LIMITED_API PyCFunctionObject *cf = (PyCFunctionObject*) op; #endif if (unlikely(op == NULL)) return NULL; #if CYTHON_COMPILING_IN_LIMITED_API op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); if (unlikely(!op->func)) return NULL; #endif op->flags = flags; __Pyx_CyFunction_weakreflist(op) = NULL; #if !CYTHON_COMPILING_IN_LIMITED_API cf->m_ml = ml; cf->m_self = (PyObject *) op; #endif Py_XINCREF(closure); op->func_closure = closure; #if !CYTHON_COMPILING_IN_LIMITED_API Py_XINCREF(module); cf->m_module = module; #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API op->func_dict = NULL; #endif op->func_name = NULL; Py_INCREF(qualname); op->func_qualname = qualname; op->func_doc = NULL; #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API op->func_classobj = NULL; #else ((PyCMethodObject*)op)->mm_class = NULL; #endif op->func_globals = globals; Py_INCREF(op->func_globals); Py_XINCREF(code); op->func_code = code; op->defaults = NULL; op->defaults_tuple = NULL; op->defaults_kwdict = NULL; op->defaults_getter = NULL; op->func_annotations = NULL; op->func_is_coroutine = NULL; #if CYTHON_METH_FASTCALL switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { case METH_NOARGS: __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; break; case METH_O: __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; break; case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; break; case METH_FASTCALL | METH_KEYWORDS: __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; break; case METH_VARARGS | METH_KEYWORDS: __Pyx_CyFunction_func_vectorcall(op) = NULL; break; default: PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); Py_DECREF(op); return NULL; } #endif return (PyObject *) op; } static int __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) { Py_CLEAR(m->func_closure); #if CYTHON_COMPILING_IN_LIMITED_API Py_CLEAR(m->func); #else Py_CLEAR(((PyCFunctionObject*)m)->m_module); #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API Py_CLEAR(m->func_dict); #elif PY_VERSION_HEX < 0x030d0000 _PyObject_ClearManagedDict((PyObject*)m); #else PyObject_ClearManagedDict((PyObject*)m); #endif Py_CLEAR(m->func_name); Py_CLEAR(m->func_qualname); Py_CLEAR(m->func_doc); Py_CLEAR(m->func_globals); Py_CLEAR(m->func_code); #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); #else { PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; ((PyCMethodObject *) (m))->mm_class = NULL; Py_XDECREF(cls); } #endif Py_CLEAR(m->defaults_tuple); Py_CLEAR(m->defaults_kwdict); Py_CLEAR(m->func_annotations); Py_CLEAR(m->func_is_coroutine); Py_CLEAR(m->defaults); return 0; } static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) { if (__Pyx_CyFunction_weakreflist(m) != NULL) PyObject_ClearWeakRefs((PyObject *) m); __Pyx_CyFunction_clear(m); __Pyx_PyHeapTypeObject_GC_Del(m); } static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) { PyObject_GC_UnTrack(m); __Pyx__CyFunction_dealloc(m); } static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) { { int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg); if (e) return e; } Py_VISIT(m->func_closure); #if CYTHON_COMPILING_IN_LIMITED_API Py_VISIT(m->func); #else Py_VISIT(((PyCFunctionObject*)m)->m_module); #endif #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API Py_VISIT(m->func_dict); #else { int e = #if PY_VERSION_HEX < 0x030d0000 _PyObject_VisitManagedDict #else PyObject_VisitManagedDict #endif ((PyObject*)m, visit, arg); if (e != 0) return e; } #endif __Pyx_VISIT_CONST(m->func_name); __Pyx_VISIT_CONST(m->func_qualname); Py_VISIT(m->func_doc); Py_VISIT(m->func_globals); __Pyx_VISIT_CONST(m->func_code); Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); Py_VISIT(m->defaults_tuple); Py_VISIT(m->defaults_kwdict); Py_VISIT(m->func_annotations); Py_VISIT(m->func_is_coroutine); Py_VISIT(m->defaults); return 0; } static PyObject* __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) { PyObject *repr; __Pyx_BEGIN_CRITICAL_SECTION(op); repr = PyUnicode_FromFormat("", op->func_qualname, (void *)op); __Pyx_END_CRITICAL_SECTION(); return repr; } static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { #if CYTHON_COMPILING_IN_LIMITED_API PyObject *f = ((__pyx_CyFunctionObject*)func)->func; PyCFunction meth; int flags; meth = PyCFunction_GetFunction(f); if (unlikely(!meth)) return NULL; flags = PyCFunction_GetFlags(f); if (unlikely(flags < 0)) return NULL; #else PyCFunctionObject* f = (PyCFunctionObject*)func; PyCFunction meth = f->m_ml->ml_meth; int flags = f->m_ml->ml_flags; #endif Py_ssize_t size; switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { case METH_VARARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) return (*meth)(self, arg); break; case METH_VARARGS | METH_KEYWORDS: return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw); case METH_NOARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { #if CYTHON_ASSUME_SAFE_SIZE size = PyTuple_GET_SIZE(arg); #else size = PyTuple_Size(arg); if (unlikely(size < 0)) return NULL; #endif if (likely(size == 0)) return (*meth)(self, NULL); __Pyx_CyFunction_raise_argument_count_error( (__pyx_CyFunctionObject*)func, "takes no arguments", size); return NULL; } break; case METH_O: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { #if CYTHON_ASSUME_SAFE_SIZE size = PyTuple_GET_SIZE(arg); #else size = PyTuple_Size(arg); if (unlikely(size < 0)) return NULL; #endif if (likely(size == 1)) { PyObject *result, *arg0; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS arg0 = PyTuple_GET_ITEM(arg, 0); #else arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; #endif result = (*meth)(self, arg0); #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) Py_DECREF(arg0); #endif return result; } __Pyx_CyFunction_raise_argument_count_error( (__pyx_CyFunctionObject*)func, "takes exactly one argument", size); return NULL; } break; default: PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); return NULL; } __Pyx_CyFunction_raise_type_error( (__pyx_CyFunctionObject*)func, "takes no keyword arguments"); return NULL; } static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *self, *result; #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)func)->m_self; #endif result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); return result; } static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { PyObject *result; __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); if (vc) { #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); #else (void) &__Pyx_PyVectorcall_FastCallDict; return PyVectorcall_Call(func, args, kw); #endif } #endif if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { Py_ssize_t argc; PyObject *new_args; PyObject *self; #if CYTHON_ASSUME_SAFE_SIZE argc = PyTuple_GET_SIZE(args); #else argc = PyTuple_Size(args); if (unlikely(argc < 0)) return NULL; #endif new_args = PyTuple_GetSlice(args, 1, argc); if (unlikely(!new_args)) return NULL; self = PyTuple_GetItem(args, 0); if (unlikely(!self)) { Py_DECREF(new_args); PyErr_Format(PyExc_TypeError, "unbound method %.200S() needs an argument", cyfunc->func_qualname); return NULL; } result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); Py_DECREF(new_args); } else { result = __Pyx_CyFunction_Call(func, args, kw); } return result; } #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) { int ret = 0; if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { if (unlikely(nargs < 1)) { __Pyx_CyFunction_raise_type_error( cyfunc, "needs an argument"); return -1; } ret = 1; } if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) { __Pyx_CyFunction_raise_type_error( cyfunc, "takes no keyword arguments"); return -1; } return ret; } static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) { __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); PyObject *self; #if CYTHON_COMPILING_IN_LIMITED_API PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); if (unlikely(!meth)) return NULL; #else PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; #endif switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { case 1: self = args[0]; args += 1; nargs -= 1; break; case 0: #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)cyfunc)->m_self; #endif break; default: return NULL; } if (unlikely(nargs != 0)) { __Pyx_CyFunction_raise_argument_count_error( cyfunc, "takes no arguments", nargs); return NULL; } return meth(self, NULL); } static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) { __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); PyObject *self; #if CYTHON_COMPILING_IN_LIMITED_API PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); if (unlikely(!meth)) return NULL; #else PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; #endif switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { case 1: self = args[0]; args += 1; nargs -= 1; break; case 0: #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)cyfunc)->m_self; #endif break; default: return NULL; } if (unlikely(nargs != 1)) { __Pyx_CyFunction_raise_argument_count_error( cyfunc, "takes exactly one argument", nargs); return NULL; } return meth(self, args[0]); } static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) { __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); PyObject *self; #if CYTHON_COMPILING_IN_LIMITED_API PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); if (unlikely(!meth)) return NULL; #else PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; #endif switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { case 1: self = args[0]; args += 1; nargs -= 1; break; case 0: #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)cyfunc)->m_self; #endif break; default: return NULL; } return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames); } static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) { __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); PyObject *self; #if CYTHON_COMPILING_IN_LIMITED_API PyCFunction meth = PyCFunction_GetFunction(cyfunc->func); if (unlikely(!meth)) return NULL; #else PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth; #endif switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { case 1: self = args[0]; args += 1; nargs -= 1; break; case 0: #if CYTHON_COMPILING_IN_LIMITED_API self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func); if (unlikely(!self) && PyErr_Occurred()) return NULL; #else self = ((PyCFunctionObject*)cyfunc)->m_self; #endif break; default: return NULL; } #if PY_VERSION_HEX < 0x030e00A6 size_t nargs_value = (size_t) nargs; #else Py_ssize_t nargs_value = nargs; #endif return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames); } #endif static PyType_Slot __pyx_CyFunctionType_slots[] = { {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, {Py_tp_methods, (void *)__pyx_CyFunction_methods}, {Py_tp_members, (void *)__pyx_CyFunction_members}, {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, {0, 0}, }; static PyType_Spec __pyx_CyFunctionType_spec = { __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", sizeof(__pyx_CyFunctionObject), 0, #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR Py_TPFLAGS_METHOD_DESCRIPTOR | #endif #if CYTHON_METH_FASTCALL #if defined(Py_TPFLAGS_HAVE_VECTORCALL) Py_TPFLAGS_HAVE_VECTORCALL | #elif defined(_Py_TPFLAGS_HAVE_VECTORCALL) _Py_TPFLAGS_HAVE_VECTORCALL | #endif #endif // CYTHON_METH_FASTCALL #if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API Py_TPFLAGS_MANAGED_DICT | #endif Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION | Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, __pyx_CyFunctionType_slots }; static int __pyx_CyFunction_init(PyObject *module) { __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module); mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec( mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL); if (unlikely(mstate->__pyx_CyFunctionType == NULL)) { return -1; } return 0; } static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type); if (unlikely(!m->defaults)) return NULL; return m->defaults; } static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults_tuple = tuple; Py_INCREF(tuple); } static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults_kwdict = dict; Py_INCREF(dict); } static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->func_annotations = dict; Py_INCREF(dict); } /* CythonFunction */ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { PyObject *op = __Pyx_CyFunction_Init( PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType), ml, flags, qualname, closure, module, globals, code ); if (likely(op)) { PyObject_GC_Track(op); } return op; } /* PyDictVersioning (used by CLineInTraceback) */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { PyObject *dict = Py_TYPE(obj)->tp_dict; return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; } static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { PyObject **dictptr = NULL; Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; if (offset) { #if CYTHON_COMPILING_IN_CPYTHON dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); #else dictptr = _PyObject_GetDictPtr(obj); #endif } return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; } static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { PyObject *dict = Py_TYPE(obj)->tp_dict; if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) return 0; return obj_dict_version == __Pyx_get_object_dict_version(obj); } #endif /* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */ #if CYTHON_FAST_THREAD_STATE static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(tuple); for (i=0; i= 0x030C00A6 PyObject *current_exception = tstate->current_exception; if (unlikely(!current_exception)) return 0; exc_type = (PyObject*) Py_TYPE(current_exception); if (exc_type == err) return 1; #else exc_type = tstate->curexc_type; if (exc_type == err) return 1; if (unlikely(!exc_type)) return 0; #endif #if CYTHON_AVOID_BORROWED_REFS Py_INCREF(exc_type); #endif if (unlikely(PyTuple_Check(err))) { result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); } else { result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); } #if CYTHON_AVOID_BORROWED_REFS Py_DECREF(exc_type); #endif return result; } #endif /* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { #if PY_VERSION_HEX >= 0x030C00A6 PyObject *tmp_value; assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); if (value) { #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) #endif PyException_SetTraceback(value, tb); } tmp_value = tstate->current_exception; tstate->current_exception = value; Py_XDECREF(tmp_value); Py_XDECREF(type); Py_XDECREF(tb); #else 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); #endif } static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { #if PY_VERSION_HEX >= 0x030C00A6 PyObject* exc_value; exc_value = tstate->current_exception; tstate->current_exception = 0; *value = exc_value; *type = NULL; *tb = NULL; if (exc_value) { *type = (PyObject*) Py_TYPE(exc_value); Py_INCREF(*type); #if CYTHON_COMPILING_IN_CPYTHON *tb = ((PyBaseExceptionObject*) exc_value)->traceback; Py_XINCREF(*tb); #else *tb = PyException_GetTraceback(exc_value); #endif } #else *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 } #endif /* PyObjectGetAttrStrNoError (used by CLineInTraceback) */ #if __PYX_LIMITED_VERSION_HEX < 0x030d0000 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) __Pyx_PyErr_Clear(); } #endif static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { PyObject *result; #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000 (void) PyObject_GetOptionalAttr(obj, attr_name, &result); return result; #else #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); } #endif result = __Pyx_PyObject_GetAttrStr(obj, attr_name); if (unlikely(!result)) { __Pyx_PyObject_GetAttrStr_ClearAttributeError(); } return result; #endif } /* CLineInTraceback (used by AddTraceback) */ #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000 #define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o)) #elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING #define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL); #else PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) { PyObject **dict_ptr = _PyObject_GetDictPtr(o); return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL; } #endif static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline = NULL; PyObject *ptype, *pvalue, *ptraceback; PyObject *cython_runtime_dict; CYTHON_MAYBE_UNUSED_VAR(tstate); if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) { return c_line; } __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime); if (likely(cython_runtime_dict)) { __PYX_PY_DICT_LOOKUP_IF_MODIFIED( use_cline, cython_runtime_dict, __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False)) } if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; } Py_XDECREF(use_cline); Py_XDECREF(cython_runtime_dict); __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); return c_line; } #endif /* CodeObjectCache (used by AddTraceback) */ 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 __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) { __Pyx_CachedCodeObjectType* code_object; int pos; if (unlikely(!code_line) || unlikely(!code_cache->entries)) { return NULL; } pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line); if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) { return NULL; } code_object = code_cache->entries[pos].code_object; Py_INCREF(code_object); return code_object; } static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS (void)__pyx__find_code_object; return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss. #else struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count); if (old_count < 0) { __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); return NULL; } #endif __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line); #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_atomic_decr_acq_rel(&code_cache->accessor_count); #endif return result; #endif } static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = code_cache->entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { code_cache->entries = entries; code_cache->max_count = 64; 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(code_cache->entries, code_cache->count, code_line); if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) { __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_INCREF(code_object); Py_DECREF(tmp); return; } if (code_cache->count == code_cache->max_count) { int new_max = code_cache->max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } code_cache->entries = entries; code_cache->max_count = new_max; } for (i=code_cache->count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; code_cache->count++; Py_INCREF(code_object); } static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) { #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS (void)__pyx__insert_code_object; return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail. #else struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache; #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_nonatomic_int_type expected = 0; if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) { return; } #endif __pyx__insert_code_object(code_cache, code_line, code_object); #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN); #endif #endif } /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif #if CYTHON_COMPILING_IN_LIMITED_API static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, PyObject *firstlineno, PyObject *name) { PyObject *replace = NULL; if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; replace = PyObject_GetAttrString(code, "replace"); if (likely(replace)) { PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict); Py_DECREF(replace); return result; } PyErr_Clear(); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; PyObject *replace = NULL, *getframe = NULL, *frame = NULL; PyObject *exc_type, *exc_value, *exc_traceback; int success = 0; if (c_line) { c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); } PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); code_object = __pyx_find_code_object(c_line ? -c_line : py_line); if (!code_object) { code_object = Py_CompileString("_getframe()", filename, Py_eval_input); if (unlikely(!code_object)) goto bad; py_py_line = PyLong_FromLong(py_line); if (unlikely(!py_py_line)) goto bad; if (c_line) { py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); } else { py_funcname = PyUnicode_FromString(funcname); } if (unlikely(!py_funcname)) goto bad; dict = PyDict_New(); if (unlikely(!dict)) goto bad; { PyObject *old_code_object = code_object; code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); Py_DECREF(old_code_object); } if (unlikely(!code_object)) goto bad; __pyx_insert_code_object(c_line ? -c_line : py_line, code_object); } else { dict = PyDict_New(); } getframe = PySys_GetObject("_getframe"); if (unlikely(!getframe)) goto bad; if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; frame = PyEval_EvalCode(code_object, dict, dict); if (unlikely(!frame) || frame == Py_None) goto bad; success = 1; bad: PyErr_Restore(exc_type, exc_value, exc_traceback); Py_XDECREF(code_object); Py_XDECREF(py_py_line); Py_XDECREF(py_funcname); Py_XDECREF(dict); Py_XDECREF(replace); if (success) { PyTraceBack_Here( (struct _frame*)frame); } Py_XDECREF(frame); } #else static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = NULL; PyObject *py_funcname = NULL; if (c_line) { py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); if (!py_funcname) goto bad; funcname = PyUnicode_AsUTF8(py_funcname); if (!funcname) goto bad; } py_code = PyCode_NewEmpty(filename, funcname, py_line); Py_XDECREF(py_funcname); return py_code; bad: 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; PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject *ptype, *pvalue, *ptraceback; if (c_line) { c_line = __Pyx_CLineForTraceback(tstate, c_line); } py_code = __pyx_find_code_object(c_line ? -c_line : py_line); if (!py_code) { __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) { /* If the code object creation fails, then we should clear the fetched exception references and propagate the new exception */ Py_XDECREF(ptype); Py_XDECREF(pvalue); Py_XDECREF(ptraceback); goto bad; } __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } py_frame = PyFrame_New( tstate, /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ __pyx_mstate_global->__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); } #endif /* 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;\ } /* PyObjectVectorCallKwBuilder (used by CIntToPy) */ #if CYTHON_VECTORCALL static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { (void)__Pyx_PyObject_FastCallDict; Py_INCREF(key); if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1; args[n] = value; return 0; } CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) { (void)__Pyx_VectorcallBuilder_AddArgStr; if (unlikely(!PyUnicode_Check(key))) { PyErr_SetString(PyExc_TypeError, "keywords must be strings"); return -1; } return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n); } static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) { PyObject *pyKey = PyUnicode_FromString(key); if (!pyKey) return -1; return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n); } #else // CYTHON_VECTORCALL CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) { if (unlikely(!PyUnicode_Check(key))) { PyErr_SetString(PyExc_TypeError, "keywords must be strings"); return -1; } return PyDict_SetItem(builder, key, value); } #endif /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const int neg_one = (int) -1, const_zero = (int) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(int) < sizeof(long)) { return PyLong_FromLong((long) value); } else if (sizeof(int) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #if !CYTHON_COMPILING_IN_PYPY } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(int) <= sizeof(long)) { return PyLong_FromLong((long) value); } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); } } { unsigned char *bytes = (unsigned char *)&value; #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 if (is_unsigned) { return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); } else { return PyLong_FromNativeBytes(bytes, sizeof(value), -1); } #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 int one = 1; int little = (int)*(unsigned char *)&one; return _PyLong_FromByteArray(bytes, sizeof(int), little, !is_unsigned); #else int one = 1; int little = (int)*(unsigned char *)&one; PyObject *from_bytes, *result = NULL, *kwds = NULL; PyObject *py_bytes = NULL, *order_str = NULL; from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); if (!from_bytes) return NULL; py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); if (!py_bytes) goto limited_bad; order_str = PyUnicode_FromString(little ? "little" : "big"); if (!order_str) goto limited_bad; { PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; if (!is_unsigned) { kwds = __Pyx_MakeVectorcallBuilderKwds(1); if (!kwds) goto limited_bad; if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; } result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); } limited_bad: Py_XDECREF(kwds); Py_XDECREF(order_str); Py_XDECREF(py_bytes); Py_XDECREF(from_bytes); return result; #endif } } /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const int neg_one = (int) -1, const_zero = (int) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (unlikely(!PyLong_Check(x))) { int val; PyObject *tmp = __Pyx_PyNumber_Long(x); if (!tmp) return (int) -1; val = __Pyx_PyLong_As_int(tmp); Py_DECREF(tmp); return val; } if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS if (unlikely(__Pyx_PyLong_IsNeg(x))) { goto raise_neg_overflow; } else if (__Pyx_PyLong_IsCompact(x)) { __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_DigitCount(x)) { 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 && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (int) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if ((sizeof(int) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_USE_PYLONG_INTERNALS if (__Pyx_PyLong_IsCompact(x)) { __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_SignedDigitCount(x)) { case -2: if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 2: if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -3: if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 3: if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -4: if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 4: if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; } } #endif if ((sizeof(int) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { int val; int ret = -1; #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API Py_ssize_t bytes_copied = PyLong_AsNativeBytes( x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); if (unlikely(bytes_copied == -1)) { } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { goto raise_overflow; } else { ret = 0; } #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; ret = _PyLong_AsByteArray((PyLongObject *)x, bytes, sizeof(val), is_little, !is_unsigned); #else PyObject *v; PyObject *stepval = NULL, *mask = NULL, *shift = NULL; int bits, remaining_bits, is_negative = 0; int chunk_size = (sizeof(long) < 8) ? 30 : 62; if (likely(PyLong_CheckExact(x))) { v = __Pyx_NewRef(x); } else { v = PyNumber_Long(x); if (unlikely(!v)) return (int) -1; assert(PyLong_CheckExact(v)); } { int result = PyObject_RichCompareBool(v, Py_False, Py_LT); if (unlikely(result < 0)) { Py_DECREF(v); return (int) -1; } is_negative = result == 1; } if (is_unsigned && unlikely(is_negative)) { Py_DECREF(v); goto raise_neg_overflow; } else if (is_negative) { stepval = PyNumber_Invert(v); Py_DECREF(v); if (unlikely(!stepval)) return (int) -1; } else { stepval = v; } v = NULL; val = (int) 0; mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { PyObject *tmp, *digit; long idigit; digit = PyNumber_And(stepval, mask); if (unlikely(!digit)) goto done; idigit = PyLong_AsLong(digit); Py_DECREF(digit); if (unlikely(idigit < 0)) goto done; val |= ((int) idigit) << bits; tmp = PyNumber_Rshift(stepval, shift); if (unlikely(!tmp)) goto done; Py_DECREF(stepval); stepval = tmp; } Py_DECREF(shift); shift = NULL; Py_DECREF(mask); mask = NULL; { long idigit = PyLong_AsLong(stepval); if (unlikely(idigit < 0)) goto done; remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); if (unlikely(idigit >= (1L << remaining_bits))) goto raise_overflow; val |= ((int) idigit) << bits; } if (!is_unsigned) { if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) goto raise_overflow; if (is_negative) val = ~val; } ret = 0; done: Py_XDECREF(shift); Py_XDECREF(mask); Py_XDECREF(stepval); #endif if (unlikely(ret)) return (int) -1; 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; } /* FormatTypeName */ #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000 static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp) { PyObject *module = NULL, *name = NULL, *result = NULL; #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, __pyx_mstate_global->__pyx_n_u_qualname); #else name = PyType_GetQualName(tp); #endif if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad; module = __Pyx_PyObject_GetAttrStr((PyObject *)tp, __pyx_mstate_global->__pyx_n_u_module); if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad; if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) { result = name; name = NULL; goto done; } result = PyUnicode_FromFormat("%U.%U", module, name); if (unlikely(result == NULL)) goto bad; done: Py_XDECREF(name); Py_XDECREF(module); return result; bad: PyErr_Clear(); if (name) { result = name; name = NULL; } else { result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u_); } goto done; } #endif /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const long neg_one = (long) -1, const_zero = (long) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(long) < sizeof(long)) { return PyLong_FromLong((long) value); } else if (sizeof(long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #if !CYTHON_COMPILING_IN_PYPY } 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 PyLong_FromLong((long) value); } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); } } { unsigned char *bytes = (unsigned char *)&value; #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4 if (is_unsigned) { return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1); } else { return PyLong_FromNativeBytes(bytes, sizeof(value), -1); } #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 int one = 1; int little = (int)*(unsigned char *)&one; return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); #else int one = 1; int little = (int)*(unsigned char *)&one; PyObject *from_bytes, *result = NULL, *kwds = NULL; PyObject *py_bytes = NULL, *order_str = NULL; from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); if (!from_bytes) return NULL; py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); if (!py_bytes) goto limited_bad; order_str = PyUnicode_FromString(little ? "little" : "big"); if (!order_str) goto limited_bad; { PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str }; if (!is_unsigned) { kwds = __Pyx_MakeVectorcallBuilderKwds(1); if (!kwds) goto limited_bad; if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad; } result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds); } limited_bad: Py_XDECREF(kwds); Py_XDECREF(order_str); Py_XDECREF(py_bytes); Py_XDECREF(from_bytes); return result; #endif } } /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif const long neg_one = (long) -1, const_zero = (long) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (unlikely(!PyLong_Check(x))) { long val; PyObject *tmp = __Pyx_PyNumber_Long(x); if (!tmp) return (long) -1; val = __Pyx_PyLong_As_long(tmp); Py_DECREF(tmp); return val; } if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS if (unlikely(__Pyx_PyLong_IsNeg(x))) { goto raise_neg_overflow; } else if (__Pyx_PyLong_IsCompact(x)) { __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_DigitCount(x)) { 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 && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (long) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if ((sizeof(long) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_USE_PYLONG_INTERNALS if (__Pyx_PyLong_IsCompact(x)) { __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) } else { const digit* digits = __Pyx_PyLong_Digits(x); assert(__Pyx_PyLong_DigitCount(x) > 1); switch (__Pyx_PyLong_SignedDigitCount(x)) { case -2: if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 2: if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -3: if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 3: if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -4: if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 4: if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; } } #endif if ((sizeof(long) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { long val; int ret = -1; #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API Py_ssize_t bytes_copied = PyLong_AsNativeBytes( x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0)); if (unlikely(bytes_copied == -1)) { } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) { goto raise_overflow; } else { ret = 0; } #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; ret = _PyLong_AsByteArray((PyLongObject *)x, bytes, sizeof(val), is_little, !is_unsigned); #else PyObject *v; PyObject *stepval = NULL, *mask = NULL, *shift = NULL; int bits, remaining_bits, is_negative = 0; int chunk_size = (sizeof(long) < 8) ? 30 : 62; if (likely(PyLong_CheckExact(x))) { v = __Pyx_NewRef(x); } else { v = PyNumber_Long(x); if (unlikely(!v)) return (long) -1; assert(PyLong_CheckExact(v)); } { int result = PyObject_RichCompareBool(v, Py_False, Py_LT); if (unlikely(result < 0)) { Py_DECREF(v); return (long) -1; } is_negative = result == 1; } if (is_unsigned && unlikely(is_negative)) { Py_DECREF(v); goto raise_neg_overflow; } else if (is_negative) { stepval = PyNumber_Invert(v); Py_DECREF(v); if (unlikely(!stepval)) return (long) -1; } else { stepval = v; } v = NULL; val = (long) 0; mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { PyObject *tmp, *digit; long idigit; digit = PyNumber_And(stepval, mask); if (unlikely(!digit)) goto done; idigit = PyLong_AsLong(digit); Py_DECREF(digit); if (unlikely(idigit < 0)) goto done; val |= ((long) idigit) << bits; tmp = PyNumber_Rshift(stepval, shift); if (unlikely(!tmp)) goto done; Py_DECREF(stepval); stepval = tmp; } Py_DECREF(shift); shift = NULL; Py_DECREF(mask); mask = NULL; { long idigit = PyLong_AsLong(stepval); if (unlikely(idigit < 0)) goto done; remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); if (unlikely(idigit >= (1L << remaining_bits))) goto raise_overflow; val |= ((long) idigit) << bits; } if (!is_unsigned) { if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) goto raise_overflow; if (is_negative) val = ~val; } ret = 0; done: Py_XDECREF(shift); Py_XDECREF(mask); Py_XDECREF(stepval); #endif if (unlikely(ret)) return (long) -1; return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); return (long) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long) -1; } /* FastTypeChecks */ #if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); if (a == b) return 1; } return b == &PyBaseObject_Type; } static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { PyObject *mro; if (a == b) return 1; mro = a->tp_mro; if (likely(mro)) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(mro); for (i = 0; i < n; i++) { if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) return 1; } return 0; } return __Pyx_InBases(a, b); } static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { PyObject *mro; if (cls == a || cls == b) return 1; mro = cls->tp_mro; if (likely(mro)) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(mro); for (i = 0; i < n; i++) { PyObject *base = PyTuple_GET_ITEM(mro, i); if (base == (PyObject *)a || base == (PyObject *)b) return 1; } return 0; } return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); } static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { if (exc_type1) { return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); } else { return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); } } static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { Py_ssize_t i, n; assert(PyExceptionClass_Check(exc_type)); n = PyTuple_GET_SIZE(tuple); for (i=0; i>= 8; ++i; } __Pyx_cached_runtime_version = version; } } #endif static unsigned long __Pyx_get_runtime_version(void) { #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 return Py_Version & ~0xFFUL; #else return __Pyx_cached_runtime_version; #endif } /* CheckBinaryVersion */ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) { const unsigned long MAJOR_MINOR = 0xFFFF0000UL; if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR)) return 0; if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR))) return 1; { char message[200]; PyOS_snprintf(message, sizeof(message), "compile time Python version %d.%d " "of module '%.100s' " "%s " "runtime version %d.%d", (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF), __Pyx_MODULE_NAME, (allow_newer) ? "was newer than" : "does not match", (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF) ); return PyErr_WarnEx(NULL, message, 1); } } /* NewCodeObj */ #if CYTHON_COMPILING_IN_LIMITED_API static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { PyObject *exception_table = NULL; PyObject *types_module=NULL, *code_type=NULL, *result=NULL; #if __PYX_LIMITED_VERSION_HEX < 0x030b0000 PyObject *version_info; PyObject *py_minor_version = NULL; #endif long minor_version = 0; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000 minor_version = 11; #else if (!(version_info = PySys_GetObject("version_info"))) goto end; if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; minor_version = PyLong_AsLong(py_minor_version); Py_DECREF(py_minor_version); if (minor_version == -1 && PyErr_Occurred()) goto end; #endif if (!(types_module = PyImport_ImportModule("types"))) goto end; if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; if (minor_version <= 7) { (void)p; result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code, c, n, v, fn, name, fline, lnos, fv, cell); } else if (minor_version <= 10) { result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code, c, n, v, fn, name, fline, lnos, fv, cell); } else { if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code, c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); } end: Py_XDECREF(code_type); Py_XDECREF(exception_table); Py_XDECREF(types_module); if (type) { PyErr_Restore(type, value, traceback); } return result; } #elif PY_VERSION_HEX >= 0x030B0000 static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { PyCodeObject *result; result = #if PY_VERSION_HEX >= 0x030C0000 PyUnstable_Code_NewWithPosOnlyArgs #else PyCode_NewWithPosOnlyArgs #endif (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes); #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1 if (likely(result)) result->_co_firsttraceable = 0; #endif return result; } #elif !CYTHON_COMPILING_IN_PYPY #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif static PyObject* __Pyx_PyCode_New( const __Pyx_PyCode_New_function_description descr, PyObject * const *varnames, PyObject *filename, PyObject *funcname, PyObject *line_table, PyObject *tuple_dedup_map ) { PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL; Py_ssize_t var_count = (Py_ssize_t) descr.nlocals; PyObject *varnames_tuple = PyTuple_New(var_count); if (unlikely(!varnames_tuple)) return NULL; for (Py_ssize_t i=0; i < var_count; i++) { Py_INCREF(varnames[i]); if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done; } #if CYTHON_COMPILING_IN_LIMITED_API varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple); if (!varnames_tuple_dedup) { if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done; varnames_tuple_dedup = varnames_tuple; } #else varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple); if (unlikely(!varnames_tuple_dedup)) goto done; #endif #if CYTHON_AVOID_BORROWED_REFS Py_INCREF(varnames_tuple_dedup); #endif if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) { Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table); #if !CYTHON_ASSUME_SAFE_SIZE if (unlikely(line_table_length == -1)) goto done; #endif Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL; code_bytes = PyBytes_FromStringAndSize(NULL, code_len); if (unlikely(!code_bytes)) goto done; char* c_code_bytes = PyBytes_AsString(code_bytes); if (unlikely(!c_code_bytes)) goto done; memset(c_code_bytes, 0, (size_t) code_len); } code_obj = (PyObject*) __Pyx__PyCode_New( (int) descr.argcount, (int) descr.num_posonly_args, (int) descr.num_kwonly_args, (int) descr.nlocals, 0, (int) descr.flags, code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes, __pyx_mstate_global->__pyx_empty_tuple, __pyx_mstate_global->__pyx_empty_tuple, varnames_tuple_dedup, __pyx_mstate_global->__pyx_empty_tuple, __pyx_mstate_global->__pyx_empty_tuple, filename, funcname, (int) descr.first_line, (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes ); done: Py_XDECREF(code_bytes); #if CYTHON_AVOID_BORROWED_REFS Py_XDECREF(varnames_tuple_dedup); #endif Py_DECREF(varnames_tuple); return code_obj; } /* DecompressString */ static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) { PyObject *module = NULL, *decompress, *compressed_bytes, *decompressed; const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib"; PyObject *methodname = PyUnicode_FromString("decompress"); if (unlikely(!methodname)) return NULL; #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000 if (algo == 3) { PyObject *fromlist = Py_BuildValue("[O]", methodname); if (unlikely(!fromlist)) goto bad; module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0); Py_DECREF(fromlist); } else #endif module = PyImport_ImportModule(module_name); if (unlikely(!module)) goto import_failed; decompress = PyObject_GetAttr(module, methodname); if (unlikely(!decompress)) goto import_failed; { #ifdef __cplusplus char *memview_bytes = const_cast(s); #else #if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wcast-qual" #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-qual" #endif char *memview_bytes = (char*) s; #if defined(__clang__) #pragma clang diagnostic pop #elif !defined(__INTEL_COMPILER) && defined(__GNUC__) #pragma GCC diagnostic pop #endif #endif #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ) int memview_flags = 0x100; #else int memview_flags = PyBUF_READ; #endif compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags); } if (unlikely(!compressed_bytes)) { Py_DECREF(decompress); goto bad; } decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL); Py_DECREF(compressed_bytes); Py_DECREF(decompress); Py_DECREF(module); Py_DECREF(methodname); return decompressed; import_failed: PyErr_Format(PyExc_ImportError, "Failed to import '%.20s.decompress' - cannot initialise module strings. " "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.", module_name, algo); bad: Py_XDECREF(module); Py_DECREF(methodname); return NULL; } #include static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { size_t len = strlen(s); if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) { PyErr_SetString(PyExc_OverflowError, "byte string is too long"); return -1; } return (Py_ssize_t) len; } static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { Py_ssize_t len = __Pyx_ssize_strlen(c_str); if (unlikely(len < 0)) return NULL; return __Pyx_PyUnicode_FromStringAndSize(c_str, len); } static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) { Py_ssize_t len = __Pyx_ssize_strlen(c_str); if (unlikely(len < 0)) return NULL; return PyByteArray_FromStringAndSize(c_str, len); } static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; #if CYTHON_COMPILING_IN_LIMITED_API { const char* result; Py_ssize_t unicode_length; CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII #if __PYX_LIMITED_VERSION_HEX < 0x030A0000 if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL; #else result = PyUnicode_AsUTF8AndSize(o, length); #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII unicode_length = PyUnicode_GetLength(o); if (unlikely(unicode_length < 0)) return NULL; if (unlikely(unicode_length != *length)) { PyUnicode_AsASCIIString(o); return NULL; } #endif return result; } #else #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (likely(PyUnicode_IS_ASCII(o))) { *length = PyUnicode_GET_LENGTH(o); return PyUnicode_AsUTF8(o); } else { PyUnicode_AsASCIIString(o); return NULL; } #else return PyUnicode_AsUTF8AndSize(o, length); #endif #endif } #endif static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 if (PyUnicode_Check(o)) { return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif if (PyByteArray_Check(o)) { #if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))) *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); #else *length = PyByteArray_Size(o); if (*length == -1) return NULL; return PyByteArray_AsString(o); #endif } else { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); if (unlikely(r < 0)) { return NULL; } else { return result; } } } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { int retval; if (unlikely(!x)) return -1; retval = __Pyx_PyObject_IsTrue(x); Py_DECREF(x); return retval; } static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) { __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result)); if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " "The ability to return an instance of a strict subclass of int is deprecated, " "and may be removed in a future version of Python.", result_type_name)) { __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } __Pyx_DECREF_TypeName(result_type_name); return result; } PyErr_Format(PyExc_TypeError, "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")", result_type_name); __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) { #if CYTHON_USE_TYPE_SLOTS PyNumberMethods *m; #endif PyObject *res = NULL; if (likely(PyLong_Check(x))) return __Pyx_NewRef(x); #if CYTHON_USE_TYPE_SLOTS m = Py_TYPE(x)->tp_as_number; if (likely(m && m->nb_int)) { res = m->nb_int(x); } #else if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { res = PyNumber_Long(x); } #endif if (likely(res)) { if (unlikely(!PyLong_CheckExact(res))) { return __Pyx_PyNumber_LongWrongResultType(res); } } 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 (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS if (likely(__Pyx_PyLong_IsCompact(b))) { return __Pyx_PyLong_CompactValue(b); } else { const digit* digits = __Pyx_PyLong_Digits(b); const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); 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 = PyLong_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); } else { Py_ssize_t ival; PyObject *x; x = PyNumber_Index(o); if (!x) return -1; ival = PyLong_AsLong(x); Py_DECREF(x); return ival; } } static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) { CYTHON_UNUSED_VAR(b); return __Pyx_NewRef(Py_None); } static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return __Pyx_NewRef(b ? Py_True: Py_False); } static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) { return PyLong_FromSize_t(ival); } /* MultiPhaseInitModuleState */ #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE #ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE #if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000) #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1 #else #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0 #endif #endif #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS #error "Module state with PEP489 requires atomics. Currently that's one of\ C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics" #endif #if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE #define __Pyx_ModuleStateLookup_Lock() #define __Pyx_ModuleStateLookup_Unlock() #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000 static PyMutex __Pyx_ModuleStateLookup_mutex = {0}; #define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex) #define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex) #elif defined(__cplusplus) && __cplusplus >= 201103L #include static std::mutex __Pyx_ModuleStateLookup_mutex; #define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock() #define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock() #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__) #include static mtx_t __Pyx_ModuleStateLookup_mutex; static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT; static void __Pyx_ModuleStateLookup_initialize_mutex(void) { mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain); } #define __Pyx_ModuleStateLookup_Lock()\ call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\ mtx_lock(&__Pyx_ModuleStateLookup_mutex) #define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex) #elif defined(HAVE_PTHREAD_H) #include static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER; #define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex) #define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex) #elif defined(_WIN32) #include // synchapi.h on its own doesn't work static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT; #define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) #define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex) #else #error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\ Requires C standard >= C11, or C++ standard >= C++11,\ or pthreads, or the Windows 32 API, or Python >= 3.13." #endif typedef struct { int64_t id; PyObject *module; } __Pyx_InterpreterIdAndModule; typedef struct { char interpreter_id_as_index; Py_ssize_t count; Py_ssize_t allocated; __Pyx_InterpreterIdAndModule table[1]; } __Pyx_ModuleStateLookupData; #define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32 #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0; #endif #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0; #else static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL; #endif static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound( __Pyx_InterpreterIdAndModule* table, Py_ssize_t count, int64_t interpreterId) { __Pyx_InterpreterIdAndModule* begin = table; __Pyx_InterpreterIdAndModule* end = begin + count; if (begin->id == interpreterId) { return begin; } while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2; if (halfway->id == interpreterId) { return halfway; } if (halfway->id < interpreterId) { begin = halfway; } else { end = halfway; } } for (; begin < end; ++begin) { if (begin->id >= interpreterId) return begin; } return begin; } static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) { int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); if (interpreter_id == -1) return NULL; #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); { __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); if (likely(data)) { __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data); if (likely(data == new_data)) { goto read_finished; } } __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); __Pyx_ModuleStateLookup_Lock(); __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter); data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data); __Pyx_ModuleStateLookup_Unlock(); } read_finished:; #else __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data; #endif __Pyx_InterpreterIdAndModule* found = NULL; if (unlikely(!data)) goto end; if (data->interpreter_id_as_index) { if (interpreter_id < data->count) { found = data->table+interpreter_id; } } else { found = __Pyx_State_FindModuleStateLookupTableLowerBound( data->table, data->count, interpreter_id); } end: { PyObject *result=NULL; if (found && found->id == interpreter_id) { result = found->module; } #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter); #endif return result; } } #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) { while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0); } #else #define __Pyx_ModuleStateLookup_wait_until_no_readers() #endif static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) { Py_ssize_t to_allocate = (*old_data)->allocated; while (to_allocate <= interpreter_id) { if (to_allocate == 0) to_allocate = 1; else to_allocate *= 2; } __Pyx_ModuleStateLookupData *new_data = *old_data; if (to_allocate != (*old_data)->allocated) { new_data = (__Pyx_ModuleStateLookupData *)realloc( *old_data, sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); if (!new_data) { PyErr_NoMemory(); return -1; } for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) { new_data->table[i].id = i; new_data->table[i].module = NULL; } new_data->allocated = to_allocate; } new_data->table[interpreter_id].module = module; if (new_data->count < interpreter_id+1) { new_data->count = interpreter_id+1; } *old_data = new_data; return 0; } static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) { __Pyx_InterpreterIdAndModule *read = data->table; __Pyx_InterpreterIdAndModule *write = data->table; __Pyx_InterpreterIdAndModule *end = read + data->count; for (; readmodule) { write->id = read->id; write->module = read->module; ++write; } } data->count = write - data->table; for (; writeid = 0; write->module = NULL; } data->interpreter_id_as_index = 0; } static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) { int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); if (interpreter_id == -1) return -1; int result = 0; __Pyx_ModuleStateLookup_Lock(); #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *) __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); #else __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data; #endif __Pyx_ModuleStateLookupData *new_data = old_data; if (!new_data) { new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData)); if (!new_data) { result = -1; PyErr_NoMemory(); goto end; } new_data->allocated = 1; new_data->interpreter_id_as_index = 1; } __Pyx_ModuleStateLookup_wait_until_no_readers(); if (new_data->interpreter_id_as_index) { if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) { result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id); goto end; } __Pyx_State_ConvertFromInterpIdAsIndex(new_data); } { Py_ssize_t insert_at = 0; { __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( new_data->table, new_data->count, interpreter_id); assert(lower_bound); insert_at = lower_bound - new_data->table; if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) { lower_bound->module = module; goto end; // already in table, nothing more to do } } if (new_data->count+1 >= new_data->allocated) { Py_ssize_t to_allocate = (new_data->count+1)*2; new_data = (__Pyx_ModuleStateLookupData*)realloc( new_data, sizeof(__Pyx_ModuleStateLookupData) + (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule)); if (!new_data) { result = -1; new_data = old_data; PyErr_NoMemory(); goto end; } new_data->allocated = to_allocate; } ++new_data->count; int64_t last_id = interpreter_id; PyObject *last_module = module; for (Py_ssize_t i=insert_at; icount; ++i) { int64_t current_id = new_data->table[i].id; new_data->table[i].id = last_id; last_id = current_id; PyObject *current_module = new_data->table[i].module; new_data->table[i].module = last_module; last_module = current_module; } } end: #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data); #else __Pyx_ModuleStateLookup_data = new_data; #endif __Pyx_ModuleStateLookup_Unlock(); return result; } static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) { int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get()); if (interpreter_id == -1) return -1; __Pyx_ModuleStateLookup_Lock(); #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *) __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0); #else __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data; #endif if (data->interpreter_id_as_index) { if (interpreter_id < data->count) { data->table[interpreter_id].module = NULL; } goto done; } { __Pyx_ModuleStateLookup_wait_until_no_readers(); __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound( data->table, data->count, interpreter_id); if (!lower_bound) goto done; if (lower_bound->id != interpreter_id) goto done; __Pyx_InterpreterIdAndModule *end = data->table+data->count; for (;lower_boundid = (lower_bound+1)->id; lower_bound->module = (lower_bound+1)->module; } } --data->count; if (data->count == 0) { free(data); data = NULL; } done: #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data); #else __Pyx_ModuleStateLookup_data = data; #endif __Pyx_ModuleStateLookup_Unlock(); return 0; } #endif /* #### Code section: utility_code_pragmas_end ### */ #ifdef _MSC_VER #pragma warning( pop ) #endif /* #### Code section: end ### */ #endif /* Py_PYTHON_H */ graph-algorithms-planarity-08d7b51/planarity/full/graphLib.pxd000066400000000000000000000234071522057144000245370ustar00rootroot00000000000000"""Definition file for functions that wrap calls to the C-layer EAPS graphLib This definition file corresponds to the graphLib.pyx implementation file, and allows other Cython modules access to bare wrappers of the C graphLib API. https://cython.readthedocs.io/en/latest/src/userguide/sharing_declarations.html#sharing-extension-types """ from planarity.full cimport cgraphLib from planarity.full.cgraphLib cimport graphP, G6ReadIteratorP, G6WriteIteratorP # Surfaced from planarity/c/graphLib/graph.h cdef graphP gp_New() cdef int gp_EnsureVertexCapacity(graphP theGraph, int N) cdef int gp_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity) cdef void gp_ResetGraphStorage(graphP theGraph) cdef void gp_Free(graphP *pGraph) cdef int gp_GetN(graphP theGraph) cdef int gp_GetNV(graphP theGraph) cdef int gp_GetM(graphP theGraph) cdef int gp_GetEdgeCapacity(graphP theGraph) cdef int gp_CopyGraph(graphP dstGraph, graphP srcGraph) cdef graphP gp_DupGraph(graphP theGraph) cdef int gp_CopyAdjacencyLists(graphP dstGraph, graphP srcGraph) cdef int gp_CreateRandomGraph(graphP theGraph) cdef int gp_CreateRandomGraphEx(graphP theGraph, int numEdges) cdef int gp_IsNeighbor(graphP theGraph, int u, int v) cdef int gp_FindEdge(graphP theGraph, int u, int v) cdef int gp_GetVertexDegree(graphP theGraph, int v) cdef int gp_IsNeighborDirected(graphP theGraph, int u, int v, unsigned direction) cdef int gp_FindDirectedEdge(graphP theGraph, int u, int v, unsigned direction) cdef int gp_GetVertexInDegree(graphP theGraph, int v) cdef int gp_GetVertexOutDegree(graphP theGraph, int v) cdef int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink) cdef int gp_DynamicAddEdge(graphP theGraph, int u, int ulink, int v, int vlink) cdef int gp_InsertEdge(graphP theGraph, int u, int e_u, int e_ulink, int v, int e_v, int e_vlink) cdef int gp_DeleteEdge(graphP theGraph, int e) cdef void gp_HideEdge(graphP theGraph, int e) cdef void gp_RestoreEdge(graphP theGraph, int e) cdef int gp_HideVertex(graphP theGraph, int vertex) cdef int gp_RestoreVertex(graphP theGraph) cdef int gp_ContractEdge(graphP theGraph, int e) cdef int gp_IdentifyVertices(graphP theGraph, int u, int v, int eBefore) cdef int gp_RestoreVertices(graphP theGraph) cdef int gp_GetGraphFlags(graphP theGraph) cdef int gp_GetFirstEdge(graphP theGraph, int v) cdef int gp_GetLastEdge(graphP theGraph, int v) cdef int gp_GetEdgeByLink(graphP theGraph, int v, int theLink) cdef void gp_SetFirstEdge(graphP theGraph, int v, int newFirstEdge) cdef void gp_SetLastEdge(graphP theGraph, int v, int newLastEdge) cdef void gp_SetEdgeByLink(graphP theGraph, int v, int theLink, int newEdge) cdef int gp_LowerBoundVertices(graphP theGraph) cdef int gp_UpperBoundVertices(graphP theGraph) cdef int gp_LowerBoundVirtualVertices(graphP theGraph) cdef int gp_UpperBoundVirtualVertices(graphP theGraph) cdef int gp_LowerBoundVertexStorage(graphP theGraph) cdef int gp_UpperBoundVertexStorage(graphP theGraph) cdef int gp_IsVertex(graphP theGraph, int v) cdef int gp_IsVirtualVertex(graphP theGraph, int v) cdef int gp_IsNotVertex(graphP theGraph, int v) cdef int gp_IsNotVirtualVertex(graphP theGraph, int v) cdef int gp_VirtualVertexInUse(graphP theGraph, int virtualVertex) cdef int gp_VirtualVertexNotInUse(graphP theGraph, int virtualVertex) cdef int gp_GetIndex(graphP theGraph, int v) cdef void gp_SetIndex(graphP theGraph, int v, int theIndex) cdef void gp_InitFlags(graphP theGraph, int v) cdef int gp_GetVisited(graphP theGraph, int v) cdef void gp_ClearVisited(graphP theGraph, int v) cdef void gp_SetVisited(graphP theGraph, int v) cdef int gp_GetMarked(graphP theGraph, int v) cdef void gp_ClearMarked(graphP theGraph, int v) cdef void gp_SetMarked(graphP theGraph, int v) cdef int gp_GetTwin(graphP theGraph, int e) cdef int gp_GetNextEdge(graphP theGraph, int e) cdef int gp_GetPrevEdge(graphP theGraph, int e) cdef int gp_GetAdjacentEdge(graphP theGraph, int e, int theLink) cdef void gp_SetNextEdge(graphP theGraph, int e, int newNextEdge) cdef void gp_SetPrevEdge(graphP theGraph, int e, int newPrevEdge) cdef void gp_SetAdjacentEdge(graphP theGraph, int e, int theLink, int newEdge) cdef int gp_IsEdge(graphP theGraph, int e) cdef int gp_IsNotEdge(graphP theGraph, int e) cdef int gp_GetNeighbor(graphP theGraph, int e) cdef void gp_SetNeighbor(graphP theGraph, int e, int v) cdef void gp_InitEdgeFlags(graphP theGraph, int e) cdef int gp_GetEdgeVisited(graphP theGraph, int e) cdef void gp_ClearEdgeVisited(graphP theGraph, int e) cdef void gp_SetEdgeVisited(graphP theGraph, int e) cdef int gp_GetEdgeMarked(graphP theGraph, int e) cdef void gp_ClearEdgeMarked(graphP theGraph, int e) cdef void gp_SetEdgeMarked(graphP theGraph, int e) cdef int gp_GetEdgeType(graphP theGraph, int e) cdef void gp_ClearEdgeType(graphP theGraph, int e) cdef void gp_SetEdgeType(graphP theGraph, int e, int type) cdef void gp_ResetEdgeType(graphP theGraph, int e, int type) cdef int gp_GetEdgeFlagInverted(graphP theGraph, int e) cdef void gp_SetEdgeFlagInverted(graphP theGraph, int e) cdef void gp_ClearEdgeFlagInverted(graphP theGraph, int e) cdef void gp_XorEdgeFlagInverted(graphP theGraph, int e) cdef int gp_GetDirection(graphP theGraph, int e) cdef void gp_SetDirection(graphP theGraph, int e, int direction) cdef int gp_LowerBoundEdges(graphP theGraph) cdef int gp_UpperBoundEdges(graphP theGraph) cdef int gp_EdgeInUse(graphP theGraph, int e) cdef int gp_EdgeNotInUse(graphP theGraph, int e) cdef int gp_LowerBoundEdgeStorage(graphP theGraph) cdef int gp_UpperBoundEdgeStorage(graphP theGraph) # Surfaced from planarity/c/graphLib/io/graphIO.h cdef int gp_Read(graphP theGraph, char *fileName) cdef int gp_ReadFromString(graphP theGraph, char *inputStr) cdef int gp_Write(graphP theGraph, char *fileName, int writeMode) cdef int gp_WriteToString(graphP theGraph, char **pOutputStr, int writeMode) # Surfaced from planarity/c/graphLib/io/g6-read-iterator.h cdef int g6_NewReader(G6ReadIteratorP *pG6ReadIterator, graphP theGraph) cdef int g6_InitReaderWithString(G6ReadIteratorP theG6ReadIterator, char *inputString) cdef int g6_InitReaderWithFileName(G6ReadIteratorP theG6ReadIterator, char *infileName) cdef int g6_ReadGraph(G6ReadIteratorP theG6ReadIterator) cdef int g6_EndReached(G6ReadIteratorP theG6ReadIterator) cdef void g6_FreeReader(G6ReadIteratorP *pG6ReadIterator) # Surfaced from planarity/c/graphLib/io/g6-write-iterator.h cdef int g6_NewWriter(G6WriteIteratorP *pG6WriteIterator, graphP theGraph) cdef int g6_InitWriterWithString(G6WriteIteratorP theG6WriteIterator, char **pOutputString) cdef int g6_InitWriterWithFileName(G6WriteIteratorP theG6WriteIterator, char *outputFileName) cdef int g6_WriteGraph(G6WriteIteratorP theG6WriteIterator) cdef void g6_FreeWriter(G6WriteIteratorP *pG6WriteIterator) # Wraps functions declared in "planarity/c/graphLib/graphDFSUtils.h" cdef int gp_ExtendWith_DFSUtils(graphP theGraph) cdef int gp_Detach_DFSUtils(graphP theGraph) cdef int gp_DepthFirstSearch(graphP theGraph) cdef int gp_SortVertices(graphP theGraph) cdef int gp_ComputeLowpoints(graphP theGraph) cdef int gp_ComputeLeastAncestors(graphP theGraph) cdef int gp_GetParent(graphP theGraph, int v) cdef int gp_GetLeastAncestor(graphP theGraph, int v) cdef int gp_GetLowpoint(graphP theGraph, int v) # FIXME: We fail to link due to issue where these macros call private # gp_GetVertexParent() rather than public gp_GetParent(). These can # be added in once EAPS is fixed. # cdef int gp_IsDFSTreeRoot(graphP theGraph, int v) # cdef int gp_IsNotDFSTreeRoot(graphP theGraph, int v) cdef int gp_GetBicompRootFromDFSChild(graphP theGraph, int c) cdef int gp_GetDFSChildFromBicompRoot(graphP theGraph, int R) # FIXME: We fail to link due to issue where this macro calls private # gp_GetVertexParent() rather than public gp_GetParent(). This can # added in once EAPS is fixed. # cdef int gp_GetVertexFromBicompRoot(graphP theGraph, int R) cdef int gp_IsBicompRoot(graphP theGraph, int v) cdef int gp_IsSeparatedDFSChild(graphP theGraph, int theChild) cdef int gp_IsNotSeparatedDFSChild(graphP theGraph, int theChild) # Surfaced from planarity/c/graphLib/planarityRelated/graphPlanarity.h cdef int gp_ExtendWith_Planarity(graphP theGraph) cdef int gp_Detach_Planarity(graphP theGraph) cdef int gp_Embed(graphP theGraph, unsigned int embedFlags) cdef int gp_TestEmbedResultIntegrity(graphP theGraph, graphP origGraph, int embedResult) cdef int gp_GetEmbedFlags(graphP theGraph) cdef unsigned gp_GetObstructionMinorType(graphP theGraph) # Surfaced from planarity/c/graphLib/planarityRelated/graphOuterplanarity.h cdef int gp_ExtendWith_Outerplanarity(graphP theGraph) cdef int gp_Detach_Outerplanarity(graphP theGraph) # Surfaced from planarity/c/graphLib/planarityRelated/graphDrawPlanar.h cdef int gp_ExtendWith_DrawPlanar(graphP theGraph) cdef int gp_Detach_DrawPlanar(graphP theGraph) cdef int gp_DrawPlanar_RenderToFile(graphP theEmbedding, char *theFileName) cdef int gp_DrawPlanar_RenderToString(graphP theEmbedding, char **pRenditionString) cdef int gp_DrawPlanar_GetVertexPosition(graphP theEmbedding, int v) cdef int gp_DrawPlanar_GetVertexStart(graphP theEmbedding, int v) cdef int gp_DrawPlanar_GetVertexEnd(graphP theEmbedding, int v) cdef int gp_DrawPlanar_GetEdgePosition(graphP theEmbedding, int e) cdef int gp_DrawPlanar_GetEdgeStart(graphP theEmbedding, int e) cdef int gp_DrawPlanar_GetEdgeEnd(graphP theEmbedding, int e) # Surfaced from planarity/c/graphLib/homeomorphSearch/graphK23Search.h cdef int gp_ExtendWith_K23Search(graphP theGraph) cdef int gp_Detach_K23Search(graphP theGraph) # Surfaced from planarity/c/graphLib/homeomorphSearch/graphK33Search.h cdef int gp_ExtendWith_K33Search(graphP theGraph) cdef int gp_Detach_K33Search(graphP theGraph) # Surfaced from planarity/c/graphLib/homeomorphSearch/graphK4Search.h cdef int gp_ExtendWith_K4Search(graphP theGraph) cdef int gp_Detach_K4Search(graphP theGraph) graph-algorithms-planarity-08d7b51/planarity/full/graphLib.pyx000066400000000000000000000550761522057144000245730ustar00rootroot00000000000000#!/usr/bin/env python # cython: embedsignature=True """ Cython wrapper for the Edge Addition Planarity Suite Graph Library Wraps functions and macros that operate over graphP structs and to exposes the G6 read and write iterator machinery. NOTE: No bounds/error checking is done here, and is rather the responsibility of the caller to make sure these functions are being called legitimately. """ from planarity.full cimport cgraphLib from planarity.full.cgraphLib cimport graphP, G6ReadIteratorP, G6WriteIteratorP # Surfaced from planarityc/graphLib/lowLevelUtils/apiutils.h QUIETMODE_NONE = cgraphLib.QUIETMODE_NONE QUIETMODE_ERRORS = cgraphLib.QUIETMODE_ERRORS QUIETMODE_MESSAGES = cgraphLib.QUIETMODE_MESSAGES QUIETMODE_ALL = cgraphLib.QUIETMODE_ALL # Surfaced from planarity/c/graphLib/graphLib.h OK = cgraphLib.OK NOTOK = cgraphLib.NOTOK TRUE = cgraphLib.TRUE FALSE = cgraphLib.FALSE NIL = cgraphLib.NIL # Surfaced from planarity/c/graphLib/graph.h VERTEX_VISITED_MASK = cgraphLib.VERTEX_VISITED_MASK VERTEX_MARKED_MASK = cgraphLib.VERTEX_MARKED_MASK EDGE_VISITED_MASK = cgraphLib.EDGE_VISITED_MASK EDGE_MARKED_MASK = cgraphLib.EDGE_MARKED_MASK EDGE_TYPE_MASK = cgraphLib.EDGE_TYPE_MASK EDGE_TYPE_CHILD = cgraphLib.EDGE_TYPE_CHILD EDGE_TYPE_FORWARD = cgraphLib.EDGE_TYPE_FORWARD EDGE_TYPE_PARENT = cgraphLib.EDGE_TYPE_PARENT EDGE_TYPE_BACK = cgraphLib.EDGE_TYPE_BACK EDGE_TYPE_NOTDEFINED = cgraphLib.EDGE_TYPE_NOTDEFINED EDGE_TYPE_TREE = cgraphLib.EDGE_TYPE_TREE EDGEFLAG_INVERTED_MASK = cgraphLib.EDGEFLAG_INVERTED_MASK EDGEFLAG_DIRECTION_INONLY = cgraphLib.EDGEFLAG_DIRECTION_INONLY EDGEFLAG_DIRECTION_OUTONLY = cgraphLib.EDGEFLAG_DIRECTION_OUTONLY EDGEFLAG_DIRECTION_MASK = cgraphLib.EDGEFLAG_DIRECTION_MASK DEFAULT_EDGE_CAPACITY_FACTOR = cgraphLib.DEFAULT_EDGE_CAPACITY_FACTOR AT_EDGE_CAPACITY_LIMIT = cgraphLib.AT_EDGE_CAPACITY_LIMIT # Surfaced from planarity/c/graphLib/io/graphIO.h WRITE_ADJLIST = cgraphLib.WRITE_ADJLIST WRITE_ADJMATRIX = cgraphLib.WRITE_ADJMATRIX WRITE_G6 = cgraphLib.WRITE_G6 GRAPHFLAGS_ZEROBASEDIO = cgraphLib.GRAPHFLAGS_ZEROBASEDIO # Surfaced from planarity/c/graphLib/graphDFSUtils.h DFSUTILS_NAME = cgraphLib.DFSUTILS_NAME GRAPHFLAGS_EXTENDEDWITH_DFSUTILS = cgraphLib.GRAPHFLAGS_EXTENDEDWITH_DFSUTILS GRAPHFLAGS_DFSNUMBERED = cgraphLib.GRAPHFLAGS_DFSNUMBERED GRAPHFLAGS_SORTEDBYDFI = cgraphLib.GRAPHFLAGS_SORTEDBYDFI # Surfaced from planarity/c/graphLib/planarityRelated/graphPlanarity.h PLANARITY_NAME = cgraphLib.PLANARITY_NAME GRAPHFLAGS_EXTENDEDWITH_PLANARITY = cgraphLib.GRAPHFLAGS_EXTENDEDWITH_PLANARITY NONEMBEDDABLE = cgraphLib.NONEMBEDDABLE EMBEDFLAGS_PLANAR = cgraphLib.EMBEDFLAGS_PLANAR EMBEDFLAGS_DRAWPLANAR = cgraphLib.EMBEDFLAGS_DRAWPLANAR EMBEDFLAGS_OUTERPLANAR = cgraphLib.EMBEDFLAGS_OUTERPLANAR EMBEDFLAGS_SEARCHFORK23 = cgraphLib.EMBEDFLAGS_SEARCHFORK23 EMBEDFLAGS_SEARCHFORK33 = cgraphLib.EMBEDFLAGS_SEARCHFORK33 EMBEDFLAGS_SEARCHFORK4 = cgraphLib.EMBEDFLAGS_SEARCHFORK4 MINORTYPE_NONE = cgraphLib.MINORTYPE_NONE MINORTYPE_A = cgraphLib.MINORTYPE_A MINORTYPE_B = cgraphLib.MINORTYPE_B MINORTYPE_C = cgraphLib.MINORTYPE_C MINORTYPE_D = cgraphLib.MINORTYPE_D MINORTYPE_E = cgraphLib.MINORTYPE_E MINORTYPE_E1 = cgraphLib.MINORTYPE_E1 MINORTYPE_E2 = cgraphLib.MINORTYPE_E2 MINORTYPE_E3 = cgraphLib.MINORTYPE_E3 MINORTYPE_E4 = cgraphLib.MINORTYPE_E4 MINORTYPE_E5 = cgraphLib.MINORTYPE_E5 MINORTYPE_E6 = cgraphLib.MINORTYPE_E6 MINORTYPE_E7 = cgraphLib.MINORTYPE_E7 # Surfaced from planarity/c/graphLib/planarityRelated/graphOuterplanarity.h OUTERPLANARITY_NAME = cgraphLib.OUTERPLANARITY_NAME GRAPHFLAGS_EXTENDEDWITH_OUTERPLANARITY = cgraphLib.GRAPHFLAGS_EXTENDEDWITH_OUTERPLANARITY # Surfaced from planarity/c/graphLib/planarityRelated/graphDrawPlanar.h DRAWPLANAR_NAME = cgraphLib.DRAWPLANAR_NAME # Surfaced from planarity/c/graphLib/homeomorphSearch/graphK23Search.h K23SEARCH_NAME = cgraphLib.K23SEARCH_NAME # Surfaced from planarity/c/graphLib/homeomorphSearch/graphK33Search.h K33SEARCH_NAME = cgraphLib.K33SEARCH_NAME # Surfaced from planarity/c/graphLib/homeomorphSearch/graphK4Search.h K4SEARCH_NAME = cgraphLib.K4SEARCH_NAME # Functions to be made available when importing package from Python def gp_GetQuietMode() -> int: return cgraphLib.gp_GetQuietMode() def gp_SetQuietMode(int newQuietMode) -> None: cgraphLib.gp_SetQuietMode(newQuietMode) def gp_GetProjectVersionFull() -> str: cdef bytes encoded_version = cgraphLib.gp_GetProjectVersionFull() return encoded_version.decode('utf-8') def gp_GetLibPlanarityVersionFull() -> str: cdef bytes encoded_version = cgraphLib.gp_GetLibPlanarityVersionFull() return encoded_version.decode('utf-8') # Cython cdef functions that are meant to be exposed to the planarity.full # subpackage's Cython modules # Wraps functions declared in "planarity/c/graphLib/graph.h": cdef graphP gp_New(): return cgraphLib.gp_New() cdef int gp_EnsureVertexCapacity(graphP theGraph, int N): return cgraphLib.gp_EnsureVertexCapacity(theGraph, N) cdef int gp_EnsureEdgeCapacity(graphP theGraph, int requiredEdgeCapacity): return cgraphLib.gp_EnsureEdgeCapacity(theGraph, requiredEdgeCapacity) cdef void gp_ResetGraphStorage(graphP theGraph): cgraphLib.gp_ResetGraphStorage(theGraph) cdef void gp_Free(graphP *pGraph): cgraphLib.gp_Free(pGraph) cdef int gp_GetN(graphP theGraph): return cgraphLib.gp_GetN(theGraph) cdef int gp_GetNV(graphP theGraph): return cgraphLib.gp_GetNV(theGraph) cdef int gp_GetM(graphP theGraph): return cgraphLib.gp_GetM(theGraph) cdef int gp_GetEdgeCapacity(graphP theGraph): return cgraphLib.gp_GetEdgeCapacity(theGraph) cdef int gp_CopyGraph(graphP dstGraph, graphP srcGraph): return cgraphLib.gp_CopyGraph(dstGraph, srcGraph) cdef graphP gp_DupGraph(graphP theGraph): return cgraphLib.gp_DupGraph(theGraph) cdef int gp_CopyAdjacencyLists(graphP dstGraph, graphP srcGraph): return cgraphLib.gp_CopyAdjacencyLists(dstGraph, srcGraph) cdef int gp_CreateRandomGraph(graphP theGraph): return cgraphLib.gp_CreateRandomGraph(theGraph) cdef int gp_CreateRandomGraphEx(graphP theGraph, int numEdges): return cgraphLib.gp_CreateRandomGraphEx(theGraph, numEdges) cdef int gp_IsNeighbor(graphP theGraph, int u, int v): return cgraphLib.gp_IsNeighbor(theGraph, u, v) cdef int gp_FindEdge(graphP theGraph, int u, int v): return cgraphLib.gp_FindEdge(theGraph, u, v) cdef int gp_GetVertexDegree(graphP theGraph, int v): return cgraphLib.gp_GetVertexDegree(theGraph, v) cdef int gp_IsNeighborDirected(graphP theGraph, int u, int v, unsigned direction): return cgraphLib.gp_IsNeighborDirected(theGraph, u, v, direction) cdef int gp_FindDirectedEdge(graphP theGraph, int u, int v, unsigned direction): return cgraphLib.gp_FindDirectedEdge(theGraph, u, v, direction) cdef int gp_GetVertexInDegree(graphP theGraph, int v): return cgraphLib.gp_GetVertexInDegree(theGraph, v) cdef int gp_GetVertexOutDegree(graphP theGraph, int v): return cgraphLib.gp_GetVertexOutDegree(theGraph, v) cdef int gp_AddEdge(graphP theGraph, int u, int ulink, int v, int vlink): return cgraphLib.gp_AddEdge(theGraph, u, ulink, v, vlink) cdef int gp_DynamicAddEdge(graphP theGraph, int u, int ulink, int v, int vlink): return cgraphLib.gp_DynamicAddEdge(theGraph, u, ulink, v, vlink) cdef int gp_InsertEdge(graphP theGraph, int u, int e_u, int e_ulink, int v, int e_v, int e_vlink): return cgraphLib.gp_InsertEdge(theGraph, u, e_u, e_ulink, v, e_v, e_vlink) cdef int gp_DeleteEdge(graphP theGraph, int e): return cgraphLib.gp_DeleteEdge(theGraph, e) cdef void gp_HideEdge(graphP theGraph, int e): cgraphLib.gp_HideEdge(theGraph, e) cdef void gp_RestoreEdge(graphP theGraph, int e): cgraphLib.gp_RestoreEdge(theGraph, e) cdef int gp_HideVertex(graphP theGraph, int vertex): return cgraphLib.gp_HideVertex(theGraph, vertex) cdef int gp_RestoreVertex(graphP theGraph): return cgraphLib.gp_RestoreVertex(theGraph) cdef int gp_ContractEdge(graphP theGraph, int e): return cgraphLib.gp_ContractEdge(theGraph, e) cdef int gp_IdentifyVertices(graphP theGraph, int u, int v, int eBefore): return cgraphLib.gp_IdentifyVertices(theGraph, u, v, eBefore) cdef int gp_RestoreVertices(graphP theGraph): return cgraphLib.gp_RestoreVertices(theGraph) cdef int gp_GetGraphFlags(graphP theGraph): return cgraphLib.gp_GetGraphFlags(theGraph) cdef int gp_GetFirstEdge(graphP theGraph, int v): return cgraphLib.gp_GetFirstEdge(theGraph, v) cdef int gp_GetLastEdge(graphP theGraph, int v): return cgraphLib.gp_GetLastEdge(theGraph, v) cdef int gp_GetEdgeByLink(graphP theGraph, int v, int theLink): return cgraphLib.gp_GetEdgeByLink(theGraph, v, theLink) cdef void gp_SetFirstEdge(graphP theGraph, int v, int newFirstEdge): cgraphLib.gp_SetFirstEdge(theGraph, v, newFirstEdge) cdef void gp_SetLastEdge(graphP theGraph, int v, int newLastEdge): cgraphLib.gp_SetLastEdge(theGraph, v, newLastEdge) cdef void gp_SetEdgeByLink(graphP theGraph, int v, int theLink, int newEdge): cgraphLib.gp_SetEdgeByLink(theGraph, v, theLink, newEdge) cdef int gp_LowerBoundVertices(graphP theGraph): return cgraphLib.gp_LowerBoundVertices(theGraph) cdef int gp_UpperBoundVertices(graphP theGraph): return cgraphLib.gp_UpperBoundVertices(theGraph) cdef int gp_LowerBoundVirtualVertices(graphP theGraph): return cgraphLib.gp_LowerBoundVirtualVertices(theGraph) cdef int gp_UpperBoundVirtualVertices(graphP theGraph): return cgraphLib.gp_UpperBoundVirtualVertices(theGraph) cdef int gp_LowerBoundVertexStorage(graphP theGraph): return cgraphLib.gp_LowerBoundVertexStorage(theGraph) cdef int gp_UpperBoundVertexStorage(graphP theGraph): return cgraphLib.gp_UpperBoundVertexStorage(theGraph) cdef int gp_IsVertex(graphP theGraph, int v): return cgraphLib.gp_IsVertex(theGraph, v) cdef int gp_IsVirtualVertex(graphP theGraph, int v): return cgraphLib.gp_IsVirtualVertex(theGraph, v) cdef int gp_IsNotVertex(graphP theGraph, int v): return cgraphLib.gp_IsNotVertex(theGraph, v) cdef int gp_IsNotVirtualVertex(graphP theGraph, int v): return cgraphLib.gp_IsNotVirtualVertex(theGraph, v) cdef int gp_VirtualVertexInUse(graphP theGraph, int virtualVertex): return cgraphLib.gp_VirtualVertexInUse(theGraph, virtualVertex) cdef int gp_VirtualVertexNotInUse(graphP theGraph, int virtualVertex): return cgraphLib.gp_VirtualVertexNotInUse(theGraph, virtualVertex) cdef int gp_GetIndex(graphP theGraph, int v): return cgraphLib.gp_GetIndex(theGraph, v) cdef void gp_SetIndex(graphP theGraph, int v, int theIndex): cgraphLib.gp_SetIndex(theGraph, v, theIndex) cdef void gp_InitFlags(graphP theGraph, int v): cgraphLib.gp_InitFlags(theGraph, v) cdef int gp_GetVisited(graphP theGraph, int v): return cgraphLib.gp_GetVisited(theGraph, v) cdef void gp_ClearVisited(graphP theGraph, int v): cgraphLib.gp_ClearVisited(theGraph, v) cdef void gp_SetVisited(graphP theGraph, int v): cgraphLib.gp_SetVisited(theGraph, v) cdef int gp_GetMarked(graphP theGraph, int v): return cgraphLib.gp_GetMarked(theGraph, v) cdef void gp_ClearMarked(graphP theGraph, int v): cgraphLib.gp_ClearMarked(theGraph, v) cdef void gp_SetMarked(graphP theGraph, int v): cgraphLib.gp_SetMarked(theGraph, v) cdef int gp_GetTwin(graphP theGraph, int e): return cgraphLib.gp_GetTwin(theGraph, e) cdef int gp_GetNextEdge(graphP theGraph, int e): return cgraphLib.gp_GetNextEdge(theGraph, e) cdef int gp_GetPrevEdge(graphP theGraph, int e): return cgraphLib.gp_GetPrevEdge(theGraph, e) cdef int gp_GetAdjacentEdge(graphP theGraph, int e, int theLink): return cgraphLib.gp_GetAdjacentEdge(theGraph, e, theLink) cdef void gp_SetNextEdge(graphP theGraph, int e, int newNextEdge): cgraphLib.gp_SetNextEdge(theGraph, e, newNextEdge) cdef void gp_SetPrevEdge(graphP theGraph, int e, int newPrevEdge): cgraphLib.gp_SetPrevEdge(theGraph, e, newPrevEdge) cdef void gp_SetAdjacentEdge(graphP theGraph, int e, int theLink, int newEdge): cgraphLib.gp_SetAdjacentEdge(theGraph, e, theLink, newEdge) cdef int gp_IsEdge(graphP theGraph, int e): return cgraphLib.gp_IsEdge(theGraph, e) cdef int gp_IsNotEdge(graphP theGraph, int e): return cgraphLib.gp_IsNotEdge(theGraph, e) cdef int gp_GetNeighbor(graphP theGraph, int e): return cgraphLib.gp_GetNeighbor(theGraph, e) cdef void gp_SetNeighbor(graphP theGraph, int e, int v): cgraphLib.gp_SetNeighbor(theGraph, e, v) cdef void gp_InitEdgeFlags(graphP theGraph, int e): cgraphLib.gp_InitEdgeFlags(theGraph, e) cdef int gp_GetEdgeVisited(graphP theGraph, int e): return cgraphLib.gp_GetEdgeVisited(theGraph, e) cdef void gp_ClearEdgeVisited(graphP theGraph, int e): cgraphLib.gp_ClearEdgeVisited(theGraph, e) cdef void gp_SetEdgeVisited(graphP theGraph, int e): cgraphLib.gp_SetEdgeVisited(theGraph, e) cdef int gp_GetEdgeMarked(graphP theGraph, int e): return cgraphLib.gp_GetEdgeMarked(theGraph, e) cdef void gp_ClearEdgeMarked(graphP theGraph, int e): cgraphLib.gp_ClearEdgeMarked(theGraph, e) cdef void gp_SetEdgeMarked(graphP theGraph, int e): cgraphLib.gp_SetEdgeMarked(theGraph, e) cdef int gp_GetEdgeType(graphP theGraph, int e): return cgraphLib.gp_GetEdgeType(theGraph, e) cdef void gp_ClearEdgeType(graphP theGraph, int e): cgraphLib.gp_ClearEdgeType(theGraph, e) cdef void gp_SetEdgeType(graphP theGraph, int e, int type): cgraphLib.gp_SetEdgeType(theGraph, e, type) cdef void gp_ResetEdgeType(graphP theGraph, int e, int type): cgraphLib.gp_ResetEdgeType(theGraph, e, type) cdef int gp_GetEdgeFlagInverted(graphP theGraph, int e): return cgraphLib.gp_GetEdgeFlagInverted(theGraph, e) cdef void gp_SetEdgeFlagInverted(graphP theGraph, int e): cgraphLib.gp_SetEdgeFlagInverted(theGraph, e) cdef void gp_ClearEdgeFlagInverted(graphP theGraph, int e): cgraphLib.gp_ClearEdgeFlagInverted(theGraph, e) cdef void gp_XorEdgeFlagInverted(graphP theGraph, int e): cgraphLib.gp_XorEdgeFlagInverted(theGraph, e) cdef int gp_GetDirection(graphP theGraph, int e): return cgraphLib.gp_GetDirection(theGraph, e) cdef void gp_SetDirection(graphP theGraph, int e, int direction): cgraphLib.gp_SetDirection(theGraph, e, direction) cdef int gp_LowerBoundEdges(graphP theGraph): return cgraphLib.gp_LowerBoundEdges(theGraph) cdef int gp_UpperBoundEdges(graphP theGraph): return cgraphLib.gp_UpperBoundEdges(theGraph) cdef int gp_EdgeInUse(graphP theGraph, int e): return cgraphLib.gp_EdgeInUse(theGraph, e) cdef int gp_EdgeNotInUse(graphP theGraph, int e): return cgraphLib.gp_EdgeNotInUse(theGraph, e) cdef int gp_LowerBoundEdgeStorage(graphP theGraph): return cgraphLib.gp_LowerBoundEdgeStorage(theGraph) cdef int gp_UpperBoundEdgeStorage(graphP theGraph): return cgraphLib.gp_UpperBoundEdgeStorage(theGraph) # Wraps functions declared in "planarity/c/graphLib/io/graphIO.h": cdef int gp_Read(graphP theGraph, char *fileName): return cgraphLib.gp_Read(theGraph, fileName) cdef int gp_ReadFromString(graphP theGraph, char *inputStr): return cgraphLib.gp_ReadFromString(theGraph, inputStr) cdef int gp_Write(graphP theGraph, char *fileName, int writeMode): return cgraphLib.gp_Write(theGraph, fileName, writeMode) cdef int gp_WriteToString(graphP theGraph, char **pOutputStr, int writeMode): return cgraphLib.gp_WriteToString(theGraph, pOutputStr, writeMode) # Wraps functions declared in "planarity/c/graphLib/io/g6-read-iterator.h": cdef int g6_NewReader(G6ReadIteratorP *pG6ReadIterator, graphP theGraph): return cgraphLib.g6_NewReader(pG6ReadIterator, theGraph) cdef int g6_InitReaderWithString(G6ReadIteratorP theG6ReadIterator, char *inputString): return cgraphLib.g6_InitReaderWithString(theG6ReadIterator, inputString) cdef int g6_InitReaderWithFileName(G6ReadIteratorP theG6ReadIterator, char *infileName): return cgraphLib.g6_InitReaderWithFileName(theG6ReadIterator, infileName) cdef int g6_ReadGraph(G6ReadIteratorP theG6ReadIterator): return cgraphLib.g6_ReadGraph(theG6ReadIterator) cdef int g6_EndReached(G6ReadIteratorP theG6ReadIterator): return cgraphLib.g6_EndReached(theG6ReadIterator) cdef void g6_FreeReader(G6ReadIteratorP *pG6ReadIterator): cgraphLib.g6_FreeReader(pG6ReadIterator) # Wraps functions declared in "planarity/c/graphLib/io/g6-write-iterator.h" cdef int g6_NewWriter(G6WriteIteratorP *pG6WriteIterator, graphP theGraph): return cgraphLib.g6_NewWriter(pG6WriteIterator, theGraph) cdef int g6_InitWriterWithString(G6WriteIteratorP theG6WriteIterator, char **pOutputString): return cgraphLib.g6_InitWriterWithString(theG6WriteIterator, pOutputString) cdef int g6_InitWriterWithFileName(G6WriteIteratorP theG6WriteIterator, char *outputFileName): return cgraphLib.g6_InitWriterWithFileName(theG6WriteIterator, outputFileName) cdef int g6_WriteGraph(G6WriteIteratorP theG6WriteIterator): return cgraphLib.g6_WriteGraph(theG6WriteIterator) cdef void g6_FreeWriter(G6WriteIteratorP *pG6WriteIterator): cgraphLib.g6_FreeWriter(pG6WriteIterator) # Wraps functions declared in "planarity/c/graphLib/graphDFSUtils.h" cdef int gp_ExtendWith_DFSUtils(graphP theGraph): return cgraphLib.gp_ExtendWith_DFSUtils(theGraph) cdef int gp_Detach_DFSUtils(graphP theGraph): return cgraphLib.gp_Detach_DFSUtils(theGraph) cdef int gp_DepthFirstSearch(graphP theGraph): return cgraphLib.gp_DepthFirstSearch(theGraph) cdef int gp_SortVertices(graphP theGraph): return cgraphLib.gp_SortVertices(theGraph) cdef int gp_ComputeLowpoints(graphP theGraph): return cgraphLib.gp_ComputeLowpoints(theGraph) cdef int gp_ComputeLeastAncestors(graphP theGraph): return cgraphLib.gp_ComputeLeastAncestors(theGraph) cdef int gp_GetParent(graphP theGraph, int v): return cgraphLib.gp_GetParent(theGraph, v) cdef int gp_GetLeastAncestor(graphP theGraph, int v): return cgraphLib.gp_GetLeastAncestor(theGraph, v) cdef int gp_GetLowpoint(graphP theGraph, int v): return cgraphLib.gp_GetLowpoint(theGraph, v) # FIXME: These EAPS macros call private gp_GetVertexParent() rather than # public gp_GetParent(), so we have implemented them in graph.pyx for now # and should switch to these commented-out versions once EAPS is fixed. # cdef int gp_IsDFSTreeRoot(graphP theGraph, int v): # return cgraphLib.gp_IsDFSTreeRoot(theGraph, v) # cdef int gp_IsNotDFSTreeRoot(graphP theGraph, int v): # return cgraphLib.gp_IsNotDFSTreeRoot(theGraph, v) cdef int gp_GetBicompRootFromDFSChild(graphP theGraph, int c): return cgraphLib.gp_GetBicompRootFromDFSChild(theGraph, c) cdef int gp_GetDFSChildFromBicompRoot(graphP theGraph, int R): return cgraphLib.gp_GetDFSChildFromBicompRoot(theGraph, R) # FIXME: This EAPS macro calls private gp_GetVertexParent() rather than # public gp_GetParent(), so we have implemented it in graph.pyx for now # and should switch to this commented-out version once EAPS is fixed. # cdef int gp_GetVertexFromBicompRoot(graphP theGraph, int R): # return cgraphLib.gp_GetVertexFromBicompRoot(theGraph, R) cdef int gp_IsBicompRoot(graphP theGraph, int v): return cgraphLib.gp_IsBicompRoot(theGraph, v) cdef int gp_IsSeparatedDFSChild(graphP theGraph, int theChild): return cgraphLib.gp_IsSeparatedDFSChild(theGraph, theChild) cdef int gp_IsNotSeparatedDFSChild(graphP theGraph, int theChild): return cgraphLib.gp_IsNotSeparatedDFSChild(theGraph, theChild) # Wraps functions declared in "planarity/c/graphLib/planarityRelated/graphPlanarity.h": cdef int gp_ExtendWith_Planarity(graphP theGraph): return cgraphLib.gp_ExtendWith_Planarity(theGraph) cdef int gp_Detach_Planarity(graphP theGraph): return cgraphLib.gp_Detach_Planarity(theGraph) cdef int gp_Embed(graphP theGraph, unsigned int embedFlags): return cgraphLib.gp_Embed(theGraph, embedFlags) cdef int gp_TestEmbedResultIntegrity(graphP theGraph, graphP origGraph, int embedResult): return cgraphLib.gp_TestEmbedResultIntegrity(theGraph, origGraph, embedResult) cdef int gp_GetEmbedFlags(graphP theGraph): return cgraphLib.gp_GetEmbedFlags(theGraph) cdef unsigned gp_GetObstructionMinorType(graphP theGraph): return cgraphLib.gp_GetObstructionMinorType(theGraph) # Wraps functions declared in "planarity/c/graphLib/planarityRelated/graphOuterplanarity.h": cdef int gp_ExtendWith_Outerplanarity(graphP theGraph): return cgraphLib.gp_ExtendWith_Outerplanarity(theGraph) cdef int gp_Detach_Outerplanarity(graphP theGraph): return cgraphLib.gp_Detach_Outerplanarity(theGraph) # Wraps functions declared in "planarity/c/graphLib/planarityRelated/graphDrawPlanar.h": cdef int gp_ExtendWith_DrawPlanar(graphP theGraph): return cgraphLib.gp_ExtendWith_DrawPlanar(theGraph) cdef int gp_Detach_DrawPlanar(graphP theGraph): return cgraphLib.gp_Detach_DrawPlanar(theGraph) cdef int gp_DrawPlanar_RenderToFile(graphP theEmbedding, char *theFileName): return cgraphLib.gp_DrawPlanar_RenderToFile(theEmbedding, theFileName) cdef int gp_DrawPlanar_RenderToString(graphP theEmbedding, char **pRenditionString): return cgraphLib.gp_DrawPlanar_RenderToString(theEmbedding, pRenditionString) cdef int gp_DrawPlanar_GetVertexPosition(graphP theEmbedding, int v): return cgraphLib.gp_DrawPlanar_GetVertexPosition(theEmbedding, v) cdef int gp_DrawPlanar_GetVertexStart(graphP theEmbedding, int v): return cgraphLib.gp_DrawPlanar_GetVertexStart(theEmbedding, v) cdef int gp_DrawPlanar_GetVertexEnd(graphP theEmbedding, int v): return cgraphLib.gp_DrawPlanar_GetVertexEnd(theEmbedding, v) cdef int gp_DrawPlanar_GetEdgePosition(graphP theEmbedding, int e): return cgraphLib.gp_DrawPlanar_GetEdgePosition(theEmbedding, e) cdef int gp_DrawPlanar_GetEdgeStart(graphP theEmbedding, int e): return cgraphLib.gp_DrawPlanar_GetEdgeStart(theEmbedding, e) cdef int gp_DrawPlanar_GetEdgeEnd(graphP theEmbedding, int e): return cgraphLib.gp_DrawPlanar_GetEdgeEnd(theEmbedding, e) # Wraps functions declared in "planarity/c/graphLib/homeomorphSearch/graphK23Search.h": cdef int gp_ExtendWith_K23Search(graphP theGraph): return cgraphLib.gp_ExtendWith_K23Search(theGraph) cdef int gp_Detach_K23Search(graphP theGraph): return cgraphLib.gp_Detach_K23Search(theGraph) # Wraps functions declared in "planarity/c/graphLib/homeomorphSearch/graphK33Search.h": cdef int gp_ExtendWith_K33Search(graphP theGraph): return cgraphLib.gp_ExtendWith_K33Search(theGraph) cdef int gp_Detach_K33Search(graphP theGraph): return cgraphLib.gp_Detach_K33Search(theGraph) # Wraps functions declared in "planarity/c/graphLib/homeomorphSearch/graphK4Search.h": cdef int gp_ExtendWith_K4Search(graphP theGraph): return cgraphLib.gp_ExtendWith_K4Search(theGraph) cdef int gp_Detach_K4Search(graphP theGraph): return cgraphLib.gp_Detach_K4Search(theGraph) graph-algorithms-planarity-08d7b51/pyproject.toml000066400000000000000000000066131522057144000222410ustar00rootroot00000000000000# Based on documentation from # https://packaging.python.org/en/latest/guides/writing-pyproject-toml/ # and https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html [build-system] requires = ["setuptools", "cython"] build-backend = "setuptools.build_meta" [project] name = "planarity" authors = [ {name = "John M. Boyer", email = "john.boyer.phd@gmail.com"}, {name = "Wanda B. K. Boyer", email = "wbkboyer@gmail.com"}, {name = "Aric Hagberg", email = "aric.hagberg@gmail.com"}, ] # NOTE: Only one of authors and maintainers is required, per # https://packaging.python.org/en/latest/specifications/pyproject-toml # However, also having maintainers allows a different first maintainer # to appear, since only the first entry shows on the package page maintainers = [ {name = "Wanda B. K. Boyer", email = "wbkboyer@gmail.com"}, {name = "John M. Boyer", email = "john.boyer.phd@gmail.com"}, {name = "Aric Hagberg", email = "aric.hagberg@gmail.com"}, ] description = "Python Wrapper for the Edge Addition Planarity Suite and Graph Library" readme = "README.md" requires-python = ">=3.10" keywords = [ "Graph Theory", "Mathematics", "Discrete Mathematics", "Graph Algorithms", "graph", "algorithms", "math", ] license = "BSD-3-Clause" license-files = ["LICEN[CS]E*"] classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "Intended Audience :: Education", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", "Programming Language :: Python :: 3 :: Only", "Programming Language :: C", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Scientific/Engineering :: Bio-Informatics", "Topic :: Scientific/Engineering :: Chemistry", "Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)", "Topic :: Scientific/Engineering :: Information Analysis", "Topic :: Scientific/Engineering :: Mathematics", "Topic :: Scientific/Engineering :: Physics", "Topic :: Scientific/Engineering :: Visualization" ] dynamic = ["version"] [tool.setuptools] include-package-data = false packages = [ "planarity", "planarity.classic", "planarity.full", ] # NOTE: This enables dynamic metadata, e.g. versioning, to be computed during # the build process; see: # https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#dynamic-metadata # NOTE: In the future, we could automatically generate the version number by # configuring setuptools-scm, but presently declaring a variable at the package # level is simplest. [tool.setuptools.dynamic] version = {attr = "planarity.__version__"} [project.urls] Homepage = "https://github.com/graph-algorithms/planarity" Documentation = "https://github.com/graph-algorithms/planarity/wiki" Repository = "https://github.com/graph-algorithms/planarity.git" Issues = "https://github.com/graph-algorithms/planarity/issues" Download = "https://pypi.org/project/planarity/" graph-algorithms-planarity-08d7b51/requirements.txt000066400000000000000000000000771522057144000226070ustar00rootroot00000000000000setuptools wheel cython build twine pytest networkx matplotlib graph-algorithms-planarity-08d7b51/setup.py000066400000000000000000000022621522057144000210330ustar00rootroot00000000000000from glob import glob from setuptools import setup, Extension try: from Cython.Build import cythonize except ImportError: USE_CYTHON = False else: USE_CYTHON = True ext = ".pyx" if USE_CYTHON else ".c" classic_sourcefiles = [ "planarity/classic/planarity" + ext, ] classic_sourcefiles.extend(glob("planarity/c/graphLib/**/*.c", recursive=True)) graphLib_sourcefiles = [ "planarity/full/graphLib" + ext, ] graphLib_sourcefiles.extend( glob("planarity/c/graphLib/**/*.c", recursive=True) ) extensions = [ Extension( name="planarity.classic.planarity", sources=classic_sourcefiles, include_dirs=['planarity/c/graphLib'], ), Extension( name="planarity.full.graphLib", sources=graphLib_sourcefiles, include_dirs=["planarity/c/graphLib"], ), Extension( name="planarity.full.g6IterationUtils", sources=[f"planarity/full/g6IterationUtils{ext}"], ), Extension( name="planarity.full.graph", sources=[f"planarity/full/graph{ext}"], ), ] if USE_CYTHON: from Cython.Build import cythonize extensions = cythonize(extensions) setup( ext_modules = extensions, ) graph-algorithms-planarity-08d7b51/tests/000077500000000000000000000000001522057144000204615ustar00rootroot00000000000000graph-algorithms-planarity-08d7b51/tests/test_planarity.py000066400000000000000000000101121522057144000240700ustar00rootroot00000000000000import os import tempfile import planarity class TestPlanarity: @classmethod def setup_class(self): self.k5_adj_symmetric = {0: {1: {}, 2: {}, 3: {}, 4: {}}, 1: {0: {}, 2: {}, 3: {}, 4: {}}, 2: {0: {}, 1: {}, 3: {}, 4: {}}, 3: {0: {}, 1: {}, 2: {}, 4: {}}, 4: {0: {}, 1: {}, 2: {}, 3: {}}} self.k5_adj = {0: {1: {}, 2: {}, 3: {}, 4: {}}, 1: {2: {}, 3: {}, 4: {}}, 2: {3: {}, 4: {}}, 3: {4: {}}, 4: {}} self.k5_adj_set = {0: set([1,2,3,4]), 1: set([2,3,4]), 2: set([3,4]), 3: set([4]), 4: set([])} self.k5_adj_list = {0: list([1,2,3,4]), 1: list([2,3,4]), 2: list([3,4]), 3: list([4]), 4: list([])} self.k5_edgelist = [(0, 1), (0, 2), (0, 3), (0, 4), (1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)] self.p4_adj = {0: {1: {}}, 1: {0: {}, 2: {}}, 2: {1: {}, 3: {}}, 3: {2: {}}} self.p4_edgelist = [(0, 1), (1, 2), (2, 3)] def test_is_planar_edgelist_input(self): P = planarity.PGraph(self.p4_edgelist) assert P.is_planar() is True P = planarity.PGraph(self.k5_edgelist) assert P.is_planar() is False def test_is_planar_edgelist_input_function(self): assert planarity.is_planar(self.k5_edgelist) is False def test_is_planar_adj_input(self): P = planarity.PGraph(self.p4_adj) assert P.is_planar() is True P=planarity.PGraph(self.k5_adj) assert P.is_planar() is False def test_is_planar_adj_input_function(self): assert planarity.is_planar(self.k5_adj) is False def test_is_planar_adj_symmetric(self): P = planarity.PGraph(self.k5_adj_symmetric) assert P.is_planar() is False def test_is_planar_adj_set(self): P = planarity.PGraph(self.k5_adj_set) assert P.is_planar() is False def test_is_planar_adj_list(self): P = planarity.PGraph(self.k5_adj_list) assert P.is_planar() is False def test_goldner_harary(self): # goldner-harary graph # http://en.wikipedia.org/wiki/Goldner%E2%80%93Harary_graph # a maximal planar graph e = [(1,2), ( 1,3 ),( 1,4 ),( 1,5 ),( 1,7 ),( 1,8 ),( 1,10 ), (1,11 ),( 2,3 ),( 2,4 ),( 2,6 ),( 2,7 ),( 2,9 ),( 2,10 ), ( 2,11 ),( 3,4 ),( 4,5 ),( 4,6 ),( 4,7 ),( 5,7 ),( 6,7 ), ( 7,8 ),( 7,9 ),( 7,10 ),( 8,10 ),( 9,10 ),( 10,11)] P = planarity.PGraph(e) assert P.is_planar() is True def test_kuratowski_k5(self): P = planarity.PGraph(self.k5_edgelist) edges = P.kuratowski_edges() assert frozenset(frozenset(x) for x in edges) == frozenset(frozenset(x) for x in self.k5_edgelist) def test_kuratowski_k5_function(self): edges = planarity.kuratowski_edges(self.k5_edgelist) assert frozenset(frozenset(x) for x in edges) == frozenset(frozenset(x) for x in self.k5_edgelist) def test_no_kuratowski_k5m(self): edges = self.k5_edgelist[:] edges.remove((0,1)) P = planarity.PGraph(edges) edges = P.kuratowski_edges() assert frozenset(edges) == frozenset() def test_draw_text(self): e = ([1,2],) P = planarity.PGraph(e) s = P.ascii()#.decode() assert s == '1\n|\n2\n \n' def test_write_adjlist(self): e = ([1,2],) P = planarity.PGraph(e) fname = tempfile.mktemp() P.write(fname) d = open(fname).read() answer = 'N=2\n1: 2 0\n2: 1 0\n' assert d == answer os.unlink(fname) graph-algorithms-planarity-08d7b51/tests/test_planarity_networkx.py000066400000000000000000000053201522057144000260360ustar00rootroot00000000000000import planarity from unittest import SkipTest class TestPlanarityNetworkX: @classmethod def setup_class(self): try: global nx import networkx as nx except ImportError: raise SkipTest('networkx not available.') self.planar=[] self.planar.extend([nx.path_graph(5), nx.complete_graph(4)]) self.non_planar=[] self.non_planar.extend([nx.complete_graph(5), nx.complete_bipartite_graph(3,3)]) def test_is_planar(self): for G in self.planar: assert planarity.is_planar(G) is True for G in self.non_planar: assert planarity.is_planar(G)is False def test_is_planar_unions(self): try: from itertools import combinations,product except ImportError: raise SkipTest('itertools.combinations not found') for (G1,G2) in combinations(self.planar,2): G=nx.disjoint_union(G1,G2) assert planarity.is_planar(G) is True for (G1,G2) in combinations(self.non_planar,2): G=nx.disjoint_union(G1,G2) assert planarity.is_planar(G) is False for (G1,G2) in product(self.planar,self.non_planar): G=nx.disjoint_union(G1,G2) assert planarity.is_planar(G) is False def test_goldner_harary(self): # goldner-harary graph # http://en.wikipedia.org/wiki/Goldner%E2%80%93Harary_graph # a maximal planar graph e= [(1,2 ),( 1,3 ),( 1,4 ),( 1,5 ),( 1,7 ),( 1,8 ),( 1,10 ), ( 1,11 ),( 2,3 ),( 2,4 ),( 2,6 ),( 2,7 ),( 2,9 ),( 2,10 ), ( 2,11 ),( 3,4 ),( 4,5 ),( 4,6 ),( 4,7 ),( 5,7 ),( 6,7 ), ( 7,8 ),( 7,9 ),( 7,10 ),( 8,10 ),( 9,10 ),( 10,11)] G=nx.Graph(e) assert planarity.is_planar(G) is True def test_kuratowski_k5(self): G=nx.complete_graph(5) K=planarity.kuratowski_subgraph(G) assert frozenset(G.nodes()) == frozenset(K.nodes()) assert frozenset(frozenset(x) for x in G.edges()) == frozenset(frozenset(x) for x in K.edges()) def test_kuratowski_k5m(self): G=nx.complete_graph(5) G.remove_edge(1,2) K=planarity.kuratowski_subgraph(G) assert frozenset(K.nodes()) == frozenset() assert frozenset(K.edges()) == frozenset() def test_networkx_graph(self): G=nx.Graph() G.add_edge(100,200) G.add_edge(200,300) G.add_node(1000) P=planarity.PGraph(G) H=planarity.networkx_graph(P) assert frozenset(G.nodes()) == frozenset(H.nodes()) assert frozenset(frozenset(x) for x in G.edges()) == frozenset(frozenset(x) for x in H.edges())